/** * Validates whether a given string is a valid IPv4 address. * * @experimental **UNSTABLE**: New API, yet to be vetted. * * @param addr IPv4 address in a string format (e.g., "192.168.0.1"). * @returns A boolean indicating if the string is a valid IPv4 address. * * @example Check if the address is a IPv4 * ```ts * import { isIPv4 } from "@std/net/unstable-ip" * import { assert, assertFalse } from "@std/assert" * * const correctIp = "192.168.0.1" * const incorrectIp = "192.168.0.256" * * assert(isIPv4(correctIp)) * assertFalse(isIPv4(incorrectIp)) * ``` */ export declare function isIPv4(addr: string): boolean; /** * Validates whether a given string is a IPv6 address. * * @experimental **UNSTABLE**: New API, yet to be vetted. * * @param addr IPv6 address in a string format (e.g., "2001:db8::1"). * @returns A boolean indicating if the string is a valid IPv6 address. * * @example Check if the address is a IPv6 * ```ts * import { isIPv6 } from "@std/net/unstable-ip" * import { assert, assertFalse } from "@std/assert" * * const correctIp = "2001::db8:0:1" * const incorrectIp = "2001::db8::1" * * assert(isIPv6(correctIp)) * assertFalse(isIPv6(incorrectIp)) * ``` */ export declare function isIPv6(addr: string): boolean; /** * Checks if an IP address matches a subnet or specific IP address. * * @experimental **UNSTABLE**: New API, yet to be vetted. * * @param addr The IP address to check (IPv4 or IPv6) * @param subnetOrIps The subnet in CIDR notation (e.g., "192.168.1.0/24") or a specific IP address * @returns true if the IP address matches the subnet or IP, false otherwise * @example Check if the address is a IPv6 * * ```ts * import { matchSubnets } from "@std/net/unstable-ip" * import { assert, assertFalse } from "@std/assert" * * assert(matchSubnets("192.168.1.10", ["192.168.1.0/24"])); * assertFalse(matchSubnets("192.168.2.10", ["192.168.1.0/24"])); * * assert(matchSubnets("2001:db8::ffff", ["2001:db8::/64"])); * assertFalse(matchSubnets("2001:db9::1", ["2001:db8::/64"])); * ``` */ export declare function matchSubnets(addr: string, subnetOrIps: string[]): boolean; /** * Checks if an IPv4 address matches a subnet or specific IPv4 address. * * @experimental **UNSTABLE**: New API, yet to be vetted. * * @param addr The IP address to check (IPv4) * @param subnet The subnet in CIDR notation (e.g., "192.168.1.0/24") or a specific IP address * @returns true if the IP address matches the subnet or IP, false otherwise * @example Check if the address is a IPv6 * * ```ts * import { matchIPv4Subnet } from "@std/net/unstable-ip" * import { assert, assertFalse } from "@std/assert" * * assert(matchIPv4Subnet("192.168.1.10", "192.168.1.0/24")); * assertFalse(matchIPv4Subnet("192.168.2.10", "192.168.1.0/24")); * ``` */ export declare function matchIPv4Subnet(addr: string, subnet: string): boolean; /** * Checks if an IPv6 address matches a subnet or specific IPv6 address. * * @experimental **UNSTABLE**: New API, yet to be vetted. * * @param addr The IP address to check (IPv6) * @param subnet The subnet in CIDR notation (e.g., "2001:db8::/64") or a specific IP address * @returns true if the IP address matches the subnet or IP, false otherwise * @example Check if the address is a IPv6 * * ```ts * import { matchIPv6Subnet } from "@std/net/unstable-ip" * import { assert, assertFalse } from "@std/assert" * * assert(matchIPv6Subnet("2001:db8::ffff", "2001:db8::/64")); * assertFalse(matchIPv6Subnet("2001:db9::1", "2001:db8::/64")); * ``` */ export declare function matchIPv6Subnet(addr: string, subnet: string): boolean; //# sourceMappingURL=unstable_ip.d.ts.map