brooklyn.util.net.Networking.isPrivateSubnet()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中brooklyn.util.net.Networking.isPrivateSubnet()方法的一些代码示例,展示了Networking.isPrivateSubnet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Networking.isPrivateSubnet()方法的具体详情如下:
包路径:brooklyn.util.net.Networking
类名称:Networking
方法名:isPrivateSubnet

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)) {

相关文章