class OutboundEstablishState2 extends OutboundEstablishState implements SSU2Payload.PayloadCallback
| Modifier and Type | Class and Description |
|---|---|
static class | OutboundEstablishState2.IntroStatePer-introducer introduction states |
OutboundEstablishState.OutboundState_aliceIP, _alicePort, _bobIP, _bobPort, _context, _currentState, _establishBegin, _lastSend, _log, _nextSend, _receivedRelayTag, _remoteHostId, _remotePeer, _requestSentCount, _requestSentTime, _rtt, MAX_DELAY, RETRANSMIT_DELAY| Constructor and Description |
|---|
OutboundEstablishState2(RouterContext ctx,
UDPTransport transport,
RemoteHostId claimedAddress,
RemoteHostId remoteHostId,
RouterIdentity remotePeer,
boolean needIntroduction,
SessionKey introKey,
RouterAddress ra,
UDPAddress addr,
int version)Prepare to start a new handshake with the given peer. |
| Modifier and Type | Method and Description |
|---|---|
PeerState2 | confirmedPacketsSent(UDPPacket[] packets)Note that we just sent the SessionConfirmed packets
and save them for retransmission |
int | countIntroducers() |
void | fail()Overridden to destroy the handshake state |
HandshakeState | getHandshakeState() |
OutboundEstablishState2.IntroState | getIntroState(Hash h)Get the current state for the SSU2 introducer specified |
int | getMTU()What is the largest packet we can send to the peer?
Only used for Session Confirmed packets. |
EstablishmentManager.Token | getNextToken()Get the next token for this connection |
PeerState2 | getPeerState()Get the peer state for this connection |
long | getRcvConnID() |
byte[] | getRcvHeaderEncryptKey1() |
byte[] | getRcvHeaderEncryptKey2() |
byte[] | getRcvRetryHeaderEncryptKey2() |
UDPPacket | getRetransmitSessionRequestPacket()Get a packet to retransmit the SessionRequest |
long | getSendConnID() |
byte[] | getSendHeaderEncryptKey1() |
byte[] | getSendHeaderEncryptKey2() |
InetSocketAddress | getSentAddress() |
long | getToken() |
int | getVersion()Get the version of the SSU protocol in use. |
void | gotACK(long ackThru,
int acks,
byte[] ranges)Receive an acknowledgment block. |
void | gotAddress(byte[] ip,
int port)Receive an address block. |
void | gotDateTime(long time)Receive a date/time synchronization block. |
void | gotFragment(byte[] data,
int off,
int len,
long messageId,
int frag,
boolean isLast)Receive a fragment of a fragmented message. |
void | gotI2NP(I2NPMessage msg)Receive an I2NP message block. |
void | gotOptions(byte[] options,
boolean isHandshake)Receive a session options block. |
void | gotPathChallenge(RemoteHostId from,
byte[] data)Receive a path challenge block. |
void | gotPathResponse(RemoteHostId from,
byte[] data)Receive a path response block. |
void | gotPeerTest(int msg,
int status,
Hash h,
byte[] data)Receive a peer test block. |
void | gotRelayIntro(Hash aliceHash,
byte[] data)Receive a relay introduction. |
void | gotRelayRequest(byte[] data)Receive a relay request. |
void | gotRelayResponse(int status,
byte[] data)Receive a relay response. |
void | gotRelayTag(long tag)Receive a relay tag. |
void | gotRelayTagRequest()Receive a relay tag request. |
void | gotRI(RouterInfo ri,
boolean isHandshake,
boolean flood)Receive a complete RouterInfo block. |
void | gotRIFragment(byte[] data,
boolean isHandshake,
boolean flood,
boolean isGzipped,
int frag,
int totalFrags)Receive a fragment of a RouterInfo block. |
void | gotTermination(int reason,
long count)Receive a session termination block. |
void | gotToken(long token,
long expires)Receive a new session token. |
void | introduced(byte[] ip,
int port,
long token)After introduction |
void | introSent(Hash h)A relay request was sent to the SSU2 introducer specified |
(package private) boolean | receiveHolePunch()Overridden because we don't have to wait for Relay Response first. |
void | receiveRetry(UDPPacket packet)Receive a retry packet |
void | receiveSessionCreated(UDPPacket packet)Receive a SessionCreated packet |
void | requestSent(DatagramPacket pkt)Note that we just sent the SessionRequest packet
and save it for retransmission |
void | setIntroState(Hash h,
OutboundEstablishState2.IntroState state)Set the current state for the SSU2 introducer specified |
void | tokenRequestSent(DatagramPacket packet)Note that we just sent a token request packet
and save it for retransmission |
String | toString()Get string representation |
boolean | validateSessionCreated()Blocking call (run in the establisher thread) to determine if the
session was created properly. |
addMessage, complete, confirmedPacketsSent, dataReceived, getClaimedAddress, getConfirmedSentTime, getEstablishBeginTime, getIntroKey, getIntroNonce, getIntroSentTime, getLifetime, getLifetime, getNextQueuedMessage, getNextSendTime, getReceivedIP, getReceivedPort, getReceivedRelayTag, getReceivedSignedOnTime, getRemoteAddress, getRemoteHostId, getRemoteIdentity, getRequestSentTime, getRTT, getSentIP, getSentPort, getSentSignedOnTime, getState, introduced, introductionFailed, introSent, isExtendedOptionsAllowed, isFirstMessageOurDSM, needIntroduction, packetReceived, requestSent, setIntroNoncepublic OutboundEstablishState2(RouterContext ctx, UDPTransport transport, RemoteHostId claimedAddress, RemoteHostId remoteHostId, RouterIdentity remotePeer, boolean needIntroduction, SessionKey introKey, RouterAddress ra, UDPAddress addr, int version) throws IllegalArgumentException
ctx - the router contexttransport - the UDP transportclaimedAddress - an IP/port based RemoteHostId, or null if unknownremoteHostId - non-null, == claimedAddress if direct, or a hash-based one if indirectremotePeer - must have supported sig typeneedIntroduction - should we ask Bob to be an introducer for us?
ignored unless allowExtendedOptions is trueintroKey - Bob's introduction key, as published in the netdbra - the router addressaddr - non-nullversion - the SSU2 versionIllegalArgumentExceptionpublic PeerState2 confirmedPacketsSent(UDPPacket[] packets)
packets - the UDP packets sentpublic int countIntroducers()
public void fail()
fail in class OutboundEstablishStatepublic HandshakeState getHandshakeState()
public OutboundEstablishState2.IntroState getIntroState(Hash h)
h - the introducer hashpublic int getMTU()
public EstablishmentManager.Token getNextToken()
public PeerState2 getPeerState()
public long getRcvConnID()
public byte[] getRcvHeaderEncryptKey1()
public byte[] getRcvHeaderEncryptKey2()
public byte[] getRcvRetryHeaderEncryptKey2()
public UDPPacket getRetransmitSessionRequestPacket()
public long getSendConnID()
public byte[] getSendHeaderEncryptKey1()
public byte[] getSendHeaderEncryptKey2()
public InetSocketAddress getSentAddress()
public long getToken()
public int getVersion()
OutboundEstablishStategetVersion in class OutboundEstablishStatepublic void gotACK(long ackThru,
int acks,
byte[] ranges)SSU2Payload.PayloadCallbackgotACK in interface SSU2Payload.PayloadCallbackackThru - highest contiguous sequence number acknowledgedacks - number of additional acknowledgments beyond ackThruranges - null if nonepublic void gotAddress(byte[] ip,
int port)SSU2Payload.PayloadCallbackgotAddress in interface SSU2Payload.PayloadCallbackip - IP address bytesport - port numberpublic void gotDateTime(long time)
SSU2Payload.PayloadCallbackgotDateTime in interface SSU2Payload.PayloadCallbacktime - time in milliseconds since epochpublic void gotFragment(byte[] data,
int off,
int len,
long messageId,
int frag,
boolean isLast)
throws DataFormatExceptionSSU2Payload.PayloadCallbackgotFragment in interface SSU2Payload.PayloadCallbackdata - 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 fragmentDataFormatExceptionpublic void gotI2NP(I2NPMessage msg)
SSU2Payload.PayloadCallbackgotI2NP in interface SSU2Payload.PayloadCallbackmsg - the parsed I2NP messagepublic void gotOptions(byte[] options,
boolean isHandshake)SSU2Payload.PayloadCallbackgotOptions in interface SSU2Payload.PayloadCallbackoptions - the option dataisHandshake - true only for message 3 part 2public void gotPathChallenge(RemoteHostId from, byte[] data)
SSU2Payload.PayloadCallbackgotPathChallenge in interface SSU2Payload.PayloadCallbackfrom - null if unknownpublic void gotPathResponse(RemoteHostId from, byte[] data)
SSU2Payload.PayloadCallbackgotPathResponse in interface SSU2Payload.PayloadCallbackfrom - null if unknownpublic void gotPeerTest(int msg,
int status,
Hash h,
byte[] data)SSU2Payload.PayloadCallbackgotPeerTest in interface SSU2Payload.PayloadCallbackmsg - 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 signaturepublic void gotRelayIntro(Hash aliceHash, byte[] data)
SSU2Payload.PayloadCallbackgotRelayIntro in interface SSU2Payload.PayloadCallbackaliceHash - hash of the introducerdata - excludes flag, includes signaturepublic void gotRelayRequest(byte[] data)
SSU2Payload.PayloadCallbackgotRelayRequest in interface SSU2Payload.PayloadCallbackdata - excludes flag, includes signaturepublic void gotRelayResponse(int status,
byte[] data)SSU2Payload.PayloadCallbackgotRelayResponse in interface SSU2Payload.PayloadCallbackstatus - 0 = accept, 1-255 = rejectdata - excludes flag, includes signaturepublic void gotRelayTag(long tag)
SSU2Payload.PayloadCallbackgotRelayTag in interface SSU2Payload.PayloadCallbacktag - the relay tagpublic void gotRelayTagRequest()
SSU2Payload.PayloadCallbackgotRelayTagRequest in interface SSU2Payload.PayloadCallbackpublic void gotRI(RouterInfo ri, boolean isHandshake, boolean flood) throws DataFormatException
SSU2Payload.PayloadCallbackgotRI in interface SSU2Payload.PayloadCallbackri - will already be validatedisHandshake - true only for message 3 part 2flood - true if this is a floodfill routerDataFormatExceptionpublic void gotRIFragment(byte[] data,
boolean isHandshake,
boolean flood,
boolean isGzipped,
int frag,
int totalFrags)SSU2Payload.PayloadCallbackgotRIFragment in interface SSU2Payload.PayloadCallbackdata - 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 fragmentspublic void gotTermination(int reason,
long count)SSU2Payload.PayloadCallbackgotTermination in interface SSU2Payload.PayloadCallbackreason - termination reason codecount - in theory could wrap around to negative, but very unlikelypublic void gotToken(long token,
long expires)SSU2Payload.PayloadCallbackgotToken in interface SSU2Payload.PayloadCallbacktoken - the token valueexpires - token expiration time in millisecondspublic void introduced(byte[] ip,
int port,
long token)ip - the IP address bytesport - the port numbertoken - the token receivedpublic void introSent(Hash h)
h - the introducer hashboolean receiveHolePunch()
receiveHolePunch in class OutboundEstablishStatepublic void receiveRetry(UDPPacket packet) throws GeneralSecurityException
packet - the UDP packet receivedGeneralSecurityExceptionpublic void receiveSessionCreated(UDPPacket packet) throws GeneralSecurityException
packet - the UDP packet receivedGeneralSecurityExceptionpublic void requestSent(DatagramPacket pkt)
pkt - the datagram packet sentpublic void setIntroState(Hash h, OutboundEstablishState2.IntroState state)
h - the introducer hashstate - the new statepublic void tokenRequestSent(DatagramPacket packet)
packet - the datagram packet sentpublic String toString()
OutboundEstablishStatetoString in class OutboundEstablishStatepublic boolean validateSessionCreated()
OutboundEstablishStatevalidateSessionCreated in class OutboundEstablishState