java.lang.Object
net.i2p.router.transport.udp.EstablishmentManager.HPCallback
- All Implemented Interfaces:
SSU2Payload.PayloadCallback
- Enclosing class:
EstablishmentManager
private static class EstablishmentManager.HPCallbackextends Object implements SSU2Payload.PayloadCallback
Process SSU2 hole punch payload.
Field Summary
Modifier and TypeFieldDescriptionbyte[]Alice's IP from the Address block.intAlice's port from the Address block.private final RemoteHostIdThe host whose handshake failed.private final LogLogger for this callback, may be null.intResponse code from the RelayResponse block.byte[]Payload from the RelayResponse block.longTime the hole punch request was received.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionvoidgotACK(long ackThru, int acks, byte[] ranges) Got an ACK block.voidgotAddress(byte[] ip, int port) Got an Address block.voidgotDateTime(long time) Got a DateTime block.voidgotFragment(byte[] data, int off, int len, long messageId, int frag, boolean isLast) Got a Fragment block.voidgotI2NP(I2NPMessage msg) Got an I2NP block.voidgotOptions(byte[] options, boolean isHandshake) Got an Options block.voidgotPathChallenge(RemoteHostId from, byte[] data) Got a PathChallenge block.voidgotPathResponse(RemoteHostId from, byte[] data) Got a PathResponse block.voidgotPeerTest(int msg, int status, Hash h, byte[] data) Got a PeerTest block.voidgotRelayIntro(Hash aliceHash, byte[] data) Got a RelayIntro block.voidgotRelayRequest(byte[] data) Got a RelayRequest block.voidgotRelayResponse(int status, byte[] data) Got a RelayResponse block.voidgotRelayTag(long tag) Got a RelayTag block.voidGot a RelayTagRequest block.voidgotRI(RouterInfo ri, boolean isHandshake, boolean flood) Got an RI block.voidgotRIFragment(byte[] data, boolean isHandshake, boolean flood, boolean isGzipped, int frag, int totalFrags) Got an RI fragment block.voidgotTermination(int reason, long count) Got a Termination block.voidgotToken(long token, long expires) Got a Token block.private voidLogs a hole punch warning naming the host.
Field Details
_from
The host whose handshake failed._log
Logger for this callback, may be null._timeReceived
public long _timeReceivedTime the hole punch request was received._aliceIP
public byte[] _aliceIPAlice's IP from the Address block._alicePort
public int _alicePortAlice's port from the Address block._respCode
public int _respCodeResponse code from the RelayResponse block._respData
public byte[] _respDataPayload from the RelayResponse block.
Constructor Details
HPCallback
Creates the hole punch callback.- Parameters:
from- the host whose handshake failedlog- the logger to use, may be null
Method Details
gotDateTime
public void gotDateTime(long time) Got a DateTime block.- Specified by:
gotDateTimein interfaceSSU2Payload.PayloadCallback- Parameters:
time- time in milliseconds since epoch
gotOptions
public void gotOptions(byte[] options, boolean isHandshake) Got an Options block.- Specified by:
gotOptionsin interfaceSSU2Payload.PayloadCallback- Parameters:
options- the option dataisHandshake- true only for message 3 part 2
gotRI
Got an RI block.- Specified by:
gotRIin interfaceSSU2Payload.PayloadCallback- Parameters:
ri- will already be validatedisHandshake- true only for message 3 part 2flood- true if this is a floodfill router
gotRIFragment
public void gotRIFragment(byte[] data, boolean isHandshake, boolean flood, boolean isGzipped, int frag, int totalFrags) Got an RI fragment block.- Specified by:
gotRIFragmentin interfaceSSU2Payload.PayloadCallback- Parameters:
data- is first gzipped and then fragmentedisHandshake- true only for message 3 part 2flood- true if this is a floodfill routerisGzipped- true if the data is gzippedfrag- fragment number (0-based)totalFrags- total number of fragments
gotAddress
public void gotAddress(byte[] ip, int port) Got an Address block.- Specified by:
gotAddressin interfaceSSU2Payload.PayloadCallback- Parameters:
ip- IP address bytesport- the port number to send
gotRelayTagRequest
public void gotRelayTagRequest()Got a RelayTagRequest block.- Specified by:
gotRelayTagRequestin interfaceSSU2Payload.PayloadCallback
gotRelayTag
public void gotRelayTag(long tag) Got a RelayTag block.- Specified by:
gotRelayTagin interfaceSSU2Payload.PayloadCallback- Parameters:
tag- the relay tag
gotRelayRequest
public void gotRelayRequest(byte[] data) Got a RelayRequest block.- Specified by:
gotRelayRequestin interfaceSSU2Payload.PayloadCallback- Parameters:
data- excludes flag, includes signature
gotRelayResponse
public void gotRelayResponse(int status, byte[] data) Got a RelayResponse block.- Specified by:
gotRelayResponsein interfaceSSU2Payload.PayloadCallback- Parameters:
status- 0 = accept, 1-255 = rejectdata- excludes flag, includes signature
gotRelayIntro
Got a RelayIntro block.- Specified by:
gotRelayIntroin interfaceSSU2Payload.PayloadCallback- Parameters:
aliceHash- hash of the introducerdata- excludes flag, includes signature
gotPeerTest
Got a PeerTest block.- Specified by:
gotPeerTestin interfaceSSU2Payload.PayloadCallback- Parameters:
msg- 1-7status- 0 = accept, 1-255 = rejecth- Alice or Charlie hash for msg 2 and 4, null for msg 1, 3, 5-7data- excludes flag, includes signature
gotToken
public void gotToken(long token, long expires) Got a Token block.- Specified by:
gotTokenin interfaceSSU2Payload.PayloadCallback- Parameters:
token- the session token to attach to the next peer testexpires- token expiration time in milliseconds
gotI2NP
Got an I2NP block.- Specified by:
gotI2NPin interfaceSSU2Payload.PayloadCallback- Parameters:
msg- the parsed I2NP message
gotFragment
public void gotFragment(byte[] data, int off, int len, long messageId, int frag, boolean isLast) Got a Fragment block.- Specified by:
gotFragmentin interfaceSSU2Payload.PayloadCallback- Parameters:
data- buffer containing fragment dataoff- offset in datalen- length of data to copymessageId- unique message identifierfrag- fragment number (0-based)isLast- whether this is the last fragment
gotACK
public void gotACK(long ackThru, int acks, byte[] ranges) Got an ACK block.- Specified by:
gotACKin interfaceSSU2Payload.PayloadCallback- Parameters:
ackThru- highest contiguous sequence number acknowledgedacks- number of additional acknowledgments beyond ackThruranges- null if none
gotTermination
public void gotTermination(int reason, long count) Got a Termination block.- Specified by:
gotTerminationin interfaceSSU2Payload.PayloadCallback- Parameters:
reason- termination reason codecount- in theory could wrap around to negative, but very unlikely
gotPathChallenge
Got a PathChallenge block.- Specified by:
gotPathChallengein interfaceSSU2Payload.PayloadCallback- Parameters:
from- null if unknowndata- the challenge bytes, which must be copied out
gotPathResponse
Got a PathResponse block.- Specified by:
gotPathResponsein interfaceSSU2Payload.PayloadCallback- Parameters:
from- null if unknowndata- the response bytes, which must be copied out
warn
Logs a hole punch warning naming the host.- Parameters:
msg- the message to log