@terascope/ip-utils / utils/ip-address / IPAddress
Class: IPAddress
Defined in: utils/ip-address.ts:235
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
version | readonly | 4 | 6 | utils/ip-address.ts:236 |
Methods
compare()
compare(
other):-1|0|1
Defined in: utils/ip-address.ts:343
Parameters
| Parameter | Type |
|---|---|
other | IPAddress |
Returns
-1 | 0 | 1
isMappedIPv4()
isMappedIPv4():
boolean
Defined in: utils/ip-address.ts:359
Returns true for ::ffff:a.b.c.d (IPv4-mapped) addresses. Note: ::a.b.c.d is rewritten to ::ffff:a.b.c.d during parsing, so those also return true (matching ipaddr.js behaviour).
Returns
boolean
isRoutable()
isRoutable():
boolean
Defined in: utils/ip-address.ts:382
Returns
boolean
offset()
offset(
n):IPAddress
Defined in: utils/ip-address.ts:350
Parameters
| Parameter | Type |
|---|---|
n | bigint |
Returns
IPAddress
reverse()
reverse():
string
Defined in: utils/ip-address.ts:395
Returns DNS PTR reverse format.
Returns
string
toInt()
toInt():
bigint
Defined in: utils/ip-address.ts:316
Returns
bigint
toMappedIPv4()
toMappedIPv4():
IPAddress
Defined in: utils/ip-address.ts:372
Extract the embedded IPv4 from an IPv4-mapped IPv6 address.
Returns
IPAddress
toNormalizedString()
toNormalizedString():
string
Defined in: utils/ip-address.ts:331
Normalized full-groups string (no :: compression). Used by reverseIP.
Returns
string
toString()
toString():
string
Defined in: utils/ip-address.ts:320
Returns
string
fromInt()
staticfromInt(n,version):IPAddress
Defined in: utils/ip-address.ts:266
Parameters
| Parameter | Type |
|---|---|
n | bigint |
version | 4 | 6 |
Returns
IPAddress
ipVersion()
staticipVersion(input):4|6|undefined
Defined in: utils/ip-address.ts:307
Parameters
| Parameter | Type |
|---|---|
input | string |
Returns
4 | 6 | undefined
isIPv4()
staticisIPv4(input):boolean
Defined in: utils/ip-address.ts:295
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isIPv6()
staticisIPv6(input):boolean
Defined in: utils/ip-address.ts:300
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isValid()
staticisValid(input):input is string
Defined in: utils/ip-address.ts:291
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
input is string
of()
staticof(input):IPAddress
Defined in: utils/ip-address.ts:256
Parameters
| Parameter | Type |
|---|---|
input | string |
Returns
IPAddress