当有非TURN连接候选者可用时,为什么选择TURN服务器?

时间:2020-08-25 17:43:49

标签: webrtc

我在同一网络上有两个客户端。它们具有相同的IP地址。当我启动它们之间的两个对等连接并等待ICE连接“连接”时,然后查看连接字符串并发现 TURN SERVER 是连接IP。如果我从ICE服务器列表中卸下TURN服务器,则连接有效,但最终使用其共享IP地址结束。因为我希望选择公共IP,所以这似乎是不可取的且不必要的。

为什么将TURN服务器列为连接IP?如何防止使用TURN服务器?

>它甚至被使用还是仅被用作连接字符串,而数据包实际上并没有经过它(从而使它们的成本为0)?

我还注意到我的TURN服务器目前正在使用非常少的CPU和带宽,因此我不确定它实际上是否在以任何方式使用。

如果我在VPN后面更改其中一个的公共IP地址,也会发生相同的情况:1.它们在服务器列表中有和没有TURN服务器的情况下都可以使用,但是2.在可用时选择TURN服务器。< / p>

这是在将转向服务器添加到ICE服务器列表中时ICE连接状态为“已连接”时我的候选项和连接的列表。

本地描述:

{
  "candidates": [
    [
      {
        "foundation": 175723363,
        "component": 1,
        "transport": "udp",
        "priority": 2122260223,
        "ip": "192.168.86.64",
        "port": 54234,
        "type": "host",
        "generation": 0,
        "network-id": 1,
        "network-cost": 50,
        "_priority": "126 | 32542 | 255"
      },
      {
        "foundation": 2335266263,
        "component": 1,
        "transport": "udp",
        "priority": 1686052607,
        "ip": "24.6.16.241", // Shared public IP address
        "port": 54234,
        "type": "srflx",
        "raddr": "192.168.86.64",
        "rport": 54234,
        "generation": 0,
        "network-id": 1,
        "network-cost": 50,
        "_priority": "100 | 32542 | 255"
      },
      {
        "foundation": 1157279635,
        "component": 1,
        "transport": "tcp",
        "priority": 1518280447,
        "ip": "192.168.86.64",
        "port": 63731,
        "type": "host",
        "tcptype": "passive",
        "generation": 0,
        "network-id": 1,
        "network-cost": 50,
        "_priority": "90 | 32542 | 255"
      },
      {
        "foundation": 1039353576,
        "component": 1,
        "transport": "udp",
        "priority": 41885439,
        "ip": "64.227.54.86", // IP Of the TURN Server
        "port": 46520,
        "type": "relay",
        "raddr": "24.6.16.241",
        "rport": 54234,
        "generation": 0,
        "network-id": 1,
        "network-cost": 50,
        "_priority": "2 | 32542 | 255"
      }
    ],
    null
  ],
  "connection": [
    {
      "version": 4,
      "ip": "64.227.54.86\\r\\n" // 
    },
    {
      "version": 4,
      "ip": "0.0.0.0\\r\\n"
    }
  ]
}

远程描述:

{
  "candidates": [
    [
      {
        "foundation": 3095129476,
        "component": 1,
        "transport": "udp",
        "priority": 2122260223,
        "ip": "192.168.86.70",
        "port": 51853,
        "type": "host",
        "generation": 0,
        "network-id": 1,
        "network-cost": 50,
        "_priority": "126 | 32542 | 255"
      }
    ],
    null
  ],
  "connection": [
    {
      "version": 4,
      "ip": "192.168.86.70\\r\\n"
    },
    {
      "version": 4,
      "ip": "0.0.0.0\\r\\n"
    }
  ]
}

这是将转弯服务器移至ICE服务器列表时ICE连接状态为“已连接”时我的候选项和连接的列表。

本地描述:

{
  "candidates": [
    [
      {
        "foundation": 175723363,
        "component": 1,
        "transport": "udp",
        "priority": 2122260223,
        "ip": "192.168.86.64",
        "port": 64340,
        "type": "host",
        "generation": 0,
        "network-id": 1,
        "network-cost": 50,
        "_priority": "126 | 32542 | 255"
      },
      {
        "foundation": 2335266263,
        "component": 1,
        "transport": "udp",
        "priority": 1686052607,
        "ip": "24.6.16.241",  // Shared public IP address
        "port": 64340,
        "type": "srflx",
        "raddr": "192.168.86.64",
        "rport": 64340,
        "generation": 0,
        "network-id": 1,
        "network-cost": 50,
        "_priority": "100 | 32542 | 255"
      }
    ],
    null
  ],
  "connection": [
    {
      "version": 4,
      "ip": "24.6.16.241\\r\\n"  // Shared public IP address
    },
    {
      "version": 4,
      "ip": "0.0.0.0\\r\\n"
    }
  ]
}

远程描述:

{
  "candidates": [
    null,
    null
  ],
  "connection": [
    {
      "version": 4,
      "ip": "0.0.0.0\\r\\n"
    },
    {
      "version": 4,
      "ip": "0.0.0.0\\r\\n"
    }
  ]
}

0 个答案:

没有答案