mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
send TokenRequest message:
This commit is contained in:
parent
70dca81c40
commit
861166d8a9
2 changed files with 84 additions and 7 deletions
|
@ -24,6 +24,7 @@ namespace transport
|
|||
const int SSU2_CONNECT_TIMEOUT = 5; // 5 seconds
|
||||
const int SSU2_TERMINATION_TIMEOUT = 330; // 5.5 minutes
|
||||
const int SSU2_TERMINATION_CHECK_TIMEOUT = 30; // 30 seconds
|
||||
const int SSU2_TOKEN_EXPIRATION_TIMEOUT = 9; // in second
|
||||
const size_t SSU2_SOCKET_RECEIVE_BUFFER_SIZE = 0x1FFFF; // 128K
|
||||
const size_t SSU2_SOCKET_SEND_BUFFER_SIZE = 0x1FFFF; // 128K
|
||||
const size_t SSU2_MTU = 1488;
|
||||
|
@ -33,7 +34,8 @@ namespace transport
|
|||
eSSU2SessionRequest = 0,
|
||||
eSSU2SessionCreated = 1,
|
||||
eSSU2SessionConfirmed = 2,
|
||||
eSSU2Retry = 9
|
||||
eSSU2Retry = 9,
|
||||
eSSU2TokenRequest = 10
|
||||
};
|
||||
|
||||
enum SSU2BlockType
|
||||
|
@ -104,6 +106,7 @@ namespace transport
|
|||
void SendSessionRequest (uint64_t token = 0);
|
||||
void SendSessionCreated (const uint8_t * X);
|
||||
void SendSessionConfirmed (const uint8_t * Y);
|
||||
void SendTokenRequest ();
|
||||
|
||||
void HandlePayload (const uint8_t * buf, size_t len);
|
||||
bool ExtractEndpoint (const uint8_t * buf, size_t size, boost::asio::ip::udp::endpoint& ep);
|
||||
|
@ -147,6 +150,9 @@ namespace transport
|
|||
|
||||
bool CreateSession (std::shared_ptr<const i2p::data::RouterInfo> router,
|
||||
std::shared_ptr<const i2p::data::RouterInfo::Address> address);
|
||||
|
||||
void UpdateOutgoingToken (const boost::asio::ip::udp::endpoint& ep, uint64_t token, uint32_t exp);
|
||||
uint64_t FindOutgoingToken (const boost::asio::ip::udp::endpoint& ep);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -164,6 +170,7 @@ namespace transport
|
|||
boost::asio::ip::udp::socket m_Socket, m_SocketV6;
|
||||
std::unordered_map<uint64_t, std::shared_ptr<SSU2Session> > m_Sessions;
|
||||
std::map<boost::asio::ip::udp::endpoint, std::shared_ptr<SSU2Session> > m_PendingOutgoingSessions;
|
||||
std::map<boost::asio::ip::udp::endpoint, std::pair<uint64_t, uint32_t> > m_IncomingTokens, m_OutgoingTokens; // remote endpoint -> (token, expires in seconds)
|
||||
i2p::util::MemoryPoolMt<Packet> m_PacketsPool;
|
||||
boost::asio::deadline_timer m_TerminationTimer;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue