DNSRecord.Address getDNS4AddressRecord() { if ((getAddress() != null) && ((getAddress() instanceof Inet4Address) || ((getAddress() instanceof Inet6Address) && (((Inet6Address) getAddress()).isIPv4CompatibleAddress())))) { return new DNSRecord.Address(getName(), DNSConstants.TYPE_A, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, getAddress()); } return null; }
DNSRecord.Address getDNS6AddressRecord() { if ((getAddress() != null) && (getAddress() instanceof Inet6Address)) { return new DNSRecord.Address(getName(), DNSConstants.TYPE_AAAA, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, getAddress()); } return null; }
boolean shouldIgnorePacket(DatagramPacket packet) { boolean result = false; if (getAddress() != null) { InetAddress from = packet.getAddress(); if (from != null) { if (from.isLinkLocalAddress() && (!getAddress().isLinkLocalAddress())) { // Ignore linklocal packets on regular interfaces, unless this is // also a linklocal interface. This is to avoid duplicates. This is // a terrible hack caused by the lack of an API to get the address // of the interface on which the packet was received. result = true; } if (from.isLoopbackAddress() && (!getAddress().isLoopbackAddress())) { // Ignore loopback packets on a regular interface unless this is // also a loopback interface. result = true; } } } return result; }
public String toString() { StringBuffer buf = new StringBuffer(); buf.append("local host info["); buf.append(getName() != null ? getName() : "no name"); buf.append(", "); buf.append(getInterface() != null ? getInterface().getDisplayName() : "???"); buf.append(":"); buf.append(getAddress() != null ? getAddress().getHostAddress() : "no address"); buf.append("]"); return buf.toString(); }
info.addr = localHost.getAddress();