This commit is contained in:
Jeff Becker 2019-03-27 08:36:27 -04:00
parent 1deafe444a
commit 3a4d8f16a7
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
7 changed files with 56 additions and 58 deletions

View File

@ -431,69 +431,60 @@ transfer one or more dht messages directly without a previously made path.
} }
link immediate SML message (LISM) link immediate state message (LISM)
transfer an SML message between nodes transfer a state message between nodes
{ {
a: "s", a: "s",
s: SMLMessage, s: state_message,
v: 0 v: 0
} }
---- ---
Stateles Mesh Layer (SML) state message:
As a censor circumvention method layer 4 (udp) or layer 2 (ethernet) service node joined network
network bridges are used to stateless route messages to the main onion
routing network in a stateless manner such that these network bridges
can be cacsaded many layers deep. The incentive to run these would be
the ability to hide your traffic shape in the shape of others without
the need to excess node churn.
stateless mesh discovery protocol (SMDP)
protocol for detecting and discovering mesh local
topology and where the mainline network is.
TODO: implement me
stateless mesh layer (SML)
similar to link layer messeages but sent over the connectivity mesh layer that
uses ethernet.
SML messages MUST be contained inside a LISM when not over ethernet.
SML message MUST be routed to the recipiant if we are not the recipiant based
on the currently unspecified stateless routing protocol.
TODO: implement routing protocol :^)
{ {
a: protocol_id_uint16, A: "J",
r: "<32 bytes public identity key of recipiant>", R: "<32 bytes public key>",
s: "<32 bytes public identity key of sender>", V: 0
t: "<1280 bytes payload>",
v: 0,
z: "<64 bytes signature generated by sender>"
} }
protocol values: service node parted network
0 - mesh discovery {
t is a SMDP frame (todo: specify me) A: "P",
R: "<32 bytes public key>",
V: 0
}
1 - direct chat service node list request
t is a NUL padded plaintext chat message for node opers to communicate between
nodes.
2 - relayed data packet request the service node list starting at index O containing R entries
t is a udp packet relayed from a client behind a client.
3 - snode to snode direct ip traffic {
t is an ip packet for "0 hop" direct ip traffic between service nodes A: "R",
O: starting_offset_int,
R: number_of_entires_to_request_int,
V: 0
}
service node list response
response to service node list request
{
A: "L",
S: {
"<32 bytes pubkey>" : first_seen_time_uint64,
"<32 bytes pubkey>" : first_seen_time_uint64,
....
},
V: 0
}
--- ---

View File

@ -18,6 +18,7 @@
#include <path/path.hpp> #include <path/path.hpp>
#include <router/abstractrouter.hpp> #include <router/abstractrouter.hpp>
#include <util/logic.hpp> #include <util/logic.hpp>
#include <nodedb.hpp>
#include <vector> #include <vector>
@ -207,6 +208,12 @@ namespace llarp
return router; return router;
} }
bool
GetRCFromNodeDB(const Key_t& k, llarp::RouterContact& rc) const override
{
return router->nodedb()->Get(k.as_array(), rc);
}
PendingIntrosetLookups _pendingIntrosetLookups; PendingIntrosetLookups _pendingIntrosetLookups;
PendingTagLookups _pendingTagLookups; PendingTagLookups _pendingTagLookups;
PendingRouterLookups _pendingRouterLookups; PendingRouterLookups _pendingRouterLookups;

View File

@ -130,6 +130,9 @@ namespace llarp
virtual llarp::AbstractRouter* virtual llarp::AbstractRouter*
GetRouter() const = 0; GetRouter() const = 0;
virtual bool
GetRCFromNodeDB(const Key_t& k, llarp::RouterContact& rc) const = 0;
virtual const Key_t& virtual const Key_t&
OurKey() const = 0; OurKey() const = 0;

View File

@ -167,7 +167,7 @@ namespace llarp
replies.emplace_back(new GotRouterMessage(k, txid, {found}, false)); replies.emplace_back(new GotRouterMessage(k, txid, {found}, false));
return true; return true;
} }
else if(dht.GetRouter()->nodedb()->Get(K, found)) else if(dht.GetRCFromNodeDB(k, found))
{ {
replies.emplace_back(new GotRouterMessage(k, txid, {found}, false)); replies.emplace_back(new GotRouterMessage(k, txid, {found}, false));
return true; return true;

View File

@ -39,8 +39,8 @@ namespace llarp
ServiceAddressLookup::GetNextPeer(Key_t &next, ServiceAddressLookup::GetNextPeer(Key_t &next,
const std::set< Key_t > &exclude) const std::set< Key_t > &exclude)
{ {
Key_t k = target.ToKey(); Key_t k = target.ToKey();
auto nodes = parent->Nodes(); const auto &nodes = parent->Nodes();
if(nodes) if(nodes)
{ {
return nodes->FindCloseExcluding(k, next, exclude); return nodes->FindCloseExcluding(k, next, exclude);

View File

@ -140,21 +140,15 @@ namespace llarp
TXHolder< K, V, K_Hash, requestTimeoutMS >::NotFound( TXHolder< K, V, K_Hash, requestTimeoutMS >::NotFound(
const TXOwner& from, const std::unique_ptr< Key_t >& next) const TXOwner& from, const std::unique_ptr< Key_t >& next)
{ {
bool sendReply = true; auto txitr = tx.find(from);
auto txitr = tx.find(from);
if(txitr == tx.end()) if(txitr == tx.end())
{ {
return; return;
} }
// ask for next peer // ask for next peer
if(txitr->second->AskNextPeer(from.node, next)) if(!txitr->second->AskNextPeer(from.node, next))
{ Inform(from, txitr->second->target, {}, true, true);
sendReply = false;
}
llarp::LogWarn("Target key ", txitr->second->target);
Inform(from, txitr->second->target, {}, sendReply, sendReply);
} }
template < typename K, typename V, typename K_Hash, template < typename K, typename V, typename K_Hash,

View File

@ -62,6 +62,9 @@ namespace llarp
MOCK_METHOD2(RelayRequestForPath, MOCK_METHOD2(RelayRequestForPath,
bool(const PathID_t& localPath, const dht::IMessage* msg)); bool(const PathID_t& localPath, const dht::IMessage* msg));
MOCK_CONST_METHOD2(GetRCFromNodeDB,
bool(const dht::Key_t& k, RouterContact& rc));
MOCK_METHOD6(PropagateIntroSetTo, MOCK_METHOD6(PropagateIntroSetTo,
void(const dht::Key_t& source, uint64_t sourceTX, void(const dht::Key_t& source, uint64_t sourceTX,
const service::IntroSet& introset, const service::IntroSet& introset,