webrtc(coturn服务器搭建)

coturn服务器安装

1下载并安装libevent-2.0
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar zxvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable && ./configure
make && make install
2下载编译安装coturn
git clone https://github.com/coturn/coturn
cd coturn 
./configure 
make 
make install

输入which turnserver,如果打印出路径,说明安装成功

3 配置coturn
使用turnadmin生成安全访问密码
turnadmin -k -u username -r north.gov -p password
/usr/local/etc/turnserver.conf配置
#listening-ip与relay-ip采用内网ip,external-ip是外网的ip

listening-port=444 #监听端口
external-ip=210.21.53.158 #外网IP
verbose
fingerprint
lt-cred-mech
realm=test
user=username:生成的加密密码    #修改成自己的
user=username:password       #修改成自己的
stale-nonce
no-loopback-peers
no-multicast-peers
mobility
no-cli
4启动coturn
turnserver -o -a
5ICE测试

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

relay地址回来的是你的ip才算穿透成功。

posted @ 2019-08-22 08:47  _DC  阅读(2707)  评论(0编辑  收藏  举报