|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.pastry.PastryNodeFactory rice.pastry.transport.TransportPastryNodeFactory rice.pastry.socket.SocketPastryNodeFactory rice.pastry.socket.nat.rendezvous.RendezvousSocketPastryNodeFactory rice.pastry.socket.internet.InternetPastryNodeFactory
public class InternetPastryNodeFactory
This Factory is designed for real deployments (with NATs). Optimized for the following use cases (in order) 1) Internet Routable, No firewall 2) Internet Routable, Firewall (not NAT) 3) NAT: User Configured Port Forwarding 4) NAT: UPnP 5) NAT: No port forwarding
Nested Class Summary |
---|
Nested classes/interfaces inherited from class rice.pastry.socket.SocketPastryNodeFactory |
---|
SocketPastryNodeFactory.TLBootstrapper, SocketPastryNodeFactory.TransLiveness<Identifier,MessageType>, SocketPastryNodeFactory.TransLivenessProximity<Identifier,MessageType> |
Field Summary | |
---|---|
static int |
ALWAYS
NAT policy variables |
static int |
BOOT
Don't check bootstrap nodes |
static int |
FAIL
|
static int |
NEVER
|
static int |
OVERWRITE
|
static int |
PREFIX_MATCH
|
static int |
RENDEZVOUS
|
static int |
USE_DIFFERENT_PORT
|
Fields inherited from class rice.pastry.socket.nat.rendezvous.RendezvousSocketPastryNodeFactory |
---|
CONTACT_STATE, random, RENDEZVOUS_CONTACT_DIRECT_STRATEGY, RENDEZVOUS_STRATEGY, RENDEZVOUS_TL, SIMULATE_FIREWALL |
Fields inherited from class rice.pastry.socket.SocketPastryNodeFactory |
---|
findFireWallPolicy, IP_SERVICE, localAddress, MULTI_ADDRESS_STRATEGY, MULTI_INET_TL, NETWORK_INFO_NODE_HANDLE_INDEX, nidFactory, NODE_HANDLE_FACTORY, PASTRY_MAGIC_NUMBER, PRIORITY_TL, PROXY_ADDRESS, testFireWallPolicy |
Fields inherited from class rice.pastry.transport.TransportPastryNodeFactory |
---|
leafSetMaintFreq, routeSetMaintFreq |
Fields inherited from class rice.pastry.PastryNodeFactory |
---|
environment, logger, lSetSize, rtBase, rtMax |
Constructor Summary | |
---|---|
InternetPastryNodeFactory(NodeIdFactory nf,
java.net.InetAddress bindAddress,
int startPort,
Environment env,
NATHandler handler,
java.util.Collection<java.net.InetSocketAddress> probeAddresses,
java.net.InetAddress[] externalAddresses)
May block for more than a second to determine network information. |
|
InternetPastryNodeFactory(NodeIdFactory nf,
int startPort,
Environment env)
|
Method Summary | |
---|---|
protected void |
findExternalAddress(Id nodeId,
java.net.InetSocketAddress bindAddress,
Continuation<PastryNode,java.io.IOException> deliverResultToMe)
Finds the external address, calls openFirewallPort() |
protected void |
findExternalAddressHelper(Id nodeId,
java.net.InetSocketAddress bindAddress,
Continuation<PastryNode,java.io.IOException> deliverResultToMe,
java.util.Collection<java.net.InetSocketAddress> myProbeAddresses)
|
protected boolean |
findExternalAddressIfNecessary(java.net.InetAddress address)
Sets/Verifies externalAddresses Return true if all is well. |
protected void |
findExternalNodes(Id nodeId,
java.net.InetSocketAddress bindAddress,
java.util.Collection<java.net.InetSocketAddress> nonInternetRoutable,
Continuation<PastryNode,java.io.IOException> deliverResultToMe)
Probe the internalAddresses to get more externalAddresses, then call findExternalAddressHelper |
protected NATHandler |
getDefaultNatHandler(Environment env,
java.net.InetAddress localAddress)
Return a NATHandler |
protected int |
getFireWallPolicyVariable(java.lang.String key)
|
protected boolean |
isInternetRoutable(MultiInetSocketAddress proxyAddress)
|
protected void |
newNodeSelector(Id nodeId,
MultiInetSocketAddress proxyAddress,
Continuation<PastryNode,java.io.IOException> deliverResultToMe,
java.util.Map<java.lang.String,java.lang.Object> initialVars)
This is where the action takes place. |
protected void |
openFirewallPort(Id nodeId,
java.net.InetSocketAddress bindAddress,
Continuation<PastryNode,java.io.IOException> deliverResultToMe,
java.net.InetAddress externalAddress,
int requestedPort)
Attempt to open the firewall on the specified port if it doesn't work, uses Rendezvous |
protected boolean |
shouldCheckConnectivity(MultiInetSocketAddress proxyAddress,
java.util.Collection<java.net.InetSocketAddress> bootstraps)
|
protected boolean |
shouldFindExternalAddress(java.net.InetAddress address)
|
protected void |
verifyConnectivityThenMakeNewNode(Id nodeId,
MultiInetSocketAddress proxyAddress,
Continuation<PastryNode,java.io.IOException> deliverResultToMe)
Verifies the connectivity (if necessary), then calls super.newNodeSelector() if connectivity fails, then uses Rendezvous |
Methods inherited from class rice.pastry.transport.TransportPastryNodeFactory |
---|
getLeafSetProtocol, getRouterStrategy, getRouteSetProtocol, getTLDeserializer, nodeHandleHelper |
Methods inherited from class rice.pastry.PastryNodeFactory |
---|
getEnvironment |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ALWAYS
public static final int PREFIX_MATCH
public static final int NEVER
public static final int BOOT
public static final int OVERWRITE
public static final int USE_DIFFERENT_PORT
public static final int FAIL
public static final int RENDEZVOUS
Constructor Detail |
---|
public InternetPastryNodeFactory(NodeIdFactory nf, int startPort, Environment env) throws java.io.IOException
java.io.IOException
public InternetPastryNodeFactory(NodeIdFactory nf, java.net.InetAddress bindAddress, int startPort, Environment env, NATHandler handler, java.util.Collection<java.net.InetSocketAddress> probeAddresses, java.net.InetAddress[] externalAddresses) throws java.io.IOException
nf
- can be null, but must call newNode() with a NodeId of the new PastryNodebindAddress
- the NIC to use (null will choose one that can access the Internet)startPort
- the port of the first created node, will be incremented for additional nodes,
can be specified on a per-Node basis by calling newNode() with a MultiInetSocketAddressenv
- can't be nullhandler
- will attempt to use SBBI's UPnP library if null, unless blocked by deleting the
param "nat_handler_class"probeAddresses
- a list of bootstrap nodes' Internet routable addresses, used to establish
firewall informationexternalAddresses
- ordered addresses of the nat propagation from most external to most internal,
null will use natHandler and probeAddresses to determine this
java.io.IOException
Method Detail |
---|
protected NATHandler getDefaultNatHandler(Environment env, java.net.InetAddress localAddress)
env
- localAddress
- the address of the interface we should search for a NAT on
protected boolean shouldFindExternalAddress(java.net.InetAddress address)
protected boolean findExternalAddressIfNecessary(java.net.InetAddress address) throws java.io.IOException
address
-
java.io.IOException
protected void newNodeSelector(Id nodeId, MultiInetSocketAddress proxyAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe, java.util.Map<java.lang.String,java.lang.Object> initialVars)
newNodeSelector
in class SocketPastryNodeFactory
protected void findExternalAddress(Id nodeId, java.net.InetSocketAddress bindAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe)
protected void findExternalNodes(Id nodeId, java.net.InetSocketAddress bindAddress, java.util.Collection<java.net.InetSocketAddress> nonInternetRoutable, Continuation<PastryNode,java.io.IOException> deliverResultToMe)
protected void findExternalAddressHelper(Id nodeId, java.net.InetSocketAddress bindAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe, java.util.Collection<java.net.InetSocketAddress> myProbeAddresses)
protected void openFirewallPort(Id nodeId, java.net.InetSocketAddress bindAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe, java.net.InetAddress externalAddress, int requestedPort)
port
- the external firewall port to (attempt to) use, -1 to use anythingprotected void verifyConnectivityThenMakeNewNode(Id nodeId, MultiInetSocketAddress proxyAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe)
nodeId
- proxyAddress
- deliverResultToMe
- protected boolean isInternetRoutable(MultiInetSocketAddress proxyAddress)
protected int getFireWallPolicyVariable(java.lang.String key)
protected boolean shouldCheckConnectivity(MultiInetSocketAddress proxyAddress, java.util.Collection<java.net.InetSocketAddress> bootstraps)
proxyAddress
-
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |