twitst4tz

twitter statistics web application
Log | Files | Refs | README | LICENSE

ipaddr.js.d.ts (2959B)


      1 declare module "ipaddr.js" {
      2     type IPv4Range = 'unicast' | 'unspecified' | 'broadcast' | 'multicast' | 'linkLocal' | 'loopback' | 'carrierGradeNat' | 'private' | 'reserved';
      3     type IPv6Range = 'unicast' | 'unspecified' | 'linkLocal' | 'multicast' | 'loopback' | 'uniqueLocal' | 'ipv4Mapped' | 'rfc6145' | 'rfc6052' | '6to4' | 'teredo' | 'reserved';
      4 
      5     interface RangeList<T> {
      6         [name: string]: [T, number] | [T, number][];
      7     }
      8 
      9     // Common methods/properties for IPv4 and IPv6 classes.
     10     class IP {
     11         prefixLengthFromSubnetMask(): number | null;
     12         toByteArray(): number[];
     13         toNormalizedString(): string;
     14         toString(): string;
     15     }
     16 
     17     namespace Address {
     18         export function isValid(addr: string): boolean;
     19         export function fromByteArray(bytes: number[]): IPv4 | IPv6;
     20         export function parse(addr: string): IPv4 | IPv6;
     21         export function parseCIDR(mask: string): [IPv4 | IPv6, number];
     22         export function process(addr: string): IPv4 | IPv6;
     23         export function subnetMatch(addr: IPv4, rangeList: RangeList<IPv4>, defaultName?: string): string;
     24         export function subnetMatch(addr: IPv6, rangeList: RangeList<IPv6>, defaultName?: string): string;
     25 
     26         export class IPv4 extends IP {
     27             static broadcastAddressFromCIDR(addr: string): IPv4;
     28             static isIPv4(addr: string): boolean;
     29             static isValidFourPartDecimal(addr: string): boolean;
     30             static isValid(addr: string): boolean;
     31             static networkAddressFromCIDR(addr: string): IPv4;
     32             static parse(addr: string): IPv4;
     33             static parseCIDR(addr: string): [IPv4, number];
     34             static subnetMaskFromPrefixLength(prefix: number): IPv4;
     35             constructor(octets: number[]);
     36             octets: number[]
     37 
     38             kind(): 'ipv4';
     39             match(addr: IPv4, bits: number): boolean;
     40             match(mask: [IPv4, number]): boolean;
     41             range(): IPv4Range;
     42             subnetMatch(rangeList: RangeList<IPv4>, defaultName?: string): string;
     43             toIPv4MappedAddress(): IPv6;
     44         }
     45 
     46         export class IPv6 extends IP {
     47             static broadcastAddressFromCIDR(addr: string): IPv6;
     48             static isIPv6(addr: string): boolean;
     49             static isValid(addr: string): boolean;
     50             static parse(addr: string): IPv6;
     51             static parseCIDR(addr: string): [IPv6, number];
     52             static subnetMaskFromPrefixLength(prefix: number): IPv6;
     53             constructor(parts: number[]);
     54             parts: number[]
     55             zoneId?: string
     56 
     57             isIPv4MappedAddress(): boolean;
     58             kind(): 'ipv6';
     59             match(addr: IPv6, bits: number): boolean;
     60             match(mask: [IPv6, number]): boolean;
     61             range(): IPv6Range;
     62             subnetMatch(rangeList: RangeList<IPv6>, defaultName?: string): string;
     63             toIPv4Address(): IPv4;
     64         }
     65     }
     66 
     67     export = Address;
     68 }