This implements a new peer-to-peer-based discovery protocol.
- The DHT is based on libp2p (of IPFS etc) and constitutes a new,
separate Syncthing-specific network. It does not piggyback on any
existing non-Syncthing nodes out there.
- It uses existing device IDs as the keys, and publishes discovery
documents that include the device certificate and are signed by the
same. This enables validation that the discovery data is _for_ the
right device ID, as well as published _by_ that device.
- The DHT runs on the QUIC socket, so it shares UPnP/NAT-PMP whole
punches and STUN discovery. (Unless the QUIC listener is disabled,
then it runs on an ephemeral socket and can effectively do only
queries and not participate as a full DHT node.)
- There is a hardcoded default pointing to three bootstrap nodes hosted
in the usual manner.
- Currently it's strictly additive -- it runs separately and in
parallell with the usual global discovery. Once proven and scaled, it
will gradually take over the duties of the global discovery.
- There is a new command line tool `stdht` which just runs a DHT node to
assist with discovery (the bootstrap nodes are this).
The diff is large and terrifying, but that's how it is.
Signed-off-by: Jakob Borg <[email protected]>
Move infrastructure related commands to under `cmd/infra` and
development stuff to `cmd/dev`. The default build command builds the
regular user facing binaries: syncthing, stdiscosrv, and strelaysrv.