mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
more
This commit is contained in:
parent
280d85d478
commit
8a4c0ce841
|
@ -656,6 +656,7 @@ start a new session
|
|||
A: "H",
|
||||
C: "<1048 bytes ciphertext block>",
|
||||
D: "<N bytes encrypted HSD>",
|
||||
F: "<16 bytes source path_id>",
|
||||
N: "<32 bytes nonce for key exchange>",
|
||||
V: 0,
|
||||
Z: "<64 bytes signature of entire message using sender's signing key>"
|
||||
|
@ -691,6 +692,8 @@ C, K = PQKE_A(I_B.k)
|
|||
N = RAND(32)
|
||||
D = SE(X, K, N)
|
||||
|
||||
path = PickSendPath()
|
||||
|
||||
M = {
|
||||
A: "T",
|
||||
P: I_B.P,
|
||||
|
@ -699,6 +702,7 @@ M = {
|
|||
A: "H",
|
||||
C: C,
|
||||
D: D,
|
||||
F: path.lastHop.txID,
|
||||
N: N,
|
||||
V: 0,
|
||||
Z: "\x00" * 64
|
||||
|
@ -711,6 +715,8 @@ Z = S(A_sk, BE(M))
|
|||
alice transmits a TDFM to router with public key I_B.K via her path that ends
|
||||
with router with public key I_B.k
|
||||
|
||||
path = PickSendPath()
|
||||
|
||||
{
|
||||
A: "T",
|
||||
P: I_B.P,
|
||||
|
@ -719,6 +725,7 @@ with router with public key I_B.k
|
|||
A: "H",
|
||||
C: C,
|
||||
D: D,
|
||||
F: path.lastHop.txID,
|
||||
N: N,
|
||||
V: 0,
|
||||
Z: Z
|
||||
|
@ -744,6 +751,7 @@ transfer data on a session previously made
|
|||
{
|
||||
A: "H",
|
||||
D: "<N bytes encrypted HSD>",
|
||||
F: "<16 bytes path id of soruce>",
|
||||
N: "<32 bytes nonce for symettric cipher>",
|
||||
T: "<16 bytes converstation tag>",
|
||||
V: 0,
|
||||
|
|
|
@ -998,6 +998,7 @@ namespace llarp
|
|||
if(!frame->Verify(Crypto(), si))
|
||||
return false;
|
||||
// remove convotag it doesn't exist
|
||||
LogWarn("remove convotag T=", frame->T);
|
||||
RemoveConvoTag(frame->T);
|
||||
return true;
|
||||
}
|
||||
|
@ -1027,6 +1028,7 @@ namespace llarp
|
|||
, m_Endpoint(ep)
|
||||
{
|
||||
createdAt = ep->Now();
|
||||
currentConvoTag.Zero();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1682,11 +1684,11 @@ namespace llarp
|
|||
path = m_Endpoint->GetPathByRouter(remoteIntro.router);
|
||||
if(path)
|
||||
{
|
||||
routing::PathTransferMessage transfer(msg, remoteIntro.pathID);
|
||||
const routing::PathTransferMessage transfer(msg, remoteIntro.pathID);
|
||||
if(path->SendRoutingMessage(&transfer, m_Endpoint->Router()))
|
||||
{
|
||||
llarp::LogDebug("sent data to ", remoteIntro.pathID, " on ",
|
||||
remoteIntro.router);
|
||||
remoteIntro.router, " seqno=", sequenceNo);
|
||||
lastGoodSend = m_Endpoint->Now();
|
||||
++sequenceNo;
|
||||
return true;
|
||||
|
@ -1798,16 +1800,23 @@ namespace llarp
|
|||
++itr;
|
||||
}
|
||||
// send control message if we look too quiet
|
||||
if(now - lastGoodSend > (sendTimeout / 2))
|
||||
if(lastGoodSend)
|
||||
{
|
||||
if(!GetNewestPathByRouter(remoteIntro.router))
|
||||
if(now - lastGoodSend > (sendTimeout / 2))
|
||||
{
|
||||
BuildOneAlignedTo(remoteIntro.router);
|
||||
if(!GetNewestPathByRouter(remoteIntro.router))
|
||||
{
|
||||
BuildOneAlignedTo(remoteIntro.router);
|
||||
}
|
||||
Encrypted< 64 > tmp;
|
||||
tmp.Randomize();
|
||||
llarp_buffer_t buf(tmp.data(), tmp.size());
|
||||
AsyncEncryptAndSendTo(buf, eProtocolControl);
|
||||
SharedSecret k;
|
||||
if(currentConvoTag.IsZero())
|
||||
return false;
|
||||
return !m_DataHandler->HasConvoTag(currentConvoTag);
|
||||
}
|
||||
Encrypted< 64 > tmp;
|
||||
tmp.Randomize();
|
||||
llarp_buffer_t buf(tmp.data(), tmp.size());
|
||||
AsyncEncryptAndSendTo(buf, eProtocolControl);
|
||||
}
|
||||
// if we are dead return true so we are removed
|
||||
return lastGoodSend
|
||||
|
@ -1815,6 +1824,12 @@ namespace llarp
|
|||
: (now >= createdAt && now - createdAt > connectTimeout);
|
||||
}
|
||||
|
||||
bool
|
||||
Endpoint::HasConvoTag(const ConvoTag& t) const
|
||||
{
|
||||
return m_Sessions.find(t) != m_Sessions.end();
|
||||
}
|
||||
|
||||
bool
|
||||
Endpoint::OutboundContext::SelectHop(llarp_nodedb* db,
|
||||
const RouterContact& prev,
|
||||
|
|
|
@ -261,6 +261,9 @@ namespace llarp
|
|||
static void
|
||||
HandlePathDead(void*);
|
||||
|
||||
bool
|
||||
HasConvoTag(const ConvoTag& t) const override;
|
||||
|
||||
bool
|
||||
ShouldBuildMore(llarp_time_t now) const override;
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ namespace llarp
|
|||
virtual void
|
||||
RemoveConvoTag(const ConvoTag& remote) = 0;
|
||||
|
||||
virtual bool
|
||||
HasConvoTag(const ConvoTag& remote) const = 0;
|
||||
|
||||
virtual void
|
||||
PutSenderFor(const ConvoTag& remote, const ServiceInfo& si) = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue