Skip to content

Commit

Permalink
do correct dht lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
majestrate committed Jun 28, 2018
1 parent 1c26fb5 commit eeb9c9e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ SIGN = gpg --sign --detach

REPO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

CC ?= cc
CXX ?= c++

TARGETS = llarpd
TARGETS = lokinet
SIGS = $(TARGETS:=.sig)

SHADOW_ROOT ?= $(HOME)/.shadow
Expand All @@ -22,33 +24,35 @@ TESTNET_LOG=$(TESTNET_ROOT)/testnet.log
clean:
rm -f build.ninja rules.ninja cmake_install.cmake CMakeCache.txt
rm -rf CMakeFiles
rm -f $(TARGETS)
rm -f $(TARGETS) llarpd
rm -f $(SHADOW_PLUGIN) $(SHADOW_CONFIG)
rm -f *.sig

debug-configure: clean
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DWITH_TESTS=ON
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DWITH_TESTS=ON -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)

release-configure: clean
cmake -GNinja -DSTATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release -DRELEASE_MOTTO="$(shell cat motto.txt)"
cmake -GNinja -DSTATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)

debug: debug-configure
ninja
ninja test

release-compile: release-configure
ninja
cp llarpd lokinet
strip $(TARGETS)

$(TARGETS): release-compile


%.sig: $(TARGETS)
$(SIGN) $*

release: $(SIGS)

shadow-configure: clean
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DSHADOW=ON
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DSHADOW=ON -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)

shadow-build: shadow-configure
ninja clean
Expand All @@ -59,7 +63,7 @@ shadow: shadow-build
bash -c "$(SHADOW_BIN) -w $$(cat /proc/cpuinfo | grep processor | wc -l) $(SHADOW_CONFIG) &> $(SHADOW_LOG) || true"

testnet-configure: clean
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)

testnet-build: testnet-configure
ninja
Expand Down
7 changes: 6 additions & 1 deletion doc/proto_v0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,20 @@ hop length.

link relay commit record (LRCR)

record requesting relaying messages for 300 seconds to router
record requesting relaying messages for 600 seconds to router
on network who's i is equal to RC.k and decrypt data any messages using
PKE(n, rc.K, c) as symettric key for encryption and decryption.

if l is provided and is less than 600 and greater than 10 then that lifespan
is used (in seconds) instead of 600 seconds.

if w is provided and fits the required proof of work then the lifetime of
the path is extended by w.y seconds

{
c: "<32 byte public encryption key used for upstream>",
i: "<32 byte RC.k of next hop>",
l: uint_optional_lifespan,
n: "<32 bytes nounce for key exchange>",
r: "<16 bytes rx path id>",
t: "<16 bytes tx path id>",
Expand All @@ -302,6 +306,7 @@ the path is extended by w.y seconds
w if provided is a dict with the following struct

{
t: time_created_seconds_since_epoch,
v: 0,
y: uint32_seconds_extended_lifetime,
z: "<32 bytes nonce>"
Expand Down
4 changes: 2 additions & 2 deletions llarp/router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ llarp_router::HandleAsyncLoadRCForSendTo(llarp_async_load_rc *job)
// we don't have the RC locally so do a dht lookup
llarp_router_lookup_job *lookup = new llarp_router_lookup_job;
lookup->user = router;
memcpy(lookup->target, job->rc.pubkey, PUBKEYSIZE);
memcpy(lookup->target, job->pubkey, PUBKEYSIZE);
lookup->hook = &HandleDHTLookupForSendTo;
llarp_dht_lookup_router(router->dht, lookup);
}
Expand Down Expand Up @@ -365,7 +365,7 @@ llarp_router::Tick()
if(inboundLinks.size() == 0)
{
auto N = llarp_nodedb_num_loaded(nodedb);
if(N > 5)
if(N > 2)
{
paths.BuildPaths();
}
Expand Down

0 comments on commit eeb9c9e

Please sign in to comment.