webRTC检查stun服务器是否正在使用
问题描述:
我决定创建我自己的STUN服务器,并将它与以下JS库https://simplewebrtc.com一起使用。webRTC检查stun服务器是否正在使用
我决定用这样的:http://www.stunprotocol.org/
我已经按照指示进行,这似乎是在服务器运行。 命令sudo lsof -i:3478
(3478为缺省端口)输出该:
stunserve 12856 user 3u IPv4 232305 0t0 UDP *:3478
我还修改了JS库根据该指示使用我的服务器:https://github.com/andyet/SimpleWebRTC(peerConnectionconfig
)。
peerConnectionConfig:{iceServers:[{urls:"stun:myServerHost:3478"}]}
但是,当我使用tcpdump捕获服务器上的流量时,没有捕获任何东西,就像服务器没有被使用。如果配置了这台服务器,那么使用哪台服务器?
答
其实配置是这样的:
{ iceServers: [
{
"url": "stun:your.stun.server"
, "username": "user"
, "credential": "password"
}
]}
凭证都是可选的。你可以使用https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/来测试你的stun服务器。
您可以使用'--verbosity 4'命令行参数运行特技人员以查看所有服务器流量。 – selbie