Esempio n. 1
0
 public Peer dropHostName() {
   FreenetInetAddress newAddr = addr.dropHostname();
   if (newAddr == null) return null;
   if (addr != newAddr) {
     return new Peer(newAddr, _port);
   } else return this;
 }
Esempio n. 2
0
 public InetAddress getAddress(boolean doDNSRequest, boolean allowLocal)
     throws LocalAddressException {
   InetAddress a = addr.getAddress(doDNSRequest);
   if (a == null) return null;
   if (allowLocal || IPUtil.isValidAddress(a, false)) return a;
   throw new LocalAddressException();
 }
Esempio n. 3
0
  // FIXME same issues as with FreenetInetAddress.laxEquals/equals/strictEquals
  public boolean laxEquals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof Peer)) {
      return false;
    }

    final Peer peer = (Peer) o;

    if (_port != peer._port) {
      return false;
    }
    if (!addr.laxEquals(peer.addr)) return false;
    return true;
  }
Esempio n. 4
0
 /** Get the address:port string, but prefer numeric IPs - don't return the name. */
 public String toStringPrefNumeric() {
   return addr.toStringPrefNumeric() + ':' + _port;
 }
Esempio n. 5
0
 public boolean isRealInternetAddress(
     boolean lookup, boolean defaultVal, boolean allowLocalAddresses) {
   return addr.isRealInternetAddress(lookup, defaultVal, allowLocalAddresses);
 }
Esempio n. 6
0
 @Override
 public void writeToDataOutputStream(DataOutputStream dos) throws IOException {
   addr.writeToDataOutputStream(dos);
   dos.writeInt(_port);
 }
Esempio n. 7
0
 @Override
 public String toString() {
   return addr.toString() + ':' + _port;
 }
Esempio n. 8
0
 @Override
 public int hashCode() {
   return addr.hashCode() + _port;
 }
Esempio n. 9
0
 /**
  * Get the IP address, looking up the hostname if the hostname is primary, even if it has been
  * looked up before. Typically called on a reconnect attempt, when the dyndns address may have
  * changed.
  */
 public InetAddress getHandshakeAddress() {
   return addr.getHandshakeAddress();
 }
Esempio n. 10
0
 /**
  * Get the IP address. Look it up if allowed to, but return the last value if it has ever been
  * looked up before; will not trigger a new lookup if it has been looked up before.
  */
 public InetAddress getAddress(boolean doDNSRequest) {
   return addr.getAddress(doDNSRequest);
 }