private static String getStringIpAddress(final IpAddress ipAddress) { if (ipAddress.getIpv4Address() != null) { return ipAddress.getIpv4Address().getValue(); } return ipAddress.getIpv6Address().getValue(); }
private String getIpPrefixStr(final IpPrefix ipPrefix) { final Ipv4Prefix ipv4 = ipPrefix.getIpv4Prefix(); if (ipv4 != null) { return ipv4.getValue(); } else { return ipPrefix.getIpv6Prefix().getValue(); } }
private String stripToCidr(final IpPrefix value) { return value.getIpv4Prefix().getValue(); } }
private InetSocketAddress getSocketAddress(final Host host, int port) { if(host.getDomainName() != null) { return new InetSocketAddress(host.getDomainName().getValue(), port); } else { final IpAddress ipAddress = host.getIpAddress(); final String ip = ipAddress.getIpv4Address() != null ? ipAddress.getIpv4Address().getValue() : ipAddress.getIpv6Address().getValue(); return new InetSocketAddress(ip, port); } }
public static IpPrefix createDefaultPrefix(IpAddress ipAddress) { if (ipAddress.getIpv4Address() == null) { return null; } String ipv4 = ipAddress.getIpv4Address().getValue(); long mask = getDefaultMask(ipv4); return new IpPrefix(new Ipv4Prefix(String.format("%s/%d", ipv4, mask))); }
public static IpPrefix ipAddressToIpPrefix(IpAddress address) { if (address.getIpv4Address() != null) { return new IpPrefix(new Ipv4Prefix(ipv4PrefixOf(address))); } else if (address.getIpv6Address() != null) { return new IpPrefix(new Ipv6Prefix(ipv6PrefixOf(address))); } throw new IllegalArgumentException("Ip address [{}] is not a valid Ipv4 or Ipv6 address." + address); }
@Override protected Ipv6Address maybeIpv6Address(final IpAddress addr) { return addr.getIpv6Address(); } }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_localPort == null) ? 0 : _localPort.hashCode()); result = prime * result + ((_remoteAddress == null) ? 0 : _remoteAddress.hashCode()); result = prime * result + ((_remotePort == null) ? 0 : _remotePort.hashCode()); hash = result; hashValid = true; return result; }
public static String convertIpAddress(IpAddress ip) { String ret = null; if (ip != null) { if (ip.getIpv4Address() != null) { ret = ip.getIpv4Address().getValue(); } else if (ip.getIpv6Address() != null) { ret = ip.getIpv6Address().getValue(); } } return ret; }
/** * Get string representation of IpAddress * @param ipAddress * @return String value of Ipv4Address or Ipv6Address */ public static String toStringIP(final IpAddress ipAddress) { if (ipAddress.getIpv4Address() != null) { return ipAddress.getIpv4Address().getValue(); } return ipAddress.getIpv6Address().getValue(); } }
private static String getStringIpAddress(IpAddress ipAddress) { if (ipAddress.getIpv4Address() != null) { return ipAddress.getIpv4Address().getValue(); } return ipAddress.getIpv6Address().getValue(); }
public static String getStringIpAddress(IpAddress ipAddress) { if (ipAddress.getIpv4Address() != null) { return ipAddress.getIpv4Address().getValue(); } return ipAddress.getIpv6Address().getValue(); }
private static String createPeerName(final IpAddress ipAddress) { final String address = ipAddress.getIpv4Address() != null ? ipAddress.getIpv4Address().getValue() : ipAddress.getIpv6Address().getValue(); return PEER + address; }
private String getAddressString(final IpAddress addr) { return addr.getIpv4Address() == null ? addr.getIpv6Address().getValue() : addr.getIpv4Address().getValue(); }
private String getAddressString(final IpAddress addr) { return addr.getIpv4Address() == null ? addr.getIpv6Address().getValue() : addr.getIpv4Address().getValue(); }
private String getAddressString(final IpAddress addr) { return addr.getIpv4Address() == null ? addr.getIpv6Address().getValue() : addr.getIpv4Address().getValue(); }
private String getAddressString(final IpAddress address) { Preconditions.checkArgument(address.getIpv4Address() != null || address.getIpv6Address() != null, "Address %s is invalid", address); if (address.getIpv4Address() != null) { return address.getIpv4Address().getValue(); } return address.getIpv6Address().getValue(); }
private String getAddressString(final IpAddress address) { Preconditions.checkArgument(address.getIpv4Address() != null || address.getIpv6Address() != null, "Address %s is invalid", address); if (address.getIpv4Address() != null) { return address.getIpv4Address().getValue(); } return address.getIpv6Address().getValue(); }
private String touniqueIpAddress(IpAddress ipAddress) { Ipv4Address ipv4 = ipAddress.getIpv4Address(); if (ipv4 != null) { return ipv4.getValue(); } Ipv6Address ipv6 = ipAddress.getIpv6Address(); if (ipv6 != null) { return uniqueIpv6String(ipv6.getValue()); } return null; } private static String uniqueIpv6String(String ipv6) {
@XmlElement(name = "source-host") public String getSourceHost() { final IpAddress ipAddress = managementSession.getSourceHost().getIpAddress(); if (ipAddress.getIpv4Address() != null) { return ipAddress.getIpv4Address().getValue(); } else { return ipAddress.getIpv6Address().getValue(); } }