Skip to content

geigev/docker-turn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ce3ea13 · Nov 9, 2017

History

11 Commits
Nov 9, 2017
Nov 9, 2017
Nov 9, 2017
Nov 8, 2017
Nov 9, 2017

Repository files navigation

docker-turn

This is a lightweight Stun/Turn server based on the COTURN project. It uses alpine as its base image and the coturn package from alpine's testing repo -- this should be updated when the coturn package is released into the main repo.

If you would like to test the file only locally, remove network_mode = "host" from the docker-compose.yml file.

The entry command uses the Turn-Rest API and time-limited credentials. You must generate these credentials yourself. Doing this in node.js looks something like this:

var crypto = require('crypto');

function getTURNCredentials(name, secret){    

    var unixTimeStamp = parseInt(Date.now()/1000) + 24*3600,   // this credential would be valid for the next 24 hours
        username = [unixTimeStamp, name].join(':'),
        password,
        hmac = crypto.createHmac('sha1', secret);
    hmac.setEncoding('base64');
    hmac.write(username);
    hmac.end();
    password = hmac.read();
    return {
        username: username,
        password: password
    };
}

About

A turn server in docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published