NetUtil

NetUtil

new NetUtil()

Source:
Author:
  • ycx
网络工具类

Methods

(static) getIPV4Address()

Source:
获取本机ipv4地址
Returns:

(static) getIPV6Address()

Source:
获取本机ipv6地址
Returns:

(static) getMultistageReverseProxyIp(ip) → {string}

Source:
从多级反向代理中获得第一个非unknown IP地址
Parameters:
Name Type Description
ip string 获得的IP地址
Returns:
第一个非unknown IP地址
Type
string

(static) isIp(ipStr) → {number}

Source:
是不是ip地址
Parameters:
Name Type Description
ipStr string
Returns:
Type
number

(static) isIpv4(ipStr) → {boolean}

Source:
是不是ipv4地址
Parameters:
Name Type Description
ipStr
Returns:
Type
boolean

(static) isIpv6(ipStr) → {boolean}

Source:
是不是ipv6地址
Parameters:
Name Type Description
ipStr
Returns:
Type
boolean

(static) isUnknown(checkString) → {boolean}

Source:
检测给定字符串是否为未知
Parameters:
Name Type Description
checkString string
Returns:
Type
boolean

(async, static) isUsableLocalPort(port) → {boolean}

Source:
检测本地端口是否可用
Parameters:
Name Type Description
port number 端口号
Returns:
Promise()
Type
boolean

(static) isValidPort(port) → {boolean}

Source:
判断是否有效端口 这里是0 -65535 注:有些端口是1024-65535
Parameters:
Name Type Description
port number 端口号
Returns:
是否有效
Type
boolean