1 | import * as common from './common';
|
2 | import { BigInteger } from 'jsbn';
|
3 | /**
|
4 | * Represents an IPv4 address
|
5 | * @class Address4
|
6 | * @param {string} address - An IPv4 address string
|
7 | */
|
8 | export declare class Address4 {
|
9 | address: string;
|
10 | addressMinusSuffix?: string;
|
11 | groups: number;
|
12 | parsedAddress: string[];
|
13 | parsedSubnet: string;
|
14 | subnet: string;
|
15 | subnetMask: number;
|
16 | v4: boolean;
|
17 | constructor(address: string);
|
18 | static isValid(address: string): boolean;
|
19 | parse(address: string): string[];
|
20 | /**
|
21 | * Returns the correct form of an address
|
22 | * @memberof Address4
|
23 | * @instance
|
24 | * @returns {String}
|
25 | */
|
26 | correctForm(): string;
|
27 | /**
|
28 | * Returns true if the address is correct, false otherwise
|
29 | * @memberof Address4
|
30 | * @instance
|
31 | * @returns {Boolean}
|
32 | */
|
33 | isCorrect: (this: import("./ipv6").Address6 | Address4) => boolean;
|
34 | /**
|
35 | * Converts a hex string to an IPv4 address object
|
36 | * @memberof Address4
|
37 | * @static
|
38 | * @param {string} hex - a hex string to convert
|
39 | * @returns {Address4}
|
40 | */
|
41 | static fromHex(hex: string): Address4;
|
42 | /**
|
43 | * Converts an integer into a IPv4 address object
|
44 | * @memberof Address4
|
45 | * @static
|
46 | * @param {integer} integer - a number to convert
|
47 | * @returns {Address4}
|
48 | */
|
49 | static fromInteger(integer: number): Address4;
|
50 | /**
|
51 | * Return an address from in-addr.arpa form
|
52 | * @memberof Address4
|
53 | * @static
|
54 | * @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address
|
55 | * @returns {Adress4}
|
56 | * @example
|
57 | * var address = Address4.fromArpa(42.2.0.192.in-addr.arpa.)
|
58 | * address.correctForm(); // '192.0.2.42'
|
59 | */
|
60 | static fromArpa(arpaFormAddress: string): Address4;
|
61 | /**
|
62 | * Converts an IPv4 address object to a hex string
|
63 | * @memberof Address4
|
64 | * @instance
|
65 | * @returns {String}
|
66 | */
|
67 | toHex(): string;
|
68 | /**
|
69 | * Converts an IPv4 address object to an array of bytes
|
70 | * @memberof Address4
|
71 | * @instance
|
72 | * @returns {Array}
|
73 | */
|
74 | toArray(): number[];
|
75 | /**
|
76 | * Converts an IPv4 address object to an IPv6 address group
|
77 | * @memberof Address4
|
78 | * @instance
|
79 | * @returns {String}
|
80 | */
|
81 | toGroup6(): string;
|
82 | /**
|
83 | * Returns the address as a BigInteger
|
84 | * @memberof Address4
|
85 | * @instance
|
86 | * @returns {BigInteger}
|
87 | */
|
88 | bigInteger(): BigInteger;
|
89 | /**
|
90 | * Helper function getting start address.
|
91 | * @memberof Address4
|
92 | * @instance
|
93 | * @returns {BigInteger}
|
94 | */
|
95 | _startAddress(): BigInteger;
|
96 | /**
|
97 | * The first address in the range given by this address' subnet.
|
98 | * Often referred to as the Network Address.
|
99 | * @memberof Address4
|
100 | * @instance
|
101 | * @returns {Address4}
|
102 | */
|
103 | startAddress(): Address4;
|
104 | /**
|
105 | * The first host address in the range given by this address's subnet ie
|
106 | * the first address after the Network Address
|
107 | * @memberof Address4
|
108 | * @instance
|
109 | * @returns {Address4}
|
110 | */
|
111 | startAddressExclusive(): Address4;
|
112 | /**
|
113 | * Helper function getting end address.
|
114 | * @memberof Address4
|
115 | * @instance
|
116 | * @returns {BigInteger}
|
117 | */
|
118 | _endAddress(): BigInteger;
|
119 | /**
|
120 | * The last address in the range given by this address' subnet
|
121 | * Often referred to as the Broadcast
|
122 | * @memberof Address4
|
123 | * @instance
|
124 | * @returns {Address4}
|
125 | */
|
126 | endAddress(): Address4;
|
127 | /**
|
128 | * The last host address in the range given by this address's subnet ie
|
129 | * the last address prior to the Broadcast Address
|
130 | * @memberof Address4
|
131 | * @instance
|
132 | * @returns {Address4}
|
133 | */
|
134 | endAddressExclusive(): Address4;
|
135 | /**
|
136 | * Converts a BigInteger to a v4 address object
|
137 | * @memberof Address4
|
138 | * @static
|
139 | * @param {BigInteger} bigInteger - a BigInteger to convert
|
140 | * @returns {Address4}
|
141 | */
|
142 | static fromBigInteger(bigInteger: BigInteger): Address4;
|
143 | /**
|
144 | * Returns the first n bits of the address, defaulting to the
|
145 | * subnet mask
|
146 | * @memberof Address4
|
147 | * @instance
|
148 | * @returns {String}
|
149 | */
|
150 | mask(mask?: number): string;
|
151 | /**
|
152 | * Returns the bits in the given range as a base-2 string
|
153 | * @memberof Address4
|
154 | * @instance
|
155 | * @returns {string}
|
156 | */
|
157 | getBitsBase2(start: number, end: number): string;
|
158 | /**
|
159 | * Return the reversed ip6.arpa form of the address
|
160 | * @memberof Address4
|
161 | * @param {Object} options
|
162 | * @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
|
163 | * @instance
|
164 | * @returns {String}
|
165 | */
|
166 | reverseForm(options?: common.ReverseFormOptions): string;
|
167 | /**
|
168 | * Returns true if the given address is in the subnet of the current address
|
169 | * @memberof Address4
|
170 | * @instance
|
171 | * @returns {boolean}
|
172 | */
|
173 | isInSubnet: typeof common.isInSubnet;
|
174 | /**
|
175 | * Returns true if the given address is a multicast address
|
176 | * @memberof Address4
|
177 | * @instance
|
178 | * @returns {boolean}
|
179 | */
|
180 | isMulticast(): boolean;
|
181 | /**
|
182 | * Returns a zero-padded base-2 string representation of the address
|
183 | * @memberof Address4
|
184 | * @instance
|
185 | * @returns {string}
|
186 | */
|
187 | binaryZeroPad(): string;
|
188 | /**
|
189 | * Groups an IPv4 address for inclusion at the end of an IPv6 address
|
190 | * @returns {String}
|
191 | */
|
192 | groupForV6(): string;
|
193 | }
|