只是添加到伊戈尔的回答,
coturn
是rfc5766-turn-server
叉,核心功能是一样的,具有额外的功能,并添加了新的功能,所以我建议你使用它。
在作者自己的话说:
This project evolved from rfc5766-turn-server project (https://code.google.com/p/rfc5766-turn-server/). There are many new advanced TURN specs which are going far beyond the original RFC 5766 document. This project takes the code of rfc5766-turn-server as the starter, and adds new advanced features to it.
至于安装,很容易在Linux机器上,在其他操作系统没有尝试安装。
简单的方法:
sudo apt-get install coturn
如果你说没有,我想要最新的前沿,你可以从他们的downloads page下载源代码,自行安装,例如:
sudo -i # ignore if you already in admin mode
apt-get update && apt-get install libssl-dev libevent-dev libhiredis-dev make -y # install the dependencies
wget -O turn.tar.gz http://turnserver.open-sys.org/downloads/v4.5.0.6/turnserver-4.5.0.6.tar.gz # Download the source tar
tar -zxvf turn.tar.gz # unzip
cd turnserver-*
./configure
make && make install
为运行TURN,建议将其作为守护进程运行,并且可以使用此wiki作为配置参考。运行TURN服务器
样本命令:
sudo turnserver -a -o -v -n --no-dtls --no-tls -u test:test -r "someRealm"
命令描述:
- -a - 使用长期证书机制
- -o - 运行服务器进程作为守护
- -v - '中等'详细模式。
- -n - 没有配置文件
- --no-DTLS - 不要启动DTLS听众
- --no-TLS - 不要启动TLS听众
- -u - 使用
用户凭据
- -r - 默认领域使用,需要TURN REST API
现在你可以使用TURN服务器在您的WebRTC应用为:
var peerConnectionConfig = {
iceServers: [{
urls: YOUR_IP:3478,
username: 'test',
password: 'test'
}]
}
工作就像一个魅力! – Ernest
“someRealm”代表什么? – Loint
“someRealm”代表什么? –