Due to a silly bash mistake (I hate bash), the error from the gateway binary wasn't actually propagated to the script. Thus, we did not notice that it was been broken for a while. Attempting to fix it turned up that we were double-hexing the relay secret and using invalid passwords for the clients.
relay
This crate houses a minimalistic STUN & TURN server.
Features
We aim to support the following feature set:
- STUN binding requests
- TURN allocate requests
- TURN refresh requests
- TURN channel bind requests
- TURN channel data requests
Relaying of data through other means such as DATA frames is not supported.
Building
You can build the server using: cargo build --release --bin relay
Running
For a detailed help text and available configuration options, run cargo run --bin relay -- --help.
Docker
There is a docker image one directory up from this README: Dockerfile.
The Rust binary itself does not include any signal handling, thus you need to run the container with --init if you want to be able to CTRL+C the running container.
Design
The relay is designed in a sans-IO fashion, meaning the core components do not cause side effects but operate as pure, synchronous state machines. They take in data and emit commands: wake me at this point in time, send these bytes to this peer, etc.
This allows us to very easily unit-test all kinds of scenarios because all inputs are simple values.
The main server runs in a single task and spawns one additional task for each allocation. Incoming data that needs to be relayed is forwarded to the main task where it gets authenticated and relayed on success.