TURN-RS


TURN Server implemented by ❤️ Rust



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

Usage

bash cargo install turn-server

Show helps:

bash turn-server --help

Command-line arguments

command-line arguments take precedence over environment variables

| values | default | env | |-----------------------|------------------------|--------------------------| | --realm | localhost | TURNREALM | | --external | 127.0.0.1:3478 | TURNEXTERNAL | | --bind | 127.0.0.1:3478 | TURNBIND | | --controller-bind | 127.0.0.1:3000 | TURNCONTROLLERBIND | | --ext-controller-bind | http://127.0.0.1:3000 | TURNEXTCONTROLLERBIND | | --cert-file | | TURNCERTFILE | | --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:

bash export TURN_EXTERNAL="127.0.0.1:3478" export TURN_BIND="127.0.0.1:3478"

Or else use command-line arguments:

bash turn-server --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:

bash export RUST_LOG=<level> // error | warn | info | debug | trace

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:

bash git clone https://github.com/colourful-rtc/turn-rs

Build workspace

Compile the entire workspace in release mode:

bash cd turn-rs cargo build --release

After the compilation is complete, you can find the binary file in the "target/release" directory.

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.