@terascope/ip-utils / index
index
Functions
extractMappedIPv4()
extractMappedIPv4(
input):string
Defined in: index.ts:51
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
getCIDRBroadcast()
getCIDRBroadcast(
input):string
Defined in: index.ts:207
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
getCIDRMax()
getCIDRMax(
input):string
Defined in: index.ts:134
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:125
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:218
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
getFirstIPInCIDR()
getFirstIPInCIDR(
input):string
Defined in: index.ts:142
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:170
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:156
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:184
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:61
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:271
Parameters
| Parameter | Type |
|---|---|
input | unknown |
ipVersion | string | 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
| Parameter | Type |
|---|---|
ip1 | unknown |
ip2 | unknown |
Returns
string
ipToInt()
ipToInt(
input):bigint
Defined in: index.ts:263
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
bigint
isCIDR()
isCIDR(
input):input is string
Defined in: index.ts:116
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
input is string
isIP()
isIP(
input):input is string
Defined in: index.ts:12
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
input is string
isIPOrThrow()
isIPOrThrow(
input):string
Defined in: index.ts:28
Will throw if input is not a valid IP
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
isIPRangeOrThrow()
isIPRangeOrThrow(
input):string
Defined in: index.ts:17
Will throw if input is not a valid CIDR
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
isIPv4()
isIPv4(
input):boolean
Defined in: index.ts:42
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isIPv6()
isIPv6(
input):boolean
Defined in: index.ts:38
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isMappedIPv4()
isMappedIPv4(
input):boolean
Defined in: index.ts:46
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isNonRoutableIP()
isNonRoutableIP(
input):boolean
Defined in: index.ts:111
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
isNonZeroCidr()
isNonZeroCidr(
input):boolean
Defined in: index.ts:259
Parameters
| Parameter | Type |
|---|---|
input | string |
Returns
boolean
isRoutableIP()
isRoutableIP(
input):boolean
Defined in: index.ts:106
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
boolean
reverseIP()
reverseIP(
input):string
Defined in: index.ts:290
Parameters
| Parameter | Type |
|---|---|
input | unknown |
Returns
string
shortenIPv6Address()
shortenIPv6Address(
input):string
Defined in: index.ts:199
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:229
Parameters
| Parameter | Type |
|---|---|
input | unknown |
suffix | string | 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