调试 AWS 托管的 Coturn 服务器 - TURN 工作正常,STUN 似乎不行

问题描述 投票:0回答:1

需要大量设置信息,最后会出现问题。
我在 AWS ubuntu 实例上托管 coturn 服务器。我在turnserver.conf中配置如下

listening-port=3478
external-ip=(external ip)/(internal ip)
relay-ip=(internal ip)
tls-listening-port=5349
verbose
realm=(realm name)
min-port=10000
max-port=20000
lt-cred-mech
user=(username):(password)

AWS 安全组: 端口 3478 和 5349 对来自所有 ipv4 和 ipv6 地址的 TCP 和 UDP 流量开放

我正在使用 Trickle ICE 测试此设置

结果

  1. 服务器地址 = "turn:(public ip):3478/?transport=tcp" 以及用户名 + 凭据。据我所知,这似乎有效。

客户端


Time    Type    Foundation  Protocol    Address Port    Priority    URL (if present)    relayProtocol (if present)
0.012   host    1419492315  udp e97c311c-26d9-4083-bfd9-bf004d561c76.local  65276   126 | 30 | 255      
0.124   relay   2654650372  udp (external ip)   16106   1 | 31 | 255    turn:(external ip):3478?transport=tcp   tcp
0.137   Done

服务器端

Jan 30 13:32:55 ip-(private ip) turnserver: 28: : session 000000000000000001: new, realm=<(realm name)>, username=<(username)>, lifetime=600
Jan 30 13:32:55 ip-(private ip) turnserver: 28: : session 000000000000000001: realm <(realm name)> user <(username)>: incoming packet ALLOCATE processed, success
Jan 30 13:32:55 ip-(private ip) turnserver: 28: : session 000000000000000001: refreshed, realm=<(realm name)>, username=<(username)>, lifetime=0
Jan 30 13:32:55 ip-(private ip) turnserver: 28: : session 000000000000000001: realm <(realm name)> user <(username)>: incoming packet REFRESH processed, success
Jan 30 13:32:55 ip-(private  ip) turnserver: 28: : session 000000000000000001: TCP socket closed remotely (client ip):43114
Jan 30 13:32:55 ip-(private ip) turnserver: 28: : session 000000000000000001: usage: realm=<(realm name)>, username=<(username)>, rp=3, rb=228, sp=3, sb=288
Jan 30 13:32:55 ip-(private ip) turnserver: 28: : session 000000000000000001: peer usage: realm=<(realm name)>, username=<(username)>, rp=0, rb=0, sp=0, sb=0
Jan 30 13:32:55 ip-(private ip) turnserver: 28: : session 000000000000000001: closed (2nd stage), user <(username)> realm <(realm name)> origin <>, local (internal ip):3478, remote (client ip):43114, reason: TCP connection closed by client (callback)
Jan 30 13:32:55 ip-(private  ip) turnserver: 28: : session 000000000000000001: delete: realm=<(realm name)>, username=<(username)>
  1. 服务器地址 = "turn:(public ip):3478" 以及用户名 + 凭据。我不知道这是否有效,有些事情似乎不对劲。

客户端

Time    Type    Foundation  Protocol    Address Port    Priority    URL (if present)    relayProtocol (if present)
0.008   host    3474466919  udp e97c311c-26d9-4083-bfd9-bf004d561c76.local  53711   126 | 30 | 255      
0.020   srflx   710326477   udp (client ip) 34426   100 | 30 | 255  stun:(external ip):3478 
0.100   relay   2859376398  udp (external ip)   14926   2 | 31 | 255    turn:(external ip):3478?transport=udp   udp
0.136   Done

服务器 stun:(external ip):3478 返回错误,代码=701: STUN 服务器地址不兼容。
服务器端

Jan 30 13:45:30 ip-(private ip) turnserver: 783: : session 000000000000000002: new, realm=<(realm name)>, username=<(username)>, lifetime=600
Jan 30 13:45:30 ip-(private ip) turnserver: 783: : session 000000000000000002: realm <(realm name)> user <(username)>: incoming packet ALLOCATE processed, success
Jan 30 13:45:30 ip-(private ip) turnserver: 783: : session 000000000000000002: refreshed, realm=<(realm name)>, username=<(username)>, lifetime=0
Jan 30 13:45:30 ip-(private ip) turnserver: 783: : session 000000000000000002: realm <(realm name)> user <(username)>: incoming packet REFRESH processed, success
Jan 30 13:45:31 ip-(private ip) turnserver: 784: : session 000000000000000002: usage: realm=<(realm name)>, username=<(username)>, rp=4, rb=248, sp=4, sb=384
Jan 30 13:45:31 ip-(private ip) turnserver: 784: : session 000000000000000002: peer usage: realm=<(realm name)>, username=<(username)>, rp=0, rb=0, sp=0, sb=0
Jan 30 13:45:31 ip-(private ip) turnserver: 784: : session 000000000000000002: closed (2nd stage), user <(username)> realm <(realm name)> origin <>, local (private ip):3478, remote (client ip):34426, reason: allocation timeout
Jan 30 13:45:31 ip-(private ip) turnserver: 784: : session 000000000000000002: delete: realm=<(realm name)>, username=<(username)>
  1. 服务器地址 = "stun:(外部ip):3478

客户端

Time    Type    Foundation  Protocol    Address Port    Priority    URL (if present)    relayProtocol (if present)
0.004   host    1256359617  udp e97c311c-26d9-4083-bfd9-bf004d561c76.local  62013   126 | 30 | 255      
0.021   srflx   2080670375  udp (client ip) 38039   100 | 30 | 255  stun:(external ip):3478 
0.127   Done

服务器 stun:13.51.165.213:3478 返回错误,代码=701: STUN 服务器地址不兼容。

服务器端

Jan 30 13:56:08 ip-(private ip) turnserver: 1421: : session 001000000000000001: realm <(realm name)> user <>: incoming packet BINDING processed, success

问题

  1. 为什么当我将参数 Transport=tcp 添加到 stun 地址时,行为会有所不同?似乎将其关闭不仅会导致客户端尝试连接到 STUN 服务器(并生成错误);还会导致客户端尝试连接 STUN 服务器。它还会产生不同的连接关闭原因(即客户端关闭 TCP 连接与分配超时)。
  2. 我应该指定 Transport=tcp 吗?当我添加它时,TURN 服务器似乎实际上工作正常。
  3. 我的 STUN 设置怎么了?据我所知,它似乎根本不起作用。

我尝试更改turnserver.conf的各个方面,但没有成功

webrtc stun turn coturn
1个回答
0
投票

正如滴冰页所说:

如果您测试 STUN 服务器,如果您可以收集具有以下类型的候选者,那么它就可以工作 “srflx”。如果您测试 TURN 服务器,如果您可以收集候选者,它就会起作用 类型为“继电器”。

这些你都有。它还说

注意:上面的 onicecandidateerror 错误不一定是致命的。为了 例如,IPv6 DNS 查找可能会失败,但仍然可以收集中继候选者 通过 IPv4。

这就是正在发生的事情。

请注意,您还需要打开 udp 的中继端口范围。

© www.soinside.com 2019 - 2024. All rights reserved.