Skip to main content

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

Class: IPAddress

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

Properties

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

Methods

compare()

compare(other): -1 | 0 | 1

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

Parameters

ParameterType
otherIPAddress

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

ParameterType
nbigint

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

static fromInt(n, version): IPAddress

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

Parameters

ParameterType
nbigint
version4 | 6

Returns

IPAddress


ipVersion()

static ipVersion(input): 4 | 6 | undefined

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

Parameters

ParameterType
inputstring

Returns

4 | 6 | undefined


isIPv4()

static isIPv4(input): boolean

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

Parameters

ParameterType
inputunknown

Returns

boolean


isIPv6()

static isIPv6(input): boolean

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

Parameters

ParameterType
inputunknown

Returns

boolean


isValid()

static isValid(input): input is string

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

Parameters

ParameterType
inputunknown

Returns

input is string


of()

static of(input): IPAddress

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

Parameters

ParameterType
inputstring

Returns

IPAddress