rice.pastry.socket
Class StubNATHandler
java.lang.Object
rice.pastry.socket.StubNATHandler
-
All Implemented Interfaces:
- NATHandler
-
Direct Known Subclasses:
- SocketNATHandler
-
public class StubNATHandler
- extends java.lang.Object
- implements NATHandler
Constructor Summary |
StubNATHandler(Environment env,
java.net.InetSocketAddress localAddress,
java.net.InetSocketAddress proxyAddress)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ALWAYS
public static final int ALWAYS
- See Also:
- Constant Field Values
PREFIX_MATCH
public static final int PREFIX_MATCH
- See Also:
- Constant Field Values
NEVER
public static final int NEVER
- See Also:
- Constant Field Values
OVERWRITE
public static final int OVERWRITE
- See Also:
- Constant Field Values
USE_DIFFERENT_PORT
public static final int USE_DIFFERENT_PORT
- See Also:
- Constant Field Values
FAIL
public static final int FAIL
- See Also:
- Constant Field Values
StubNATHandler
public StubNATHandler(Environment env,
java.net.InetSocketAddress localAddress,
java.net.InetSocketAddress proxyAddress)
verifyConnection
public static java.net.InetSocketAddress verifyConnection(int timeout,
java.net.InetSocketAddress local,
java.net.InetSocketAddress[] existing,
Environment env,
Logger logger)
throws java.io.IOException
- Method which can be used to test the connectivity contstrains of the local
node. This (optional) method is designed to be called by applications to
ensure that the local node is able to connect through the network - checks
can be done to check TCP/UDP connectivity, firewall setup, etc...
If the method works, then nothing should be done and the method should
return. If an error condition is detected, an exception should be thrown.
-
-
-
Throws:
java.io.IOException
randomSubset
protected java.net.InetSocketAddress[] randomSubset(java.net.InetSocketAddress[] array,
int num)
- Internal method which returns a random subset of the address to ping in parallel
-
-
- Parameters:
-
array
- The list of all hosts-
num
- The number of hosts to return
- Returns:
- A subset of the specified length
localAddressIsProbablyNatted
public boolean localAddressIsProbablyNatted()
-
-
- Returns:
- true if ip address matches firewall prefix
getFireWallPolicyVariable
protected int getFireWallPolicyVariable(java.lang.String key)
-
-
findExternalIPwithoutUPnP
public java.net.InetSocketAddress findExternalIPwithoutUPnP()
-
-
usingNAT
public boolean usingNAT()
-
- Specified by:
-
usingNAT
in interface NATHandler
-
externalAddress
public java.net.InetSocketAddress externalAddress()
throws java.io.IOException
-
- Specified by:
-
externalAddress
in interface NATHandler
-
-
Throws:
java.io.IOException
test
public boolean test()
-
- Specified by:
-
test
in interface NATHandler
-
Copyright © 2001-2005 - Rice Pastry.