ubuntu turnserver

1.关联文件夹

/etc/turnserver.conf

/var/log/

/usr/bin/turnserver

/usr/share/coturn

/usr/share/coturn/examples/etc

turn_server_pkey.pem

turn_server_cert.pem

turn_client_pkey.pem

turn_client_cert.pem

 

2.turnserver.conf

-----

#listening-device

监听接口设备(网卡)

#listening-port=443

TCP,UDP的监听端口(默认是3478)

注意:如果通过配置许可的话,TLS&DTLS的会话也可以连接到普通的TCP&UDP端口。

例如可以把默认的端口设定为80或433,来通过一些严格的NATs。记住小于1024的端口需要超级用户的权限来启动turnsever线程。

#tls-listening-port=443

TLS,DTLS的监听端口(默认是5349)

#listening-ip=内网IP

中继服务器的监听器IP地址。可以设定多个地址。

如果没有被设定的话,所有的系统IPv4和IPv6的IP地址都被用于监听。

#relay-ip=内网IP

中继地址。内部IP地址被用于向各个peer转播数据包

#external-ip=外网IP

如果TURN服务器位于NAT后面的时候,公有IP/私有IP的映射。

#relay-threads=50

来处理已确定连接的中继转播的线程数量。

如果被设定成0,则为一个中继转播线程。如果没有被设定的话,则为CPU的数量。

#min-port=49152

中继终端配置的UDP范围的下界,默认是49152

#max-port=65535

中继终端配置的UDP范围的上界,默认是65535

#verbose

温和的冗长模式。显示详细信息,但是比Verbose模式少得多。

#fingerprint

在TURN信息里使用指纹。如果一个连入的请求里包含指纹,TURN服务器将不管单个服务器怎么设定,会在这个会话的所有信息里加入指纹。

#lt-cred-mech

长期(long-term)认证机制。(使用WebRTC时需要设定)

#user=user:key

长期认证机制的账户。key可以是用户密码,也可以用turnadmin生成。用turnadmin生成的时候,key的前面必须加上0x,key通过用户名,领域和用户密码生成的。所以如果领域变化了的话,所有用户的key都需要重新设定。

#realm=abc.com

当在数据库中找不到明确的起点/领域的关系时,使用改设定作为用户的领域。必须和长期认证机制一起使用。

#cert=/etc/turn_server_cert.pem

证书文件,PEM格式。如果no-tls和no-dtls都被设定的时候,这个参数不需要。

#pkey=/etc/turn_server_pkey.pem

私钥文件,PEM格式。

#no-loopback-peers

不允许回送地址上的连接(127.xx.xx.xx or ::1)

#pidfile="/var/run/turnserver.pid"

保存进程PID的文件。

#mobility

支持移动的ICE(MICE)规格

#no-cli

关闭CLI支持。默认是打开的,支持远程登陆客户端连接127.0.0.1:5766。

-----

参考:

1.<https://github.com/coturn/coturn/wiki/turnserver>

2.

OK So from you answers it is likely that there are 2 reasons why this is not working.

通过你的回答,看似有两个原因:

1. TCP port (80) you are using for TURN is open to the browser with using the proxy

用于访问TURN的端口80,通过代理对浏览器开放

If this is the case the WebRTC ICE process TURN connection to port 80 will likely test OK. If it does, it will not use the web proxy. 

如果是这种情况,WebRTC ICE将通过80端口正常访问TURN,它将不使用网络代理。

To tell if this is the case you need to know the external addresses of the web proxy and the default router at network A. 

如果是这种情况,你需要知道网络代理的外部IP地址和A的默认路由。

Then check the TURN logs to see if any connection attempt came.   

之后查看TURN的日志看是否有连接访问

 

2. The web proxy is not configured to support CONNECT on port 80

网络代理没有被配置成支持80端口的连接

This is most likely the case. 

很有可能是这种情况。

If the connection to TURN has no path other than through the web proxy, 

如果对TURN的连接,只能通过网络代理而没有别的路经

the browser will try to set up a tunnel to the TURN server through web proxy. 

浏览器将试图通过网络代理,和TURN服务器建立通道。

This requires the connect method. 

这个需要连接方法。

Most proxies would not have that enabled for port 80. 

大多数的代理将不会为80端口启用这个。

In Squid for example the default config is to only support CONNECT on ports defined as SSL. Other proxies are similar.  

默认配置只会支持被定义成SSL的连接,

Don't be fooled by the browser being able to just load the TURN server default page on port 80 through the proxy. 

不要被浏览器通过代理的80端口能访问TURN服务器的默认页面而欺骗。

That is a standard HTTP request, not the type used to connect to TURN.

这个是标准的HTTP请求,不是用于连接TURN的连接类型

 

I understand now i have to use 443 CONNECT method with SSL/TLS (and drop the use case of 80 in such environment, because there only CONNECT method should work)

我懂了,只能通过SSL/TLS的443端口连接方法(并且放弃80端口,因为只有连接方法能访问)

 

---

猜你喜欢

转载自stef.iteye.com/blog/2403910
今日推荐