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:

  1. Provide a simply made TURN server that can be customised by the WebRTC community however it chooses.
  2. Provide a WebRTC framework for integration into the Membrane Project.

Supported Features

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)}

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

XTurn is licensed by Xirsys under the Apache License, Version 2.0. See LICENSE in the Github repository for the full license text.