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,若是打印出路徑,說明安裝成功git

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/github

relay地址回來的是你的ip纔算穿透成功。web

相關文章
相關標籤/搜索