Skip to content

Configuration Reference

This document explains every option available in turn-server.toml. All keys are written in TOML syntax.


KeyTypeDefaultValuesDescription
server.realmstring"localhost"Realm announced to TURN/STUN clients. See RFC 5766 §3 for the formal definition.
server.port-rangestring ("start..end")49152..65535Example: "49152..65535"Inclusive range of relay ports the server is allowed to allocate. Keep the range inside the dynamic port interval (49152–65535) unless you fully control the host.
server.max-threadsintegernumber of logical CPUsUpper bound for worker threads used by the async runtime.
server.interfaces.transportstring enum (required)"udp" or "tcp"The transport protocol exposed on this interface. This table can be declared multiple times; every entry describes one listening endpoint.
server.interfaces.listenstring ("IP:PORT")Local socket address to bind. Use a specific NIC address when the machine is multi-homed; 0.0.0.0:3478 binds to all IPv4 interfaces.
server.interfaces.externalstring ("IP:PORT")Publicly reachable address advertised to clients. Set this to the NAT/public IP when the bound address is not directly reachable.
server.interfaces.idle-timeoutinteger (seconds)20Maximum idle period before a transport connection is dropped.
server.interfaces.mtu (Deprecated)integer (bytes)1500Desired MTU for TURN relayed packets.
server.interfaces.ssl.private-keypath to PEM filePrivate key file for TLS on this interface. TCP transport only — has no effect on UDP interfaces.
server.interfaces.ssl.certificate-chainpath to PEM fileCertificate chain file for TLS on this interface. TCP transport only — has no effect on UDP interfaces.
api.listenstring ("IP:PORT")"127.0.0.1:3000"Bind address for the management gRPC server.
api.timeoutinteger (seconds)5Global timeout applied to API handlers.
api.ssl.private-keypath to PEM filePrivate key file for TLS on the API endpoint.
api.ssl.certificate-chainpath to PEM fileCertificate chain file for TLS on the API endpoint.
prometheus.listenstring ("IP:PORT")"127.0.0.1:9090"Bind address for the Prometheus metrics exporter endpoint. Only enabled when the prometheus feature is compiled.
prometheus.ssl.private-keypath to PEM filePrivate key file for TLS on the Prometheus endpoint.
prometheus.ssl.certificate-chainpath to PEM fileCertificate chain file for TLS on the Prometheus endpoint.
hooks.endpointstring (URL)Base URL of the external hook service used for dynamic auth and event callbacks.
hooks.timeoutinteger (seconds)5Global timeout applied to API handlers.
hooks.max-channel-sizeinteger1024Upper bound for buffered hook events.
hooks.ssl.private-keypath to PEM filePrivate key file for TLS when communicating with the hook service.
hooks.ssl.certificate-chainpath to PEM fileCertificate chain file for TLS when communicating with the hook service.
log.levelstring enum"info"error,warn,info,debugControls verbosity of the built-in logger.
log.stdoutbooleantrueEnable or disable logging to standard output (stdout). If set to true, log messages will be printed to the console in addition to (or instead of) file logging. To disable logging to the console, set this option to false.
log.file-directorystring (optional)If specified, log output will be written to this directory in a file named turn-server-YYYY-MM-DD.log. If not set, file logging is disabled.
auth.enable-hooks-authbooleanfalseEnable or disable hook-based dynamic authentication.
auth.static-auth-secretstring (optional)Shared secret for TURN REST authentication. When provided, the server skips secret lookups through the hook API.
auth.static-credentialstable of username = "password"Static user database used before falling back to hook authentication. Populate this map with long-term accounts that should always exist.

NOTE

Provide the server.interfaces.ssl.* fields to turn the interface into TLS. This is only supported on TCP interfaces; the UDP transport does not accept an ssl option. Certificates are loaded via tokio-rustls (AWS-LC backend when the ssl feature is enabled).

Optional TLS configuration applies to api.ssl.*, prometheus.ssl.*, and hooks.ssl.* entries.

Security note

the management gRPC endpoint ships without authentication or TLS. Enable the SSL settings above or terminate TLS behind a proxy before exposing it to untrusted networks.

All settings are hot-reloaded on restart. Keep secrets (private keys, shared tokens) protected with standard filesystem permissions.

Released under the MIT License.