Utils: `ip`
Table of contents
Functions
- extractMappedIPv4
- getCIDRBroadcast
- getCIDRMax
- getCIDRMin
- getCIDRNetwork
- getFirstIPInCIDR
- getFirstUsableIPInCIDR
- getLastIPInCIDR
- getLastUsableIPInCIDR
- inIPRange
- intToIP
- ipToInt
- isCIDR
- isIP
- isIPOrThrow
- isIPRangeOrThrow
- isIPv4
- isIPv6
- isMappedIPv4
- isNonRoutableIP
- isNonZeroCidr
- isRoutableIP
- reverseIP
- shortenIPv6Address
- toCIDR
Functions
extractMappedIPv4
▸ extractMappedIPv4(input
): string
Parameters
Name | Type |
---|---|
input | unknown |
Returns
string
Defined in
getCIDRBroadcast
▸ getCIDRBroadcast(input
): string
Parameters
Name | Type |
---|---|
input | unknown |
Returns
string
Defined in
getCIDRMax
▸ getCIDRMax(input
): string
Parameters
Name | Type | Description |
---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
last ip address in the block
Deprecated
use getLastUsableIPInCIDR
Defined in
getCIDRMin
▸ getCIDRMin(input
): string
Parameters
Name | Type | Description |
---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
first IP address in the block
Deprecated
use getFirstUsableIPInCIDR
Defined in
getCIDRNetwork
▸ getCIDRNetwork(input
): string
Parameters
Name | Type |
---|---|
input | unknown |
Returns
string
Defined in
getFirstIPInCIDR
▸ getFirstIPInCIDR(input
): string
Parameters
Name | Type | Description |
---|---|---|
input | unknown | ip address block in CIDR notation, inclusive |
Returns
string
first IP address in the block
Defined in
getFirstUsableIPInCIDR
▸ getFirstUsableIPInCIDR(input
): string
Parameters
Name | Type | Description |
---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
first usable ip address of the CIDR block
Defined in
getLastIPInCIDR
▸ getLastIPInCIDR(input
): string
Parameters
Name | Type | Description |
---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
last ip address in the block, inclusive
Defined in
getLastUsableIPInCIDR
▸ getLastUsableIPInCIDR(input
): string
Parameters
Name | Type | Description |
---|---|---|
input | unknown | ip address block in CIDR notation |
Returns
string
last usable ip address of the CIDR block
Defined in
inIPRange
▸ inIPRange(input
, args
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
args | Object |
args.cidr? | string |
args.max? | string |
args.min? | string |
Returns
boolean
Defined in
intToIP
▸ intToIP(input
, ipVersion
): string
Parameters
Name | Type | |
---|---|---|
input | unknown | |
ipVersion | string \ | number |
Returns
string
Defined in
ipToInt
▸ ipToInt(input
): bigint
Parameters
Name | Type |
---|---|
input | unknown |
Returns
bigint
Defined in
isCIDR
▸ isCIDR(input
): input is string
Parameters
Name | Type |
---|---|
input | unknown |
Returns
input is string
Defined in
isIP
▸ isIP(input
): input is string
Parameters
Name | Type |
---|---|
input | unknown |
Returns
input is string
Defined in
isIPOrThrow
▸ isIPOrThrow(input
): string
Will throw if input is not a valid IP
Parameters
Name | Type |
---|---|
input | unknown |
Returns
string
Defined in
isIPRangeOrThrow
▸ isIPRangeOrThrow(input
): string
Will throw if input is not a valid CIDR
Parameters
Name | Type |
---|---|
input | unknown |
Returns
string
Defined in
isIPv4
▸ isIPv4(input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
isIPv6
▸ isIPv6(input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
isMappedIPv4
▸ isMappedIPv4(input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
isNonRoutableIP
▸ isNonRoutableIP(input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
isNonZeroCidr
▸ isNonZeroCidr(input
): boolean
Parameters
Name | Type |
---|---|
input | string |
Returns
boolean
Defined in
isRoutableIP
▸ isRoutableIP(input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
reverseIP
▸ reverseIP(input
): string
Parameters
Name | Type |
---|---|
input | unknown |
Returns
string
Defined in
shortenIPv6Address
▸ shortenIPv6Address(input
): string
Parameters
Name | 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
Defined in
toCIDR
▸ toCIDR(input
, suffix
): string
Parameters
Name | Type | |
---|---|---|
input | unknown | |
suffix | string \ | number |
Returns
string