|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.transport.udp.IntroductionManager
class IntroductionManager
Keep track of inbound and outbound introductions. IPv6 info: Alice-Bob communication may be via IPv4 or IPv6. Bob-Charlie communication must be via established IPv4 session as that's the only way that Bob knows Charlie's IPv4 address to give it to Alice. Alice-Charlie communication is via IPv4. If Alice-Bob is over IPv6, Alice must include her IPv4 address in the RelayRequest message. From udp.html on the website:
Indirect session establishment by means of a third party introduction is necessary for efficient NAT traversal. Charlie, a router behind a NAT or firewall which does not allow unsolicited inbound UDP packets, first contacts a few peers, choosing some to serve as introducers. Each of these peers (Bob, Bill, Betty, etc) provide Charlie with an introduction tag - a 4 byte random number - which he then makes available to the public as methods of contacting him. Alice, a router who has Charlie's published contact methods, first sends a RelayRequest packet to one or more of the introducers, asking each to introduce her to Charlie (offering the introduction tag to identify Charlie). Bob then forwards a RelayIntro packet to Charlie including Alice's public IP and port number, then sends Alice back a RelayResponse packet containing Charlie's public IP and port number. When Charlie receives the RelayIntro packet, he sends off a small random packet to Alice's IP and port (poking a hole in his NAT/firewall), and when Alice receives Bob's RelayResponse packet, she begins a new full direction session establishment with the specified IP and port.
Alice first connects to introducer Bob, who relays the request to Charlie.
Alice Bob Charlie RelayRequest ----------------------> <-------------- RelayResponse RelayIntro -----------> <-------------------------------------------- HolePunch (data ignored) SessionRequest --------------------------------------------> <-------------------------------------------- SessionCreated SessionConfirmed ------------------------------------------> <-------------------------------------------- DeliveryStatusMessage <-------------------------------------------- DatabaseStoreMessage DatabaseStoreMessage --------------------------------------> Data <--------------------------------------------------> Data
After the hole punch, the session is established between Alice and Charlie as in a direct establishment.
Field Summary | |
---|---|
static int |
MAX_OUTBOUND
This is enforced in EstablishmentManager |
Constructor Summary | |
---|---|
IntroductionManager(RouterContext ctx,
UDPTransport transport)
|
Method Summary | |
---|---|
void |
add(PeerState peer)
|
(package private) int |
introducedCount()
|
(package private) int |
introducerCount()
Not as elaborate as pickInbound() above. |
int |
pickInbound(Properties ssuOptions,
int howMany)
Grab a bunch of peers who are willing to be introducers for us that are locally known (duh) and have published their own SSU address (duh^2). |
void |
pingIntroducers()
Was part of pickInbound(), moved out so we can call it more often |
(package private) void |
receiveRelayIntro(RemoteHostId bob,
UDPPacketReader reader)
We are Charlie and we got this from Bob. |
(package private) void |
receiveRelayRequest(RemoteHostId alice,
UDPPacketReader reader)
We are Bob and we got this from Alice. |
void |
remove(PeerState peer)
|
void |
reset()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_OUTBOUND
Constructor Detail |
---|
public IntroductionManager(RouterContext ctx, UDPTransport transport)
Method Detail |
---|
public void reset()
public void add(PeerState peer)
public void remove(PeerState peer)
public int pickInbound(Properties ssuOptions, int howMany)
public void pingIntroducers()
int introducerCount()
int introducedCount()
void receiveRelayIntro(RemoteHostId bob, UDPPacketReader reader)
void receiveRelayRequest(RemoteHostId alice, UDPPacketReader reader)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |