类 IPUtil
java.lang.Object
com.alibaba.nacos.common.utils.IPUtil
ip tool.
- 作者:
- Nacos
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static StringCheck ips.static booleanCheck whether checkIPs result is "ok".static booleancontainsPort(String address)Check if the address contains a port. 2020/9/3 14:53static StringgetIPFromString(String str)Resolve the IP from the string containing the IP address.static booleancheck whether the str is ip address (IPv4 or IPv6).static booleancheck whether the ip address is IPv4.static booleancheck whether the ip address is IPv6.static Stringget localhost ip.static String[]splitIPPortStr(String str)Split IP and port strings, support IPv4 and IPv6, IP in IPv6 must be enclosed with [].
-
字段详细资料
-
PREFER_IPV6_ADDRESSES
public static final boolean PREFER_IPV6_ADDRESSES -
IPV6_START_MARK
- 另请参阅:
- 常量字段值
-
IPV6_END_MARK
- 另请参阅:
- 常量字段值
-
ILLEGAL_IP_PREFIX
- 另请参阅:
- 常量字段值
-
IP_PORT_SPLITER
- 另请参阅:
- 常量字段值
-
SPLIT_IP_PORT_RESULT_LENGTH
public static final int SPLIT_IP_PORT_RESULT_LENGTH- 另请参阅:
- 常量字段值
-
PERCENT_SIGN_IN_IPV6
- 另请参阅:
- 常量字段值
-
-
构造器详细资料
-
IPUtil
public IPUtil()
-
-
方法详细资料
-
localHostIP
get localhost ip.- 返回:
- java.lang.String
-
isIPv4
check whether the ip address is IPv4.- 参数:
addr- ip address- 返回:
- boolean
-
isIPv6
check whether the ip address is IPv6.- 参数:
addr- ip address- 返回:
- boolean
-
isIP
check whether the str is ip address (IPv4 or IPv6).- 参数:
addr- ip address str- 返回:
- boolean
-
containsPort
Check if the address contains a port. 2020/9/3 14:53- 参数:
address- address string- 返回:
- boolean
-
splitIPPortStr
Split IP and port strings, support IPv4 and IPv6, IP in IPv6 must be enclosed with [].- 参数:
str- ip and port string- 返回:
- java.lang.String[]
-
getIPFromString
Resolve the IP from the string containing the IP address.- 参数:
str- string containing IP address- 返回:
- java.lang.String
-
checkIPs
Check ips.- 参数:
ips- ips- 返回:
- 'ok' if check passed, otherwise illegal ip
-
checkOK
Check whether checkIPs result is "ok".- 参数:
checkIPsResult- checkIPs result- 返回:
- boolean
-