Search…
Util.ip Module
Import
1
import { ip } from 'util';
Copied!

Methods

is_ipv4(ip)

Returns true if the argument is a valid IPv4 address.
Arguments
  • ip (String)
Returns
Boolean

is_cidr(cidr)

Returns true if the argument is a valid IPv4 address range.
Arguments
  • cidr (String)
Returns
Boolean

contains_ip(array, ip)

Returns true if the ip argument is a valid IPv4 address and contained array.
Arguments
  • array (String[]) An array of ip addresses or cidr ranges against which to match ip
  • ip (String)
Returns
Boolean

ip4toint(ip)

Converts an IPv4 string to an integer.
Arguments
  • ip (String)
Returns
Number

inttoip4(int)

Converts an integer to an IPv4 string.
Arguments
  • int (Number)
Returns
String

ip4incidr(ip, cidr)

Returns true if ip is contained in the cidr range.
Arguments
  • ip (String)
  • cidr (String)
Returns
Boolean
Last modified 2mo ago