Files
horizon-airdef/crates/horizon-relay/horizon-relay.service
T
Ludovic Marie de464a8fc0 Play with friends without a server: endpoints and key in the code
Ludovic can't pay for a hosted relay, so nothing depends on one now. The
host's game finds how it can be reached on its own: its interface
addresses (LAN, VPNs such as Tailscale or ZeroTier, IPv6), a port opened
on the router for an hour at a time (PCP, then NAT-PMP, then UPnP IGD;
renewed while sharing, deleted on stop) and its public address from STUN
(Cloudflare's and Google's public servers by default, configurable). The
invite code carries those endpoints and an 80-bit secret in base32 groups
with a checksum; guests dial every endpoint at once and run the same
SPAKE2 + ChaCha20-Poly1305 handshake, no rendezvous involved. When nothing
can reach the host it says why and what to do (UPnP, the port to forward,
a relay, a VPN; CGNAT and double NAT detected).

The relay stays as something anyone can run (binary, Dockerfile, systemd
unit; Railway config removed): with one configured the host also gets a
short code, and the full code names the relay so guests fall back to it.
No relay by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 03:05:54 +02:00

25 lines
750 B
Desktop File

# A systemd unit for a self-hosted Play with friends relay (docs/play-with-friends.md,
# "Running your own relay"). Install the binary as /usr/local/bin/horizon-relay, copy this
# file to /etc/systemd/system/, then: systemctl enable --now horizon-relay
[Unit]
Description=Horizon play-with-friends relay
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/local/bin/horizon-relay
# The port friends reach (forward it on your router, TCP). Limits: RELAY_* in the docs.
Environment=PORT=7000
# Environment=RELAY_SESSION_KBPS=1024
# Environment=RELAY_TOTAL_MBPS=20
DynamicUser=yes
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target