declare class Cidr { /** * Allocate a Cidr from a string * @param {string} - IP address string (must be trimed) * @returns {string} - A new CidiEntity object */ static from(ipstr: string): Cidr; /** * Match a CIDR address to another CIDR * @param {IpCheck | string} matcher - The CIDR address to match. * @param {IpCheck | string} matchee - The CIDR address as the matching target. * @returns {boolean} - True if 'matcher' is the host or subnet of 'matchee', otherwise false. */ static isMatched(matcher: Cidr | string, matchee: Cidr | string): boolean; private readonly _ipVersion; private readonly valid; private readonly mask; private readonly address; private readonly ipString; /** * Cidr class, use to define an entity that repsents a CIDR (IP Classless Inter-Domain Routing) address * (supporting IPv4 & IPv6). A host IP address is treated as a CIDR address too. * For example, `10.10.10.10` is equivalent to `10.10.10.10/32`. * @constructor * @param {string} ipstr - IP address string (must be trimed) */ constructor(ipstr: string); /** * Match IP(v4/v6) address with IP CIDR * @param {Cidr | string} cidr - The CIDR used to match this object * @returns {boolean} - The matched/mis-matched indicator */ isMatched(cidr: Cidr | string): boolean; /** * Get IP version * @returns {number} - 0 for invalid address, 4 for IPv4 and 6 for IPv6 */ ipVersion(): number; /** * Check if the object is valid, Cidr never throw errors, use this function to validate. * @returns {boolean} - false for constructed with invalid IP address or netmask, otherwise yes. */ isValid(): boolean; /** * Get netmask length * @returns {number} - CIDR length (treat an IPv4 address as an IPv4-compatible IPv6 address) */ netmask(): number; /** * Get original IP string * @returns {string} - Original IP string */ toString(): string; private parseIpV4; private parseIpV6; } export { Cidr };