turn-rs 1.0.1

A library for handling round sessions.
Documentation

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:

git clone https://github.com/colourful-rtc/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-server --help

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:

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

Or else use command-line arguments:

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:

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

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.