本文整理了Java中brooklyn.util.net.Networking.isPrivateSubnet()
方法的一些代码示例,展示了Networking.isPrivateSubnet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Networking.isPrivateSubnet()
方法的具体详情如下:
包路径:brooklyn.util.net.Networking
类名称:Networking
方法名:isPrivateSubnet
[英]As #isPrivateSubnet(InetAddress) but taking a string; sepcifically local-only address ARE treated as private. does not require the string to be resolvable, and things which aren't resolvable are treated as private unless they are known to be local-only
[中]作为#isPrivateSubnet(InetAddress),但使用字符串;特定的本地地址被视为私有地址。不要求字符串是可解析的,不可解析的内容将被视为私有内容,除非已知它们仅为本地内容
代码示例来源:origin: io.brooklyn/brooklyn-utils-common
/** As {@link #isPrivateSubnet(InetAddress)} but taking a string; sepcifically local-only address ARE treated as private.
* does not require the string to be resolvable, and things which aren't resolvable are treated as private
* unless they are known to be local-only */
public static boolean isPrivateSubnet(String hostnameOrIp) {
Preconditions.checkNotNull(hostnameOrIp, "hostnameOrIp");
try {
InetAddress ia = getInetAddressWithFixedName(hostnameOrIp);
return isPrivateSubnet(ia);
} catch (Exception e) {
log.debug("Networking cannot resolve "+hostnameOrIp+": assuming it IS a private address");
return true;
}
}
代码示例来源:origin: io.brooklyn/brooklyn-core
/** returns URL to get properties for the given address (assuming localhost if address is on a subnet) */
public String getLookupUrlFor(InetAddress address) {
if (Networking.isPrivateSubnet(address)) return getLookupUrlForLocalhost();
return getLookupUrlForPublicIp(address.getHostAddress());
}
代码示例来源:origin: io.brooklyn/brooklyn-core
/** returns URL to get properties for the given address (assuming localhost if address is on a subnet) */
public String getPropertiesLookupUrlFor(InetAddress address) {
if (Networking.isPrivateSubnet(address)) return getPropertiesLookupUrlForLocalhost();
return getPropertiesLookupUrlForPublicIp(address.getHostAddress());
}
代码示例来源:origin: io.brooklyn/brooklyn-core
if (Networking.isPrivateSubnet(extAddress)) extAddress = InetAddress.getByName(UtraceHostGeoLookup.getLocalhostExternalIp());
代码示例来源:origin: io.brooklyn/brooklyn-software-webapp
if (Networking.isPrivateSubnet(addr)) {
if (getConfig(INCLUDE_HOMELESS_ENTITIES)) {
if (entitiesWithoutGeoInfo.add(entity)) {
内容来源于网络,如有侵权,请联系作者删除!