Skip to content

Instantly share code, notes, and snippets.

@zii
Last active December 8, 2018 06:25
Show Gist options
  • Save zii/ad934afcde009eaa0f6581f068d42734 to your computer and use it in GitHub Desktop.
Save zii/ad934afcde009eaa0f6581f068d42734 to your computer and use it in GitHub Desktop.
# 最简单的启动turnserver的命令(必须在公网)
turnserver -a -f --user=cat:111 -r wink.im
# 使用turns(TLS)
1. 生成证书
openssl genrsa -out turnserver_pkey.pem 2048
req -new -x509 -key turnserver_pkey.pem -out turnserver_cert.pem -days 3600
2. 启动
turnserver -a -f --user=cat:111 -r wink.im -v --cert ./turn_server_cert.pem --pkey ./turn_server_pkey.pem
# 测试方法
1. https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
2. 输入 turn:172.96.225.179 cat 123
3. 点[Gather Canditions]按钮 如果出现srflx和relay就算成功了.
# 测试能否视频
1. 打开两个浏览器选项卡, 访问https://appr.tc/r/071765449
2. 打开console
3. 输入 loadingParams.peerConnectionConfig.iceServers = [
{
'url': 'stun:172.96.225.179'
},
{
'url': 'turn:172.96.225.179',
'credential': '111',
'username': 'cat'
}
];
initialize();
4. 点Join
5. 看turnserver日志, 里面有动静就算成功了
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment