net: Perform full p2p code cleanup and improve certain pieces.

Notable changes:

* Rewritten transport protocols into Dialer and Listener (Nym is TODO)

  This simplifies using the transports a lot, as can be seen for example
  in src/rpc, and generally around the p2p library. It also defines features
  for each transport (all of which are enabled by default). We drop the
  socks client for Tor and Nym and use first-class support with the Arti Tor
  library, and nym-sphinx/nym-websockets (to be used with nym-client).

* Outbound session healing

  The outbound session will now poll and try to fill all the requested
  slots more efficiently, and if needed, will activate peer discovery to
  find more peers if we can't connect to any known ones. Also if we're
  unable to connect to any, we shall drop them from our set.

  Additionally, transport mixing is enabled by default, so when we're
  allowing transport mixing, and we use Tor, we will also be able to connect
  to other transports that Tor can connect to (e.g. tcp://).

* Unix socket transport dropped

  We haven't been using this, and it seems we're not going down this path,
  so the code has been obsoleted and removed.

* TLS session verification

  We fully verify server and client TLS certificates upon connection so
  we're able to perform TLS1.3 with forward secrecy.

* lilith pruning

  lilith now periodically prunes known peers from its sets if it's unable
  to connect to them.
This commit is contained in:
parazyd
2023-06-26 15:48:38 +02:00
parent d070b7792b
commit 55ee919906
69 changed files with 4894 additions and 4553 deletions

View File

@@ -12,7 +12,7 @@ CARGO = cargo
#TARGET_PRFX = --target=
# Binaries to be built
BINS = drk darkfid ircd dnetview faucetd vanityaddr
BINS = darkfid faucetd drk darkirc dnetview vanityaddr
# zkas dependencies
ZKASDEPS = \
@@ -36,8 +36,7 @@ BINDEPS = \
all: $(BINS)
zkas: $(ZKASDEPS)
$(CARGO) build $(TARGET_PRFX)$(RUST_TARGET) \
--all-features --release --package $@
$(CARGO) build $(TARGET_PRFX)$(RUST_TARGET) --all-features --release --package $@
cp -f target/$(RUST_TARGET)/release/$@ $@
$(PROOFS_BIN): zkas $(PROOFS_SRC)
@@ -50,8 +49,7 @@ contracts: zkas
$(MAKE) -C src/contract/deployooor
$(BINS): contracts $(PROOFS_BIN) $(BINDEPS)
$(CARGO) build $(TARGET_PRFX)$(RUST_TARGET) \
--all-features --release --package $@
$(CARGO) build $(TARGET_PRFX)$(RUST_TARGET) --all-features --release --package $@
cp -f target/$(RUST_TARGET)/release/$@ $@
check: contracts $(PROOFS_BIN)