Skip to main content

@terascope/ip-utils / index

index

Functions​

extractMappedIPv4()​

extractMappedIPv4(input): string

Defined in: index.ts:51

Parameters​

ParameterType
inputunknown

Returns​

string


getCIDRBroadcast()​

getCIDRBroadcast(input): string

Defined in: index.ts:207

Parameters​

ParameterType
inputunknown

Returns​

string


getCIDRMax()​

getCIDRMax(input): string

Defined in: index.ts:134

Parameters​

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns​

string

last ip address in the block

Deprecated​

use getLastUsableIPInCIDR


getCIDRMin()​

getCIDRMin(input): string

Defined in: index.ts:125

Parameters​

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns​

string

first IP address in the block

Deprecated​

use getFirstUsableIPInCIDR


getCIDRNetwork()​

getCIDRNetwork(input): string

Defined in: index.ts:218

Parameters​

ParameterType
inputunknown

Returns​

string


getFirstIPInCIDR()​

getFirstIPInCIDR(input): string

Defined in: index.ts:142

Parameters​

ParameterTypeDescription
inputunknownip address block in CIDR notation, inclusive

Returns​

string

first IP address in the block


getFirstUsableIPInCIDR()​

getFirstUsableIPInCIDR(input): string

Defined in: index.ts:170

Parameters​

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns​

string

first usable ip address of the CIDR block


getLastIPInCIDR()​

getLastIPInCIDR(input): string

Defined in: index.ts:156

Parameters​

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns​

string

last ip address in the block, inclusive


getLastUsableIPInCIDR()​

getLastUsableIPInCIDR(input): string

Defined in: index.ts:184

Parameters​

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns​

string

last usable ip address of the CIDR block


inIPRange()​

inIPRange(input, args): boolean

Defined in: index.ts:61

Parameters​

ParameterType
inputunknown
args{ cidr?: string; max?: string; min?: string; }
args.cidr?string
args.max?string
args.min?string

Returns​

boolean


intToIP()​

intToIP(input, ipVersion): string

Defined in: index.ts:271

Parameters​

ParameterType
inputunknown
ipVersionstring | number

Returns​

string


ipsToCIDR()​

ipsToCIDR(ip1, ip2): string

Defined in: index.ts:300

Returns the smallest CIDR block that encloses both IP addresses. Both IPs must be the same version (both IPv4 or both IPv6).

Parameters​

ParameterType
ip1unknown
ip2unknown

Returns​

string


ipToInt()​

ipToInt(input): bigint

Defined in: index.ts:263

Parameters​

ParameterType
inputunknown

Returns​

bigint


isCIDR()​

isCIDR(input): input is string

Defined in: index.ts:116

Parameters​

ParameterType
inputunknown

Returns​

input is string


isIP()​

isIP(input): input is string

Defined in: index.ts:12

Parameters​

ParameterType
inputunknown

Returns​

input is string


isIPOrThrow()​

isIPOrThrow(input): string

Defined in: index.ts:28

Will throw if input is not a valid IP

Parameters​

ParameterType
inputunknown

Returns​

string


isIPRangeOrThrow()​

isIPRangeOrThrow(input): string

Defined in: index.ts:17

Will throw if input is not a valid CIDR

Parameters​

ParameterType
inputunknown

Returns​

string


isIPv4()​

isIPv4(input): boolean

Defined in: index.ts:42

Parameters​

ParameterType
inputunknown

Returns​

boolean


isIPv6()​

isIPv6(input): boolean

Defined in: index.ts:38

Parameters​

ParameterType
inputunknown

Returns​

boolean


isMappedIPv4()​

isMappedIPv4(input): boolean

Defined in: index.ts:46

Parameters​

ParameterType
inputunknown

Returns​

boolean


isNonRoutableIP()​

isNonRoutableIP(input): boolean

Defined in: index.ts:111

Parameters​

ParameterType
inputunknown

Returns​

boolean


isNonZeroCidr()​

isNonZeroCidr(input): boolean

Defined in: index.ts:259

Parameters​

ParameterType
inputstring

Returns​

boolean


isRoutableIP()​

isRoutableIP(input): boolean

Defined in: index.ts:106

Parameters​

ParameterType
inputunknown

Returns​

boolean


reverseIP()​

reverseIP(input): string

Defined in: index.ts:290

Parameters​

ParameterType
inputunknown

Returns​

string


shortenIPv6Address()​

shortenIPv6Address(input): string

Defined in: index.ts:199

Parameters​

ParameterTypeDescription
inputunknownip address

Returns​

string

IPv6 addresses are returned without leading 0's in a group or empty groups; ipv4 addresses are simply returned


toCIDR()​

toCIDR(input, suffix): string

Defined in: index.ts:229

Parameters​

ParameterType
inputunknown
suffixstring | number

Returns​

string

References​

CIDRBlock​

Re-exports CIDRBlock


IPAddress​

Re-exports IPAddress


IPRange​

Re-exports IPRange


NON_ROUTABLE_IPV4_CIDRS​

Re-exports NON_ROUTABLE_IPV4_CIDRS


NON_ROUTABLE_IPV6_CIDRS​

Re-exports NON_ROUTABLE_IPV6_CIDRS