如果有多个选项,Chrome / webRTC如何select使用哪个TURN服务器?

将多个TURN选项传递给RTCPeerConnection时,假设其中有几个在技术上可用,如何select实际的服务器?

networking性能是否起作用?

ICE RFC不指定在多个TURN服务器可用时会发生什么情况:

本规范仅考虑使用单个STUN或TURN服务器。 当单个STUN或TURN服务器有多个select时(例如,当他们通过DNSlogging学习并返回多个结果时),一个代理应该使用一个STUN或TURN服务器(基于它的IP地址)一个特定会议的候选人。 这提高了ICE的性能。 结果是一组具有STUN或TURN服务器的主机候选对。 代理然后select一个对,并从该候选主机向服务器发送绑定或分配请求。

所以不应该期待任何特定的行为。

目前WebRTCselect符合给定条件的第一台服务器。 例如,第一个支持UDP连接的服务器。

basicportallocator.cc :

void AllocationSequence::CreateUDPPorts() { ... // If STUN is not disabled, setting stun server address to port. if (!IsFlagSet(PORTALLOCATOR_DISABLE_STUN)) { // If config has stun_address, use it to get server reflexive candidate // otherwise use first TURN server which supports UDP. if (config_ && !config_->stun_address.IsNil()) { LOG(LS_INFO) << "AllocationSequence: UDPPort will be handling the " << "STUN candidate generation."; port->set_server_addr(config_->stun_address); } else if (config_ && config_->SupportsProtocol(RELAY_TURN, PROTO_UDP)) { port->set_server_addr(config_->GetFirstRelayServerAddress( RELAY_TURN, PROTO_UDP)); LOG(LS_INFO) << "AllocationSequence: TURN Server address will be " << " used for generating STUN candidate."; } } ...