Skip to content
forked from pion/turn

Pion TURN server, a simple extendable Golang TURN server

License

Notifications You must be signed in to change notification settings

MehrshadFarahani/turn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pion TURN

Build Status GoDoc Go Report Card Coverage Status Codacy Badge License: MIT

A TURN server written in Go that is designed to be scalable, extendable and embeddable out of the box. For simple use cases it only requires downloading 1 static binary, and setting 3 options.

See DESIGN.md for the the features it offers, and future goals.

Getting Started

Quick Start

If you want just a simple TURN server with a few static usernames simple-turn will perfectly suit your purposes. If you have custom requirements such as a database proceed to extending.

simple-turn is a single static binary, and all config is driven by environment variables. On a fresh Linux AWS instance these are all the steps you would need.

$ wget -q https://github.com/pions/turn/releases/download/1.0.3/simple-turn-linux-amd64
$ chmod +x simple-turn-linux-amd64
$ export USERS="user=password foo=bar"
$ export REALM=my-server.com
$ export UDP_PORT=3478
$ ./simple-turn-linux-amd64

To explain what every step does

  • Download simple-turn for Linux x64, see release for other platforms
  • Make it executable
  • Configure auth, in the form of USERNAME=PASSWORD USERNAME=PASSWORD with no limits
  • Set your realm, this is the public URL or name of your server
  • Set the port you listen on, 3478 is the default port for TURN

That is it! Then to use your new TURN server your WebRTC config would look like

{ iceServers: [{
  urls: "turn:YOUR_SERVER"
  username: "user",
  credential: "password"
}]

If you are using Windows you would set these values in Powershell by doing. Also make sure your firewall is configured properly.

> $env:USERS = "user=password foo=bar"
> $env:REALM = "my-server.com"
> $env:UDP_PORT = 3478

Extending

See simple-turn

pion-turn can be configured by implementing these callbacks and by passing these arguments

All that simple-turn does is take environment variables, and then uses the same API.

Developing

For developing a Dockerfile is available with features like hot-reloads, and is meant to be volume mounted. Make sure you also have github.com/pions/pkg in your path, or you can exclude the second volume mount.

This is only meant for development, see demo-conference to see TURN usage as a user.

docker build -t turn .
docker run -v $(pwd):/usr/local/src/github.com/pions/turn -v $(pwd)/../pkg:/usr/local/src/github.com/pions/pkg turn

Currently only Linux is supported until Docker supports full (host <-> container) networking on Windows/OSX

RFCs

Implemented

Planned

Questions/Support

Sign up for the Golang Slack and join the #pion channel for discussions and support

Contributing

See CONTRIBUTING.md

Contributors

License

MIT License - see LICENSE.md for full text

About

Pion TURN server, a simple extendable Golang TURN server

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%