Documentation / Reference

This page is generated from the program and its code when the documentation is built. It is not edited by hand.

Relay configuration

The relay reads one TOML file, relay.toml: /etc/easysync-relay/relay.toml unless another path is given with --config. Secrets are referenced by file name and are never part of the file, an argument or an environment variable. An unknown key or a value outside its range makes the relay refuse to start. Certificates, keys and token files are read at start; to change them, restart the relay.

Keys of relay.toml:

KeyTypeDefaultRequiredMeaning
listenstring, a socket address"0.0.0.0:8443"noThe listener for /relay/v1 (WSS, or plain WS with allow_plain_ws).
tls_cert_filestring, a pathunsetnoPEM certificate chain. Set together with tls_key_file: the relay then terminates TLS. Exactly one of the two makes the relay refuse to start.
tls_key_filestring, a pathunsetnoPEM private key for tls_cert_file.
allow_plain_wsboolfalsenoWithout TLS files the relay refuses to start unless this is true; then it serves plain WS, for use behind a TLS-terminating reverse proxy, and logs a warning. No effect when TLS files are set.
access_token_filesarray of strings, pathsrequiredyesFiles that each hold one deployment access token as unpadded base64url text. The decoded token must be 16 to 64 bytes, otherwise the relay refuses to start.
health_listenstring, a loopback socket address"127.0.0.1:8081"noA plain-HTTP listener that serves only GET /healthz. The relay refuses to start if the address is not a loopback address.

Keys of relay.toml, table limits:

KeyTypeDefaultRequiredMeaning
handshake_timeout_secsinteger, seconds15noTime a listener has to answer an INCOMING before the dialer gets a timeout.
session_lifetime_secsinteger, seconds3600noLifetime of a data pipe.
idle_timeout_secsinteger, seconds30noIdle timeout of a pipe.
pair_register_per_mininteger5noPairing registrations per minute and source address.
pair_join_per_mininteger20noPairing joins per minute and source address.
dial_per_mininteger60noDial requests per minute and source address.
listen_per_mininteger10noRegistrations per minute and control connection.
max_tokens_per_controlinteger192noRegistered rendezvous tokens per control connection (at most 1024).
max_pending_per_listenerinteger16noPending dials per listener.
max_sessionsinteger10000noPairing slots, pending dials and running pipes together.
max_connectionsinteger20000noConcurrent TCP connections in total.
max_connections_per_ipinteger256noConcurrent TCP connections per source address.
max_pair_slotsinteger10000noRegistered pairing slots.
max_control_connectionsinteger10000noOpen control connections.
pipe_buffer_bytesinteger, bytes262144noBytes buffered per direction of a pipe (at least 65536).
bandwidth_bytes_per_secinteger, bytes per secondunsetnoPer-pipe bandwidth limit, both directions together. Unset means unlimited.

The optional table issue lets the relay issue access keys itself; it does so only with enabled = true.

Keys of relay.toml, table issue:

KeyTypeDefaultRequiredMeaning
enabledboolfalsenoIssue access tokens through the HTTPS token API of the relay. Off means the token routes answer 404 and the relay opens no state file.
state_filestring, a pathunsetnoRequired when enabled: the file that holds the SHA-256 of every issued token with the day of creation and expiry. The relay needs a writable directory; a file it cannot read or parse is a start error.
lifetime_daysinteger, days90no2 to 730: an issued token that is not used for this long expires; a use moves the expiry. There is no maximum age.
new_per_ip_per_dayinteger5no1 to 1000: new tokens per source address (IPv6: per /64) in 24 hours.
new_per_hour_totalinteger600no1 to 100000: new tokens per hour in total, in fixed windows from the start of the relay.
max_activeinteger100000no1 to 1000000: issued tokens that exist at the same time.
allowed_originsarray of strings[]noUp to 16 exact origins for the CORS answers of the token routes (the origin of the web app).
trusted_proxiesarray of strings[]noUp to 16 addresses or CIDR blocks of the reverse proxies whose X-Forwarded-For the token routes trust. Required (not empty) with allow_plain_ws.
control_filestring, a pathunsetnoThe operator-written control file: switch issuance off, revoke every issued token, block tokens by hash. Missing or unparsable at start is a start error.

An example:

listen = "127.0.0.1:8443"
tls_cert_file = "/etc/easysync-relay/cert.pem"
tls_key_file = "/etc/easysync-relay/key.pem"
access_token_files = ["/etc/easysync-relay/token"]
health_listen = "127.0.0.1:8081"

[limits]
max_connections_per_ip = 256
bandwidth_bytes_per_sec = 1000000

[issue]
enabled = true
state_file = "/var/lib/easysync-relay/tokens.state"

A relay forwards encrypted data. It does see IP addresses, timing and volume of the connections that use it: what the relay sees.