TURN server in pure Elixir.
Aims to implement:
- RFC 5389: Session Traversal Utilities for NAT (STUN)
- RFC 5766: Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)
- RFC 6156: Traversal Using Relays around NAT (TURN) Extension for IPv6
This project is in early stage of development and some of the features described in the RFCs might be missing. Expect breaking changes.
Supports authentication described in A REST API For Access To TURN Services.
If you're in need of TURN server for testing purposes, feel free to use this Rel public deployment at turn.elixir-webrtc.org
.
In case of any irregularities or bugs, please open an issue with description of the problem. DO NOT use this deployment in production, as it's intended to be an aid in developement only.
To obtain a set of credentials, use the built-in credentials mechanism. It does not require any authentication, but the credentials must be refreshed after 3 hours if not used.
$ curl -X POST "https://turn.elixir-webrtc.org/?service=turn&username=johnsmith"
{"password":"l6hs9SzUgudFeb5XjrfCfOWKeOQ=","ttl":1728,"uris":["turn:167.235.241.140:3478?transport=udp"],"username":"1691574817:johnsmith"}⏎
Use the obtained credentials in e.g. WebRTC's RTCPeerConnection
:
pc = new RTCPeerConnection({
iceServers: [
{
credential: "l6hs9SzUgudFeb5XjrfCfOWKeOQ=",
urls: "turn:167.235.241.140:3478?transport=udp",
username: "1691574817:johnsmith"
}
]
});
- From source
git clone https://github.com/elixir-webrtc/rel.git
cd rel
mix deps.get
mix run --no-halt
- In Docker
docker run --network=host ghcr.io/elixir-webrtc/rel:latest
Rel exposes Prometheus metrics endpoint (by default http://127.0.0.1:9568/metrics
).
Rel supports authentication described in A REST API For Access To TURN Services.
By default available under http://127.0.0.1:4000/
. Example request would be POST http://127.0.0.1:40000/?service=turn&username=johnsmith
.
Key query parameter currently is not supported.
Rel is configured via environment variables. All of the possible options are described in sample env file.