WEBRTC STUN stun.l.google.com:19302

我刚刚下载了一个video聊天项目。 它使用一个STUN服务器,并指定了URL的stun:23.21.150.121 。 我怎样才能使用我自己的服务器,而不是STUN服务器? 我必须input什么,而不是这个url?

其实没有必要设置你自己的STUN或TURN服务器,因为有很多公共/半公共服务器。 来自谷歌的STUN并不总是很好。

这是我最近的validation清单(不要忘了stun:/ turn:URL中的scheme):

 {url:'stun:stun01.sipphone.com'}, {url:'stun:stun.ekiga.net'}, {url:'stun:stun.fwdnet.net'}, {url:'stun:stun.ideasip.com'}, {url:'stun:stun.iptel.org'}, {url:'stun:stun.rixtelecom.se'}, {url:'stun:stun.schlund.de'}, {url:'stun:stun.l.google.com:19302'}, {url:'stun:stun1.l.google.com:19302'}, {url:'stun:stun2.l.google.com:19302'}, {url:'stun:stun3.l.google.com:19302'}, {url:'stun:stun4.l.google.com:19302'}, {url:'stun:stunserver.org'}, {url:'stun:stun.softjoys.com'}, {url:'stun:stun.voiparound.com'}, {url:'stun:stun.voipbuster.com'}, {url:'stun:stun.voipstunt.com'}, {url:'stun:stun.voxgratia.org'}, {url:'stun:stun.xten.com'}, { url: 'turn:numb.viagenie.ca', credential: 'muazkh', username: 'webrtc@live.com' }, { url: 'turn:192.158.29.39:3478?transport=udp', credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=', username: '28224511:1379330808' }, { url: 'turn:192.158.29.39:3478?transport=tcp', credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=', username: '28224511:1379330808' } 

https://gist.github.com/yetithefoot/7592580

如果你需要自己的STUN服务器,你可以使用这个为Node.js写的,或者在这里find一些。

你也可以检查这个和这个页面以便更好地理解。

EmerCoin有大量的公共STUN服务器: http ://olegh.ftp.sh/public-stun.txt您可以使用其中任何一个。

这是在RTCPeerConnection初始化中configurationSTUN和TURN的新方法。 以下是apprtc.appspot.com的工作模式

 var peerConnectionConfig = { iceServers:[ {urls: ["turn:173.194.72.127:19305?transport=udp", "turn:[2404:6800:4008:C01::7F]:19305?transport=udp", "turn:173.194.72.127:443?transport=tcp", "turn:[2404:6800:4008:C01::7F]:443?transport=tcp" ], username:"CKjCuLwFEgahxNRjuTAYzc/s6OMT", credential:"u1SQDR/SQsPQIxXNWQT7czc/G4c=" }, {urls:["stun:stun.l.google.com:19302"]} ]}; 

更多信息在这里

有几个选项来build立你自己的昏迷服务器。 有rfc5766-turn-server 。 一旦你在你的服务器上设置它,你可以使用该服务器的IP地址和端口来设置它的监听。 你将需要一些基本的Linux系统pipe理员知识。