A pure rust-implemented turn server, different from coturn, provides a more flexible external control API and provides the same performance and memory footprint.
Who uses it?
Table of contents
Crates
stun, fast and zero-cost stun message decoder and encoder. (crate).turn, a library for handling turn sessions. (crate).turn-server, implementation of turn server based on turn library. (api)
Building
Prerequisites
You need to install the Rust toolchain, if you have already installed it, you can skip it, Install Rust, then get the source code:
Build workspace
Compile the entire workspace in release mode:
After the compilation is complete, you can find the binary file in the "target/release" directory.
Usage
Show helps:
Command-line arguments
command-line arguments take precedence over environment variables
| values | default | env |
|---|---|---|
| --realm | localhost | TURN_REALM |
| --external | 127.0.0.1:3478 | TURN_EXTERNAL |
| --bind | 127.0.0.1:3478 | TURN_BIND |
| --controller-bind | 127.0.0.1:3000 | TURN_CONTROLLER_BIND |
| --ext-controller-bind | http://127.0.0.1:3000 | TURN_EXT_CONTROLLER_BIND |
| --cert-file | TURN_CERT_FILE | |
| --threads | TURN_THREADS |
for sys calls, multithreading does not significantly help to improve IO throughput.
For detailed documentation, please view: Configuration
Simple example
Set envs:
Or else use command-line arguments:
Logs
The server closes log output by default, and the log output level can be set using environment variables:
| | | |
Benchmark
stun_decoder/channel_bind ...[time: 20.606 ns] ...[thrpt: 4.8812 GiB/s]
stun_decoder/binding_request ...[time: 20.862 ns] ...[thrpt: 4.2856 GiB/s]
License
GPL Copyright (c) 2022 Mr.Panda.