Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ipaddr.js.d.ts 2.8KB

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