#stun #web-rtc #turn #codec #p2p

faster-stun

Fast and zero-cost stun message decoder and encoder

4 releases (stable)

1.0.2 Dec 24, 2023
1.0.1 Jun 24, 2023
1.0.0 Jan 7, 2023
0.1.0 Jan 1, 2023

#1174 in Network programming

Download history 118/week @ 2024-07-19 225/week @ 2024-07-26 101/week @ 2024-08-02 56/week @ 2024-08-09 80/week @ 2024-08-16 78/week @ 2024-08-23 174/week @ 2024-08-30 297/week @ 2024-09-06 186/week @ 2024-09-13 172/week @ 2024-09-20 169/week @ 2024-09-27 165/week @ 2024-10-04 174/week @ 2024-10-11 25/week @ 2024-10-18 183/week @ 2024-10-25 125/week @ 2024-11-01

540 downloads per month
Used in 2 crates

GPL-2.0-or-later

95KB
946 lines


TURN Server implemented by ❤️ Rust
RFC: https://datatracker.ietf.org/doc/html/rfc8656


A turn server implemented pure in rust. Compared with coturn, the advantage is that it provides better performance. It can reach a decoding speed of 5Gib/s in a single thread, and the forwarding delay is less than 35 microseconds. However, it does not provide the same With rich functional support like coturn, this project is most suitable for scenarios where stun/turn servers are used in webrtc.

Who uses it?

Table of contents

Features

  • Only long-term authentication mechanisms are supported.
  • Static authentication lists can be used in configuration files.
  • Only virtual ports are always allocated and no real system ports are occupied.
  • The transport layer supports tcp and udp protocols, and supports binding multiple network cards or interfaces.
  • Provides a simple command line tool to manage and monitor the turn server through the command line tool graphical interface. (turn-cli)
  • The GRPC interface can be used so that the turn server can proactively notify the external service of events and use external authentication mechanisms, and the external can also proactively control the turn server and manage the session. (proto)

Usage

The versions on crates.io and docker may be very outdated. It is recommended to compile directly from the github source code.

cargo install turn-server

Start with configuration file:

turn-server --config=/etc/turn_server/config.toml

Please check the example configuration file for details: turn_server.toml

Docker

// docker hub
docker pull quasipaa/turn-server
// github packages
docker pull ghcr.io/mycrl/turn-server

The custom configuration file overrides the /etc/turn-server/config.toml path inside the image through -v.

Linux service

./install-service.sh

This will compile the project and install and start the service.

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.

License

GPL3.0 Copyright (c) 2022 Mr.Panda.

Dependencies

~1–1.5MB
~32K SLoC