搭建turn打洞服务器

1.下载编译安装coturn

git clone https://github.com/coturn/coturn

cd coturn

./configure

make

sudo make install

遇到问题:

ERROR: Libevent2 development libraries are not installed properly in required location.

则运行如下命令:

apt-get install libevent-dev

2.查看是否安装成功

使用命令:which turnserver

3.签名证书

配置的自签名证书用Openssl命令生成:

openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/turnserver_pkey.pem -out /etc/turnserver_cert.pem -days 99999

4.查找配置文件,并修改配置文件

vim /etc/turnserver.conf

relay-device=eth0

listening-ip=192.168.2.14  // 内网IP

listening-port=3478

tls-listening-port=5349

relay-ip=192.168.2.14      // 内网IP

external-ip=220.22.76.57    // 外网IP

relay-threads=50

lt-cred-mech

Verbose

fingerprint

mobility

cert=/etc/turn_server_cert.pem

pkey=/etc/turn_server_pkey.pem

min-port=49152

max-port=65535

user=admin:123456

5.启动服务:

sudo turnserver -o -a -f –user=admin:123456 -r shanghai

6.启动janus服务器

./janus –stun-server=210.22.76.173:3478

在浏览器打开网址:220.22.76.57:3478, 看看效果如何

也可以通过下面验证打洞服务器

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

你可能感兴趣的:(搭建turn打洞服务器)