| Crates.io | turn-server |
| lib.rs | turn-server |
| version | 4.0.0-beta.4 |
| created_at | 2023-01-01 05:44:27.138604+00 |
| updated_at | 2025-12-04 03:09:54.835579+00 |
| description | A pure rust-implemented turn server. |
| homepage | https://github.com/mycrl/turn-rs |
| repository | https://github.com/mycrl/turn-rs |
| max_upload_size | |
| id | 748736 |
| size | 428,456 |
The TURN Server is a VoIP media traffic NAT traversal server and gateway.
A pure Rust implementation of a forwarding server leverages Rust's memory and concurrency safety to process 40 million channel data forwarding messages and 600,000 allocation requests per second within a single thread (excluding network stack overhead). Forwarding latency remains below 35 microseconds (equivalent to a complete local network send/receive delay between points A and B). This project prioritizes core functionality, requiring minimal configuration for use and offering near-out-of-the-box usability.
This is a very lightweight implementation, and turn-rs will get your data flowing quickly if you only start the basic functionality, and while it uses pre-allocated memory in many places to cope with bursty performance, it generally performs well (it delivers very high-speed forwarding performance on my Raspberry Pi 4 as well as still performs well in the face of a large number of clients).
If you only need a pure turn server to cope with WebRTC business and require excellent forwarding performance, the current project will satisfy you.
First of all, I remain in awe and respect for coturn, which is a much more mature implementation and has very comprehensive support for a wide range of features.
However, turn-rs is not a simple duplicate implementation, and this project is not a blind “RIIR”. Because turn server is currently the largest use of the scene or WebRTC, for WebRTC business, many features are not too much necessary, so keep it simple and fast is the best choice.
First, Get the compiled binaries from github release.
Start with configuration file:
turn-server --config=/etc/turn-server/config.toml
Please check the example configuration file for details: turn-server.toml
docker pull ghcr.io/mycrl/turn-server
The custom configuration file overrides the /etc/turn-server/config.toml path inside the image through -v.
./install-service.sh
This will compile the project and install and start the service.
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
Compile the entire workspace in release mode:
cd turn-rs
cargo build --release
If you don't need a particular feature, you can reduce the package size by enabling only the features you require.
udp - (enabled by default) Enables UDP transport layer support.tcp - Enables TCP transport layer support.ssl - Enable SSL encryption support.grpc - Enable the GRPC server feature.All features are enabled by default.
cargo build --release
After the compilation is complete, you can find the binary file in the "target/release" directory.
MIT Copyright (c) 2022 Mr.Panda.