Skip to main content

@terascope/ip-utils / utils/ip-address / IPAddress

Class: IPAddress

Defined in: utils/ip-address.ts:226

Properties​

PropertyModifierTypeDefined in
versionreadonly4 | 6utils/ip-address.ts:227

Methods​

compare()​

compare(other): -1 | 0 | 1

Defined in: utils/ip-address.ts:334

Parameters​

ParameterType
otherIPAddress

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​

ParameterType
nbigint

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()​

static fromInt(n, version): IPAddress

Defined in: utils/ip-address.ts:257

Parameters​

ParameterType
nbigint
version4 | 6

Returns​

IPAddress


ipVersion()​

static ipVersion(input): 4 | 6 | undefined

Defined in: utils/ip-address.ts:298

Parameters​

ParameterType
inputstring

Returns​

4 | 6 | undefined


isIPv4()​

static isIPv4(input): boolean

Defined in: utils/ip-address.ts:286

Parameters​

ParameterType
inputunknown

Returns​

boolean


isIPv6()​

static isIPv6(input): boolean

Defined in: utils/ip-address.ts:291

Parameters​

ParameterType
inputunknown

Returns​

boolean


isValid()​

static isValid(input): input is string

Defined in: utils/ip-address.ts:282

Parameters​

ParameterType
inputunknown

Returns​

input is string


of()​

static of(input): IPAddress

Defined in: utils/ip-address.ts:247

Parameters​

ParameterType
inputstring

Returns​

IPAddress