turn-rs
turn-rs copied to clipboard
A pure rust implemented turn server.
TURN-RS
A pure rust-implemented turn server, different from coturn, provides a more flexible external control API and provides the same performance and memory footprint.
Table of contents
- building
- usage
-
external control api
depends on nats message queue.
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:
git clone https://github.com/mycrl/turn-rs
Build workspace
Compile the entire workspace in release mode:
cd turn-rs
cargo build --release
After the compilation is complete, you can find the binary file in the "target/release" directory.
Usage
Show helps:
turn --help
Command-line arguments
command-line arguments take precedence over environment variables
values | default | env | tips |
---|---|---|---|
--realm | localhost | TURN_REALM | turn working relam |
--external | 127.0.0.1:3478 | TURN_EXTERNAL | turn server public address |
--bind | 127.0.0.1:3478 | TURN_BIND | turn server udp bind port |
--nats | 127.0.0.1:4222 | TURN_NATS | nats server connection url |
--nats-token | TURN_NATS_TOKEN | ||
--nats-tls-cert | TURN_NATS_TLS_CERT | ||
--nats-tls-key | TURN_NATS_TLS_KEY | ||
--threads | TURN_THREADS | internal thread pool size |
for sys calls, multithreading does not significantly help to improve IO throughput.
Simple example
Set envs:
export TURN_EXTERNAL="127.0.0.1:3478"
export TURN_BIND="127.0.0.1:3478"
Or else use command-line arguments:
turn --bind=127.0.0.1:8080 --external=127.0.0.1:8080
Logs
The server closes log output by default, and the log output level can be set using environment variables:
export RUST_LOG=<level> // error | warn | info | debug | trace
License
GPL Copyright (c) 2022 Mr.Panda.