turn服务搭建记录

webrtc服务如果只是局域网内测试,可以不需要这个,但如果要放在外网就需要搭建 turn服务,今天在服务器上就尝试搭建了一下
ubuntu14.04

sudo apt-get install libssl-dev

sudo apt-get install libevent-dev

sudo apt-get install libpq-dev

sudo apt-get install mysql-client

sudo apt-get install libmysqlclient-dev

sudo apt-get install libhiredis-dev

sudo apt-get install git

sudo apt-get install make

安装 coturn

git clone https://github.com/coturn/coturn
cd coturn/
./configure --prefix=/alidata/soft
make
sudo make install

中间会碰见如果有依赖没有安装的话,就需要自己安装依赖

启动服务

这里就需要了解下区别 stun 和turn
https://developer.aliyun.com/article/243540

  • turn
turnserver -o -v -f -a -m 2 --max-bps=100000 --min-port=32355 --max-port=65535 --user=phz:1 -r phzled.cn -L your.ip


  • stun
 turnserver -o -f -v -a -m 2 --max-bps=100000 --min-port=32355 --max-port=65535 --user=phz:1 -r phzled.cn -X <public ip/ private ip> -X <public ip/ private ip>

参数说明

  • -o 以守护进程模式运行(后台运行)

  • -v 日志会以“适度详细”的程度来记录

  • -f 增加指纹机制。

  • -a 长期验证机制

  • -m 以x个进程来处理中继请求

  • –max-bps 带宽

  • –min-port 起始用的最小端口

  • –max-port 最大端口号

  • –user=帐号:密码 (随便写啥都行,记得住就行,turn服务的用户验证机制要用)

  • -r 领域(随便写啥都行)。如果turn服务器没有使用任何数据库/命令行/conf文件进行配置,就需要加这个选项,并且要配合long-term credentials(-a选项)使用

  • -L 监听IP(turn服务器的ip)这个ip是你ifconfig查到的ip,不是你的公网ip

  • -X 后面加 public ip/ private ip 多IP情况下使用,有几个ip就用几次

检测地址

https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/

免费stun服务列表

stun:stun1.l.google.com:19302
stun:stun2.l.google.com:19302
stun:stun3.l.google.com:19302
stun:stun4.l.google.com:19302
stun:23.21.150.121
stun:stun01.sipphone.com
stun:stun.ekiga.net
stun:stun.fwdnet.net
stun:stun.ideasip.com
stun:stun.iptel.org
stun:stun.rixtelecom.se
stun:stun.schlund.de
stun:stunserver.org
stun:stun.softjoys.com
stun:stun.voiparound.com
stun:stun.voipbuster.com
stun:stun.voipstunt.com
stun:stun.voxgratia.org
stun:stun.xten.com
``
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值