Run your own relay
A new share is relay-less by default: clients connect straight to the
sharing machine, so it needs a public address. A relay lets clients reach
a sharer behind a NAT. spora share --spora-relays uses Spora’s; running
your own instead is a small job: the relay is a deliberately dumb UDP
forwarder. It carries
encrypted packets between the two ends without being able to read them,
holds no keys, and speaks no protocol of its own beyond a registration
message.
The relay ships as its own tarball in the same GitHub release
(spora-relay-…, which contains the spora-relay binary) and builds from
the same repository (where a source build names the binary plain
relay).
# on a machine with a public address
spora-relay --port 51820
# on the sharing machine
spora share --relay your.host:51820
The relay’s address is baked into the share URL, so clients need nothing
extra. Repeat --relay to register with several relays; clients try them
IPv6-first, then in listed order, which makes a second relay a cheap
fallback. A hostname with
both A and AAAA records counts as one relay per address family, and gives
you IPv6 connectivity for free.
A relay for many sessions
All sessions share the relay’s one UDP socket, and the kernel drops what
arrives while that socket’s buffer is full. The relay keeps the buffer
empty by reading ahead of its sending, into a queue of its own, and asks
the kernel for a larger buffer besides (8 MiB; --udp-buffer <bytes> for
another size). A stock Linux grants 208 KiB, about a hundred datagrams,
unless the host’s limit is raised:
# /etc/sysctl.d/60-spora-relay.conf; apply with `sysctl --system`, then restart the relay
net.core.rmem_max = 8388608
net.core.wmem_max = 8388608
The relay logs the sizes it got when it starts, and warns when they are less than it asked for. A relay for a few people works without this; set it on a host that carries many busy sessions at once.
Skipping the relay entirely
If the sharing machine itself has a public, reachable address, no relay is needed at all. That is the default for a new share without relay flags: the sharer finds its public address with STUN and picks a port. To name the address and port yourself:
spora share --direct your.public.host:51820
Clients then dial the sharer directly. Combine with --relay to offer
both and let clients fall back.
Restricting who may use your relay
An open relay forwards for any sharer that registers. To limit yours to sharers you have given a token, start it with one:
spora-relay --port 51820 --token-file relay.token
spora share --relay your.host:51820 --relay-token relay.token
The token stays on the sharing machine, in the share; it is not part of the URL. The repository’s relay/README.md covers the alternative TCP and Noise carriers for networks that block UDP or fingerprint QUIC, and the relay’s own session log.