Welcome
XTurn is an open-source TURN server written in Elixir by the guys at Xirsys. This server runs quite fast, but has never run in a production environment. The purpose of this project is two-fold:
- Provide a simply made TURN server that can be customised by the WebRTC community however it chooses.
- Provide a WebRTC framework for integration into the Membrane Project.
Supported Features
- TCP, UDP, TLS and DTLS supported
- Full TURN RFC5766 support (except rotating nonce)
- Full STUN RFC3489 support
- Simple user / pass storage with Web API interface
- Channel Binding / Data IS supported!
- WebRTC Data Channels ARE supported!
Getting Started
Before running the server, you will need to ensure you have Elixir installed. The project is set up to create releases, which do not require Elixir installed on the host system, but this will need to be generated by yourself.
With Elixir installed, you then need to update the configuration found in config/config.exs
.
config :xturn,
authentication: %{required: false},
permissions: %{required: true},
realm: "xturn.com",
listen: [
{:udp, '0.0.0.0', 3478},
{:tcp, '0.0.0.0', 3478},
{:udp, '0.0.0.0', 5349, :secure},
{:tcp, '0.0.0.0', 5349, :secure}
],
server_ip: {127, 0, 0, 1},
server_local_ip: {0, 0, 0, 0},
certs: [
{:certfile, "certs/server.crt"},
{:keyfile, "certs/server.key"}
]
authentication: if required
is set to true, then connection to the TURN server will need valid credentials. Credentials can be set in the auth store
via the Maru API (described later).
permissions: if required
is set to true, peers will require valid TURN permissions before receiving data. This should be automatic in a WebRTC application.
realm: This value is used for authentication resolution. Change this to your own domain.
listen: This lists the ports the client endpoints will listen on. Each entry is a tuple of the form:
{protocol, ip_address, port, optional(secure)}
- protocol: Either udp or tcp. Provide entries for both for better network traversal support.
- ip_address: The IP address to bind to. ‘0.0.0.0’ binds to the first available local IP.
- port: The port to bind to. 3478 is the standard unsecured TURN port and 5349 is the standard for a secured TURN port. However, you may also wish to support 80 and 443, too.
- secure: If
:secure
is passed as the last item, then the port socket is opened using SSL (see certificates).
server_ip: The IP address to advertise in STUN/TURN packets.
server_local_ip: The IP used to open peer sockets.
certs: Used to provide certificate and key file paths to secure all SSL sockets.
With your config set, you can start the server in console mode with:
iex -S mix
A discussion on testing the server can be found here
Authentication
The XTurn server has now been simplified, as more complex authentication options will soon exist in plugin form. The new XTurn release supports a single authentication user / pass pair, which can be entered into the configuration as required. An authentication plugin providing a user creation / deletion endpoint will be available soon.
Creating a Release
Once you are able to run the XTurn server, you can package it for release by executing:
mix release
Once generated, the compiler will output the commands needed to execute the release on your server. Releases need to be generated on the same OS type as the deployment server.
Contributing
Xirsys is providing this project for the benefit of the WebRTC community. It is both a simple and efficient server and is much needed by the community. While the CoTurn project provides a great tool with outstanding features, it does not provide much help in supporting developers with understanding how TURN works or with a foundation for easily extending functionality for their own needs. Xirsys hopes to remedy this with XTurn.
In return for publishing this project, all Xirsys requires is some feedback and contribution where possible. If you have any ideas, benchmarks, new features or simply enough time to help work on our road map, please let us know. You can contact us directly at experts@xirsys.com
Copyright
XTurn is licensed by Xirsys under the Apache License, Version 2.0. See LICENSE in the Github repository for the full license text.