@terascope/ip-utils / utils/ip-address / IPAddress
Class: IPAddress
Defined in: utils/ip-address.ts:226
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
version | readonly | 4 | 6 | utils/ip-address.ts:227 |
Methods
compare()
compare(
other):-1|0|1
Defined in: utils/ip-address.ts:334
Parameters
| Parameter | Type |
|---|---|
other | IPAddress |
Returns
-1 | 0 | 1
isMappedIPv4()
isMappedIPv4():
boolean
Defined in: utils/ip-address.ts:350
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:373
Returns
boolean
offset()
offset(
n):IPAddress
Defined in: utils/ip-address.ts:341
Parameters
| Parameter | Type |
|---|---|
n | bigint |
Returns
IPAddress
reverse()
reverse():
string
Defined in: utils/ip-address.ts:386
Returns DNS PTR reverse format.
Returns
string
toInt()
toInt():
bigint
Defined in: utils/ip-address.ts:307
Returns
bigint
toMappedIPv4()
toMappedIPv4():
IPAddress
Defined in: utils/ip-address.ts:363
Extract the embedded IPv4 from an IPv4-mapped IPv6 address.
Returns
IPAddress
toNormalizedString()
toNormalizedString():
string
Defined in: utils/ip-address.ts:322
Normalized full-groups string (no :: compression). Used by reverseIP.
Returns
string
toString()
toString():
string
Defined in: utils/ip-address.ts:311
Returns
string
fromInt()
staticfromInt(n,version):IPAddress
Defined in: utils/ip-address.ts:257
Parameters
| Parameter | Type |
|---|---|
n | bigint |
version | 4 | 6 |
Returns
IPAddress
ipVersion()
staticipVersion(input):4|6|undefined
Defined in: utils/ip-address.ts:298
Parameters
| Parameter | Type |
|---|---|
input | string |
Returns
4 | 6 | undefined
isIPv4()
staticisIPv4(input):boolean
Defined in: utils/ip-address.ts:286
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isIPv6()
staticisIPv6(input):boolean
Defined in: utils/ip-address.ts:291
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isValid()
staticisValid(input):input is string
Defined in: utils/ip-address.ts:282
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
input is string
of()
staticof(input):IPAddress
Defined in: utils/ip-address.ts:247
Parameters
| Parameter | Type |
|---|---|
input | string |
Returns
IPAddress