@terascope/ip-utils / index
index
Functions
extractMappedIPv4()
extractMappedIPv4(
input):string
Defined in: index.ts:50
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
getCIDRBroadcast()
getCIDRBroadcast(
input):string
Defined in: index.ts:206
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
getCIDRMax()
getCIDRMax(
input):string
Defined in: index.ts:133
Parameters
| Parameter | Type | Description |
|---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
last ip address in the block
Deprecated
use getLastUsableIPInCIDR
getCIDRMin()
getCIDRMin(
input):string
Defined in: index.ts:124
Parameters
| Parameter | Type | Description |
|---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
first IP address in the block
Deprecated
use getFirstUsableIPInCIDR
getCIDRNetwork()
getCIDRNetwork(
input):string
Defined in: index.ts:217
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
getFirstIPInCIDR()
getFirstIPInCIDR(
input):string
Defined in: index.ts:141
Parameters
| Parameter | Type | Description |
|---|---|---|
input | unknown | ip address block in CIDR notation, inclusive |
Returns
string
first IP address in the block
getFirstUsableIPInCIDR()
getFirstUsableIPInCIDR(
input):string
Defined in: index.ts:169
Parameters
| Parameter | Type | Description |
|---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
first usable ip address of the CIDR block
getLastIPInCIDR()
getLastIPInCIDR(
input):string
Defined in: index.ts:155
Parameters
| Parameter | Type | Description |
|---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
last ip address in the block, inclusive
getLastUsableIPInCIDR()
getLastUsableIPInCIDR(
input):string
Defined in: index.ts:183
Parameters
| Parameter | Type | Description |
|---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
last usable ip address of the CIDR block
inIPRange()
inIPRange(
input,args):boolean
Defined in: index.ts:60
Parameters
| Parameter | Type |
|---|---|
input | unknown |
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:270
Parameters
| Parameter | Type |
|---|---|
input | unknown |
ipVersion | string | number |
Returns
string
ipsToCIDR()
ipsToCIDR(
ip1,ip2):string
Defined in: index.ts:299
Returns the smallest CIDR block that encloses both IP addresses. Both IPs must be the same version (both IPv4 or both IPv6).
Parameters
| Parameter | Type |
|---|---|
ip1 | unknown |
ip2 | unknown |
Returns
string
ipToInt()
ipToInt(
input):bigint
Defined in: index.ts:262
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
bigint
isCIDR()
isCIDR(
input):input is string
Defined in: index.ts:115
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
input is string
isIP()
isIP(
input):input is string
Defined in: index.ts:11
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
input is string
isIPOrThrow()
isIPOrThrow(
input):string
Defined in: index.ts:27
Will throw if input is not a valid IP
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
isIPRangeOrThrow()
isIPRangeOrThrow(
input):string
Defined in: index.ts:16
Will throw if input is not a valid CIDR
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
isIPv4()
isIPv4(
input):boolean
Defined in: index.ts:41
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isIPv6()
isIPv6(
input):boolean
Defined in: index.ts:37
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isMappedIPv4()
isMappedIPv4(
input):boolean
Defined in: index.ts:45
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isNonRoutableIP()
isNonRoutableIP(
input):boolean
Defined in: index.ts:110
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isNonZeroCidr()
isNonZeroCidr(
input):boolean
Defined in: index.ts:258
Parameters
| Parameter | Type |
|---|---|
input | string |
Returns
boolean
isRoutableIP()
isRoutableIP(
input):boolean
Defined in: index.ts:105
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
reverseIP()
reverseIP(
input):string
Defined in: index.ts:289
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
shortenIPv6Address()
shortenIPv6Address(
input):string
Defined in: index.ts:198
Parameters
| Parameter | Type | Description |
|---|---|---|
input | unknown | ip 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:228
Parameters
| Parameter | Type |
|---|---|
input | unknown |
suffix | string | number |
Returns
string
References
CIDRBlock
Re-exports CIDRBlock
IPAddress
Re-exports IPAddress
IPRange
Re-exports IPRange