Files
syncthing/Dockerfile.stdht
T
Jakob Borg 3f795834db feat: Peer-to-peer discovery (fixes #3388)
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]>
2026-11-05 22:43:18 +01:00

38 lines
977 B
Docker

ARG GOVERSION=latest
FROM golang:$GOVERSION AS builder
ARG BUILD_USER
ARG BUILD_HOST
ARG TARGETARCH
WORKDIR /src
COPY . .
ENV CGO_ENABLED=0
RUN if [ ! -f stdht-linux-$TARGETARCH ] ; then \
go run build.go -no-upgrade build stdht ; \
mv stdht stdht-linux-$TARGETARCH ; \
fi
FROM alpine
ARG TARGETARCH
LABEL org.opencontainers.image.authors="The Syncthing Project" \
org.opencontainers.image.url="https://syncthing.net" \
org.opencontainers.image.documentation="https://docs.syncthing.net" \
org.opencontainers.image.source="https://github.com/syncthing/syncthing" \
org.opencontainers.image.vendor="The Syncthing Project" \
org.opencontainers.image.licenses="MPL-2.0" \
org.opencontainers.image.title="Syncthing Discovery DHT Server"
EXPOSE 22026/tcp 22026/udp
VOLUME ["/var/stdht"]
COPY --from=builder /src/stdht-linux-$TARGETARCH /bin/stdht
ENV HOME=/var/stdht
USER 1000:1000
WORKDIR /var/stdht
ENTRYPOINT ["/bin/stdht"]