LimeWire Consolidated API

org.limewire.io
Interface NetworkInstanceUtils

All Known Implementing Classes:
SimpleNetworkInstanceUtils

public interface NetworkInstanceUtils

A collection of network-related utility methods which are specific to a running instance.


Method Summary
 boolean isMe(byte[] address, int port)
          If host is not a valid host address, returns false.
 boolean isMe(IpPort me)
          Returns true if the given IpPort is the local host
 boolean isMe(String host, int port)
          If host is not a valid host address, returns false.
 boolean isPrivate()
          Returns whether or not this node has a private address.
 boolean isPrivateAddress(byte[] address)
          Checks if the given address is a private address.
 boolean isPrivateAddress(InetAddress address)
          Utility method for determining whether or not the given address is private taking an InetAddress object as argument like the isLocalAddress(InetAddress) method.
 boolean isPrivateAddress(SocketAddress address)
          Utility method for determining whether or not the given address is private taking an InetAddress object as argument like the isLocalAddress(InetAddress) method.
 boolean isPrivateAddress(String address)
          Utility method for determining whether or not the given address is private.
 boolean isValidExternalIpPort(IpPort addr)
           
 boolean isVeryCloseIP(byte[] addr)
          Returns whether or not the given IP address shares the same first three octets as the address for this node -- the most common indication that they may be on the same network.
 boolean isVeryCloseIP(byte[] addr0, byte[] addr1)
          Returns whether or not the two IP addresses share the same first two octets in their address -- the most common indication that they may be on the same network.
 boolean isVeryCloseIP(InetAddress addr)
          Returns whether or not the given IP address shares the same first three octets as the address for this node -- the most common indication that they may be on the same network.
 

Method Detail

isMe

boolean isMe(String host,
             int port)
If host is not a valid host address, returns false. Otherwise, returns true if connecting to host:port would connect to this servent's listening port.

Returns:
true if the specified host/port combo is this servent, otherwise false.

isMe

boolean isMe(byte[] address,
             int port)
If host is not a valid host address, returns false. Otherwise, returns true if connecting to host:port would connect to this servent's listening port.

Returns:
true if the specified host/port combo is this servent, otherwise false.

isMe

boolean isMe(IpPort me)
Returns true if the given IpPort is the local host


isVeryCloseIP

boolean isVeryCloseIP(byte[] addr0,
                      byte[] addr1)
Returns whether or not the two IP addresses share the same first two octets in their address -- the most common indication that they may be on the same network. Private networks are NOT CONSIDERED CLOSE. This method is IPv6 compliant but returns always false if any of the two addresses in a true IPv6 address.

Parameters:
addr0 - the first address to compare
addr1 - the second address to compare

isVeryCloseIP

boolean isVeryCloseIP(InetAddress addr)
Returns whether or not the given IP address shares the same first three octets as the address for this node -- the most common indication that they may be on the same network.

Parameters:
addr - the address to compare

isVeryCloseIP

boolean isVeryCloseIP(byte[] addr)
Returns whether or not the given IP address shares the same first three octets as the address for this node -- the most common indication that they may be on the same network.

Parameters:
addr - the address to compare

isPrivate

boolean isPrivate()
Returns whether or not this node has a private address.

Returns:
true if this node has a private address, otherwise false

isPrivateAddress

boolean isPrivateAddress(InetAddress address)
Utility method for determining whether or not the given address is private taking an InetAddress object as argument like the isLocalAddress(InetAddress) method. This method is IPv6 compliant

Returns:
true if the specified address is private, otherwise false

isPrivateAddress

boolean isPrivateAddress(byte[] address)
Checks if the given address is a private address. This method is IPv6 compliant

Parameters:
address - the address to check

isPrivateAddress

boolean isPrivateAddress(String address)
Utility method for determining whether or not the given address is private. Delegates to isPrivateAddress(InetAddress). Returns true if the host is unknown.

Returns:
true if the specified address is private, otherwise false

isPrivateAddress

boolean isPrivateAddress(SocketAddress address)
Utility method for determining whether or not the given address is private taking an InetAddress object as argument like the isLocalAddress(InetAddress) method. Delegates to isPrivateAddress(byte[] address).

Returns:
true if the specified address is private, otherwise false

isValidExternalIpPort

boolean isValidExternalIpPort(IpPort addr)
Returns:
whether the IpPort is a valid external address.

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.