環境準備
(1)準備一臺雲服務器,安裝Ubuntu18.04操作系統
(2)安裝coturn
sudo apt install coturn
文件配置
配置文件位置
/etc/turnserver.conf
修改內容:
listening-port=3478
external-ip=49.233.183.129
realm= 網址
user=用戶名:key
或
user=用戶名:密碼
啓動
turnserver
結果入下:
0: log file opened: /var/tmp/turn_29200_2020-04-17.log
0:
RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server
Version Coturn-4.5.0.7 'dan Eider'
0:
Max number of open files/sockets allowed for this process: 1048576
0:
Due to the open files/sockets limitation,
max supported number of TURN Sessions possible is: 524000 (approximately)
0:
==== Show him the instruments, Practical Frost: ====
0: TLS supported
0: DTLS supported
0: DTLS 1.2 supported
..........
..........
..........
0: Wait for relay ports initialization...
0: relay 172.21.0.4 initialization...
0: relay 172.21.0.4 initialization done
0: relay ::1 initialization...
0: relay ::1 initialization done
0: Relay ports initialization done
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=1 created
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=0 created
0: Total General servers: 2
0: IO method (admin thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: SQLite DB connection success: /var/lib/turn/turndb
測試
打開測試網址:
https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/