Refactor "secure bool" into explicit PROTO_TLS.
BUG=none Review-Url: https://codereview.webrtc.org/2568833002 Cr-Commit-Position: refs/heads/master@{#15572}
This commit is contained in:
parent
1c4b5bcd6f
commit
277b250936
@ -285,7 +285,7 @@ bool ParseIceServerUrl(const PeerConnectionInterface::IceServer& server,
|
||||
int port = kDefaultStunPort;
|
||||
if (service_type == TURNS) {
|
||||
port = kDefaultStunTlsPort;
|
||||
turn_transport_type = cricket::PROTO_TCP;
|
||||
turn_transport_type = cricket::PROTO_TLS;
|
||||
}
|
||||
|
||||
std::string address;
|
||||
@ -306,10 +306,8 @@ bool ParseIceServerUrl(const PeerConnectionInterface::IceServer& server,
|
||||
break;
|
||||
case TURN:
|
||||
case TURNS: {
|
||||
bool secure = (service_type == TURNS);
|
||||
turn_servers->push_back(
|
||||
cricket::RelayServerConfig(address, port, username, server.password,
|
||||
turn_transport_type, secure));
|
||||
turn_servers->push_back(cricket::RelayServerConfig(
|
||||
address, port, username, server.password, turn_transport_type));
|
||||
break;
|
||||
}
|
||||
case INVALID:
|
||||
|
||||
@ -2648,13 +2648,13 @@ TEST_F(IceServerParsingTest, ParseStunPrefixes) {
|
||||
EXPECT_TRUE(ParseUrl("turn:hostname"));
|
||||
EXPECT_EQ(0U, stun_servers_.size());
|
||||
EXPECT_EQ(1U, turn_servers_.size());
|
||||
EXPECT_FALSE(turn_servers_[0].ports[0].secure);
|
||||
EXPECT_EQ(cricket::PROTO_UDP, turn_servers_[0].ports[0].proto);
|
||||
turn_servers_.clear();
|
||||
|
||||
EXPECT_TRUE(ParseUrl("turns:hostname"));
|
||||
EXPECT_EQ(0U, stun_servers_.size());
|
||||
EXPECT_EQ(1U, turn_servers_.size());
|
||||
EXPECT_TRUE(turn_servers_[0].ports[0].secure);
|
||||
EXPECT_EQ(cricket::PROTO_TLS, turn_servers_[0].ports[0].proto);
|
||||
turn_servers_.clear();
|
||||
|
||||
// invalid prefixes
|
||||
@ -2669,7 +2669,7 @@ TEST_F(IceServerParsingTest, VerifyDefaults) {
|
||||
EXPECT_TRUE(ParseUrl("turns:hostname"));
|
||||
EXPECT_EQ(1U, turn_servers_.size());
|
||||
EXPECT_EQ(5349, turn_servers_[0].ports[0].address.port());
|
||||
EXPECT_EQ(cricket::PROTO_TCP, turn_servers_[0].ports[0].proto);
|
||||
EXPECT_EQ(cricket::PROTO_TLS, turn_servers_[0].ports[0].proto);
|
||||
turn_servers_.clear();
|
||||
|
||||
// TURN defaults
|
||||
|
||||
@ -181,10 +181,10 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) {
|
||||
VerifyStunServers(stun_servers);
|
||||
std::vector<cricket::RelayServerConfig> turn_servers;
|
||||
cricket::RelayServerConfig turn1("test.com", 1234, "test@hello.com",
|
||||
kTurnPassword, cricket::PROTO_UDP, false);
|
||||
kTurnPassword, cricket::PROTO_UDP);
|
||||
turn_servers.push_back(turn1);
|
||||
cricket::RelayServerConfig turn2("hello.com", kDefaultStunPort, "test",
|
||||
kTurnPassword, cricket::PROTO_TCP, false);
|
||||
kTurnPassword, cricket::PROTO_TCP);
|
||||
turn_servers.push_back(turn2);
|
||||
VerifyTurnServers(turn_servers);
|
||||
}
|
||||
@ -211,10 +211,10 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) {
|
||||
VerifyStunServers(stun_servers);
|
||||
std::vector<cricket::RelayServerConfig> turn_servers;
|
||||
cricket::RelayServerConfig turn1("test.com", 1234, "test@hello.com",
|
||||
kTurnPassword, cricket::PROTO_UDP, false);
|
||||
kTurnPassword, cricket::PROTO_UDP);
|
||||
turn_servers.push_back(turn1);
|
||||
cricket::RelayServerConfig turn2("hello.com", kDefaultStunPort, "test",
|
||||
kTurnPassword, cricket::PROTO_TCP, false);
|
||||
kTurnPassword, cricket::PROTO_TCP);
|
||||
turn_servers.push_back(turn2);
|
||||
VerifyTurnServers(turn_servers);
|
||||
}
|
||||
@ -236,7 +236,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingNoUsernameInUri) {
|
||||
ASSERT_TRUE(pc.get() != NULL);
|
||||
std::vector<cricket::RelayServerConfig> turn_servers;
|
||||
cricket::RelayServerConfig turn("test.com", 1234, kTurnUsername,
|
||||
kTurnPassword, cricket::PROTO_UDP, false);
|
||||
kTurnPassword, cricket::PROTO_UDP);
|
||||
turn_servers.push_back(turn);
|
||||
VerifyTurnServers(turn_servers);
|
||||
}
|
||||
@ -257,7 +257,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingTurnUrlWithTransportParam) {
|
||||
ASSERT_TRUE(pc.get() != NULL);
|
||||
std::vector<cricket::RelayServerConfig> turn_servers;
|
||||
cricket::RelayServerConfig turn("hello.com", kDefaultStunPort, "test",
|
||||
kTurnPassword, cricket::PROTO_TCP, false);
|
||||
kTurnPassword, cricket::PROTO_TCP);
|
||||
turn_servers.push_back(turn);
|
||||
VerifyTurnServers(turn_servers);
|
||||
}
|
||||
@ -282,15 +282,15 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingSecureTurnUrl) {
|
||||
ASSERT_TRUE(pc.get() != NULL);
|
||||
std::vector<cricket::RelayServerConfig> turn_servers;
|
||||
cricket::RelayServerConfig turn1("hello.com", kDefaultStunTlsPort, "test",
|
||||
kTurnPassword, cricket::PROTO_TCP, true);
|
||||
kTurnPassword, cricket::PROTO_TLS);
|
||||
turn_servers.push_back(turn1);
|
||||
// TURNS with transport param should be default to tcp.
|
||||
cricket::RelayServerConfig turn2("hello.com", 443, "test_no_transport",
|
||||
kTurnPassword, cricket::PROTO_TCP, true);
|
||||
kTurnPassword, cricket::PROTO_TLS);
|
||||
turn_servers.push_back(turn2);
|
||||
cricket::RelayServerConfig turn3("hello.com", kDefaultStunTlsPort,
|
||||
"test_no_transport", kTurnPassword,
|
||||
cricket::PROTO_TCP, true);
|
||||
cricket::PROTO_TLS);
|
||||
turn_servers.push_back(turn3);
|
||||
VerifyTurnServers(turn_servers);
|
||||
}
|
||||
@ -328,7 +328,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIPLiteralAddress) {
|
||||
|
||||
std::vector<cricket::RelayServerConfig> turn_servers;
|
||||
cricket::RelayServerConfig turn1("2401:fa00:4::", 1234, "test", kTurnPassword,
|
||||
cricket::PROTO_UDP, false);
|
||||
cricket::PROTO_UDP);
|
||||
turn_servers.push_back(turn1);
|
||||
VerifyTurnServers(turn_servers);
|
||||
}
|
||||
|
||||
@ -1034,7 +1034,8 @@ bool ParseCandidate(const std::string& message, Candidate* candidate,
|
||||
SocketAddress address(connection_address, port);
|
||||
|
||||
cricket::ProtocolType protocol;
|
||||
if (!StringToProto(transport.c_str(), &protocol)) {
|
||||
if (!StringToProto(transport.c_str(), &protocol) ||
|
||||
protocol == cricket::PROTO_TLS) {
|
||||
return ParseFailed(first_line, "Unsupported transport type.", error);
|
||||
}
|
||||
|
||||
|
||||
@ -1487,7 +1487,7 @@ class WebRtcSessionTest
|
||||
cricket::RelayCredentials credentials(kTurnUsername, kTurnPassword);
|
||||
turn_server.credentials = credentials;
|
||||
turn_server.ports.push_back(
|
||||
cricket::ProtocolAddress(kTurnUdpIntAddr, cricket::PROTO_UDP, false));
|
||||
cricket::ProtocolAddress(kTurnUdpIntAddr, cricket::PROTO_UDP));
|
||||
allocator_->AddTurnServer(turn_server);
|
||||
allocator_->set_step_delay(cricket::kMinimumStepDelay);
|
||||
allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP);
|
||||
|
||||
@ -142,11 +142,11 @@ cricket::BasicPortAllocator* CreateBasicPortAllocator(
|
||||
turn_server.credentials = kRelayCredentials;
|
||||
if (!turn_server_udp.IsNil()) {
|
||||
turn_server.ports.push_back(
|
||||
cricket::ProtocolAddress(turn_server_udp, cricket::PROTO_UDP, false));
|
||||
cricket::ProtocolAddress(turn_server_udp, cricket::PROTO_UDP));
|
||||
}
|
||||
if (!turn_server_tcp.IsNil()) {
|
||||
turn_server.ports.push_back(
|
||||
cricket::ProtocolAddress(turn_server_tcp, cricket::PROTO_TCP, false));
|
||||
cricket::ProtocolAddress(turn_server_tcp, cricket::PROTO_TCP));
|
||||
}
|
||||
std::vector<cricket::RelayServerConfig> turn_servers(1, turn_server);
|
||||
|
||||
@ -2253,8 +2253,7 @@ TEST_F(P2PTransportChannelMultihomedTest, TestFailoverWithManyConnections) {
|
||||
test_turn_server()->AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
|
||||
RelayServerConfig turn_server(RELAY_TURN);
|
||||
turn_server.credentials = kRelayCredentials;
|
||||
turn_server.ports.push_back(
|
||||
ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP, false));
|
||||
turn_server.ports.push_back(ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP));
|
||||
GetAllocator(0)->AddTurnServer(turn_server);
|
||||
GetAllocator(1)->AddTurnServer(turn_server);
|
||||
// Enable IPv6
|
||||
@ -4367,7 +4366,7 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest, TestTcpTurn) {
|
||||
turn_server()->AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
|
||||
RelayServerConfig config(RELAY_TURN);
|
||||
config.credentials = kRelayCredentials;
|
||||
config.ports.push_back(ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP, false));
|
||||
config.ports.push_back(ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP));
|
||||
allocator()->AddTurnServer(config);
|
||||
|
||||
P2PTransportChannel& ch = StartTransportChannel(true, 100);
|
||||
|
||||
@ -89,10 +89,11 @@ const char RELAY_PORT_TYPE[] = "relay";
|
||||
const char UDP_PROTOCOL_NAME[] = "udp";
|
||||
const char TCP_PROTOCOL_NAME[] = "tcp";
|
||||
const char SSLTCP_PROTOCOL_NAME[] = "ssltcp";
|
||||
const char TLS_PROTOCOL_NAME[] = "tls";
|
||||
|
||||
static const char* const PROTO_NAMES[] = { UDP_PROTOCOL_NAME,
|
||||
TCP_PROTOCOL_NAME,
|
||||
SSLTCP_PROTOCOL_NAME };
|
||||
static const char* const PROTO_NAMES[] = {UDP_PROTOCOL_NAME, TCP_PROTOCOL_NAME,
|
||||
SSLTCP_PROTOCOL_NAME,
|
||||
TLS_PROTOCOL_NAME};
|
||||
|
||||
const char* ProtoToString(ProtocolType proto) {
|
||||
return PROTO_NAMES[proto];
|
||||
|
||||
@ -81,14 +81,9 @@ enum RelayType {
|
||||
};
|
||||
|
||||
enum IcePriorityValue {
|
||||
// The reason we are choosing Relay preference 2 is because, we can run
|
||||
// Relay from client to server on UDP/TCP/TLS. To distinguish the transport
|
||||
// protocol, we prefer UDP over TCP over TLS.
|
||||
// For UDP ICE_TYPE_PREFERENCE_RELAY will be 2.
|
||||
// For TCP ICE_TYPE_PREFERENCE_RELAY will be 1.
|
||||
// For TLS ICE_TYPE_PREFERENCE_RELAY will be 0.
|
||||
// Check turnport.cc for setting these values.
|
||||
ICE_TYPE_PREFERENCE_RELAY = 2,
|
||||
ICE_TYPE_PREFERENCE_RELAY_TLS = 0,
|
||||
ICE_TYPE_PREFERENCE_RELAY_TCP = 1,
|
||||
ICE_TYPE_PREFERENCE_RELAY_UDP = 2,
|
||||
ICE_TYPE_PREFERENCE_PRFLX_TCP = 80,
|
||||
ICE_TYPE_PREFERENCE_HOST_TCP = 90,
|
||||
ICE_TYPE_PREFERENCE_SRFLX = 100,
|
||||
@ -102,15 +97,12 @@ bool StringToProto(const char* value, ProtocolType* proto);
|
||||
struct ProtocolAddress {
|
||||
rtc::SocketAddress address;
|
||||
ProtocolType proto;
|
||||
bool secure;
|
||||
|
||||
ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p)
|
||||
: address(a), proto(p), secure(false) { }
|
||||
ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, bool sec)
|
||||
: address(a), proto(p), secure(sec) { }
|
||||
: address(a), proto(p) {}
|
||||
|
||||
bool operator==(const ProtocolAddress& o) const {
|
||||
return address == o.address && proto == o.proto && secure == o.secure;
|
||||
return address == o.address && proto == o.proto;
|
||||
}
|
||||
bool operator!=(const ProtocolAddress& o) const { return !(*this == o); }
|
||||
};
|
||||
|
||||
@ -543,27 +543,44 @@ class PortTest : public testing::Test, public sigslot::has_slots<> {
|
||||
}
|
||||
static const char* StunName(NATType type) {
|
||||
switch (type) {
|
||||
case NAT_OPEN_CONE: return "stun(open cone)";
|
||||
case NAT_ADDR_RESTRICTED: return "stun(addr restricted)";
|
||||
case NAT_PORT_RESTRICTED: return "stun(port restricted)";
|
||||
case NAT_SYMMETRIC: return "stun(symmetric)";
|
||||
default: return "stun(?)";
|
||||
case NAT_OPEN_CONE:
|
||||
return "stun(open cone)";
|
||||
case NAT_ADDR_RESTRICTED:
|
||||
return "stun(addr restricted)";
|
||||
case NAT_PORT_RESTRICTED:
|
||||
return "stun(port restricted)";
|
||||
case NAT_SYMMETRIC:
|
||||
return "stun(symmetric)";
|
||||
default:
|
||||
return "stun(?)";
|
||||
}
|
||||
}
|
||||
static const char* RelayName(RelayType type, ProtocolType proto) {
|
||||
if (type == RELAY_TURN) {
|
||||
switch (proto) {
|
||||
case PROTO_UDP: return "turn(udp)";
|
||||
case PROTO_TCP: return "turn(tcp)";
|
||||
case PROTO_SSLTCP: return "turn(ssltcp)";
|
||||
default: return "turn(?)";
|
||||
case PROTO_UDP:
|
||||
return "turn(udp)";
|
||||
case PROTO_TCP:
|
||||
return "turn(tcp)";
|
||||
case PROTO_SSLTCP:
|
||||
return "turn(ssltcp)";
|
||||
case PROTO_TLS:
|
||||
return "turn(tls)";
|
||||
default:
|
||||
return "turn(?)";
|
||||
}
|
||||
} else {
|
||||
switch (proto) {
|
||||
case PROTO_UDP: return "gturn(udp)";
|
||||
case PROTO_TCP: return "gturn(tcp)";
|
||||
case PROTO_SSLTCP: return "gturn(ssltcp)";
|
||||
default: return "gturn(?)";
|
||||
case PROTO_UDP:
|
||||
return "gturn(udp)";
|
||||
case PROTO_TCP:
|
||||
return "gturn(tcp)";
|
||||
case PROTO_SSLTCP:
|
||||
return "gturn(ssltcp)";
|
||||
case PROTO_TLS:
|
||||
return "gturn(tls)";
|
||||
default:
|
||||
return "gturn(?)";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2377,7 +2394,7 @@ TEST_F(PortTest, TestConnectionPriority) {
|
||||
lport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_HOST);
|
||||
std::unique_ptr<TestPort> rport(
|
||||
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
|
||||
rport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_RELAY);
|
||||
rport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_RELAY_UDP);
|
||||
lport->set_component(123);
|
||||
lport->AddCandidateAddress(SocketAddress("192.168.1.4", 1234));
|
||||
rport->set_component(23);
|
||||
|
||||
@ -115,16 +115,27 @@ typedef std::vector<ProtocolAddress> PortList;
|
||||
struct RelayServerConfig {
|
||||
RelayServerConfig(RelayType type) : type(type) {}
|
||||
|
||||
RelayServerConfig(const std::string& address,
|
||||
int port,
|
||||
const std::string& username,
|
||||
const std::string& password,
|
||||
ProtocolType proto)
|
||||
: type(RELAY_TURN), credentials(username, password) {
|
||||
ports.push_back(ProtocolAddress(rtc::SocketAddress(address, port), proto));
|
||||
}
|
||||
|
||||
// Legacy constructor where "secure" and PROTO_TCP implies PROTO_TLS.
|
||||
RelayServerConfig(const std::string& address,
|
||||
int port,
|
||||
const std::string& username,
|
||||
const std::string& password,
|
||||
ProtocolType proto,
|
||||
bool secure)
|
||||
: type(RELAY_TURN), credentials(username, password) {
|
||||
ports.push_back(
|
||||
ProtocolAddress(rtc::SocketAddress(address, port), proto, secure));
|
||||
}
|
||||
: RelayServerConfig(address,
|
||||
port,
|
||||
username,
|
||||
password,
|
||||
(proto == PROTO_TCP && secure ? PROTO_TLS : proto)) {}
|
||||
|
||||
bool operator==(const RelayServerConfig& o) const {
|
||||
return type == o.type && ports == o.ports && credentials == o.credentials &&
|
||||
|
||||
@ -30,8 +30,9 @@ class StunMessage;
|
||||
enum ProtocolType {
|
||||
PROTO_UDP,
|
||||
PROTO_TCP,
|
||||
PROTO_SSLTCP,
|
||||
PROTO_LAST = PROTO_SSLTCP
|
||||
PROTO_SSLTCP, // Pseudo-TLS.
|
||||
PROTO_TLS,
|
||||
PROTO_LAST = PROTO_TLS
|
||||
};
|
||||
|
||||
// Defines the interface for a port, which represents a local communication
|
||||
|
||||
@ -243,8 +243,8 @@ void RelayPort::SetReady() {
|
||||
// This is due to as mapped address stun attribute is used for allocated
|
||||
// address.
|
||||
AddAddress(iter->address, iter->address, rtc::SocketAddress(), proto_name,
|
||||
proto_name, "", RELAY_PORT_TYPE, ICE_TYPE_PREFERENCE_RELAY, 0,
|
||||
false);
|
||||
proto_name, "", RELAY_PORT_TYPE, ICE_TYPE_PREFERENCE_RELAY_UDP,
|
||||
0, false);
|
||||
}
|
||||
ready_ = true;
|
||||
SignalPortComplete(this);
|
||||
|
||||
@ -44,16 +44,16 @@ inline bool IsTurnChannelData(uint16_t msg_type) {
|
||||
return ((msg_type & 0xC000) == 0x4000); // MSB are 0b01
|
||||
}
|
||||
|
||||
static int GetRelayPreference(cricket::ProtocolType proto, bool secure) {
|
||||
int relay_preference = ICE_TYPE_PREFERENCE_RELAY;
|
||||
if (proto == cricket::PROTO_TCP) {
|
||||
relay_preference -= 1;
|
||||
if (secure)
|
||||
relay_preference -= 1;
|
||||
static int GetRelayPreference(cricket::ProtocolType proto) {
|
||||
switch (proto) {
|
||||
case cricket::PROTO_TCP:
|
||||
return ICE_TYPE_PREFERENCE_RELAY_TCP;
|
||||
case cricket::PROTO_TLS:
|
||||
return ICE_TYPE_PREFERENCE_RELAY_TLS;
|
||||
default:
|
||||
RTC_DCHECK(proto == PROTO_UDP);
|
||||
return ICE_TYPE_PREFERENCE_RELAY_UDP;
|
||||
}
|
||||
|
||||
ASSERT(relay_preference >= 0);
|
||||
return relay_preference;
|
||||
}
|
||||
|
||||
class TurnAllocateRequest : public StunRequest {
|
||||
@ -322,11 +322,13 @@ bool TurnPort::CreateTurnClientSocket() {
|
||||
if (server_address_.proto == PROTO_UDP && !SharedSocket()) {
|
||||
socket_ = socket_factory()->CreateUdpSocket(
|
||||
rtc::SocketAddress(ip(), 0), min_port(), max_port());
|
||||
} else if (server_address_.proto == PROTO_TCP) {
|
||||
} else if (server_address_.proto == PROTO_TCP ||
|
||||
server_address_.proto == PROTO_TLS) {
|
||||
ASSERT(!SharedSocket());
|
||||
int opts = rtc::PacketSocketFactory::OPT_STUN;
|
||||
// If secure bit is enabled in server address, use TLS over TCP.
|
||||
if (server_address_.secure) {
|
||||
|
||||
// Apply server address TLS and insecure bits to options.
|
||||
if (server_address_.proto == PROTO_TLS) {
|
||||
opts |= rtc::PacketSocketFactory::OPT_TLS;
|
||||
}
|
||||
socket_ = socket_factory()->CreateClientTcpSocket(
|
||||
@ -356,7 +358,8 @@ bool TurnPort::CreateTurnClientSocket() {
|
||||
|
||||
// TCP port is ready to send stun requests after the socket is connected,
|
||||
// while UDP port is ready to do so once the socket is created.
|
||||
if (server_address_.proto == PROTO_TCP) {
|
||||
if (server_address_.proto == PROTO_TCP ||
|
||||
server_address_.proto == PROTO_TLS) {
|
||||
socket_->SignalConnect.connect(this, &TurnPort::OnSocketConnect);
|
||||
socket_->SignalClose.connect(this, &TurnPort::OnSocketClose);
|
||||
} else {
|
||||
@ -652,8 +655,7 @@ bool TurnPort::SetAlternateServer(const rtc::SocketAddress& address) {
|
||||
<< "] to TURN server ["
|
||||
<< address.ToSensitiveString()
|
||||
<< "]";
|
||||
server_address_ = ProtocolAddress(address, server_address_.proto,
|
||||
server_address_.secure);
|
||||
server_address_ = ProtocolAddress(address, server_address_.proto);
|
||||
|
||||
// Insert the current address to prevent redirection pingpong.
|
||||
attempted_server_addresses_.insert(server_address_.address);
|
||||
@ -736,8 +738,7 @@ void TurnPort::OnAllocateSuccess(const rtc::SocketAddress& address,
|
||||
UDP_PROTOCOL_NAME,
|
||||
ProtoToString(server_address_.proto), // The first hop protocol.
|
||||
"", // TCP canddiate type, empty for turn candidates.
|
||||
RELAY_PORT_TYPE,
|
||||
GetRelayPreference(server_address_.proto, server_address_.secure),
|
||||
RELAY_PORT_TYPE, GetRelayPreference(server_address_.proto),
|
||||
server_priority_, true);
|
||||
}
|
||||
|
||||
|
||||
@ -80,6 +80,8 @@ static const cricket::ProtocolAddress kTurnUdpProtoAddr(
|
||||
kTurnUdpIntAddr, cricket::PROTO_UDP);
|
||||
static const cricket::ProtocolAddress kTurnTcpProtoAddr(
|
||||
kTurnTcpIntAddr, cricket::PROTO_TCP);
|
||||
static const cricket::ProtocolAddress kTurnTlsProtoAddr(kTurnTcpIntAddr,
|
||||
cricket::PROTO_TLS);
|
||||
static const cricket::ProtocolAddress kTurnUdpIPv6ProtoAddr(
|
||||
kTurnUdpIPv6IntAddr, cricket::PROTO_UDP);
|
||||
|
||||
@ -1027,8 +1029,8 @@ TEST_F(TurnPortTest, TestDestroyTurnConnectionUsingSharedSocket) {
|
||||
// Test that we fail to create a connection when we want to use TLS over TCP.
|
||||
// This test should be removed once we have TLS support.
|
||||
TEST_F(TurnPortTest, TestTurnTlsTcpConnectionFails) {
|
||||
ProtocolAddress secure_addr(kTurnTcpProtoAddr.address,
|
||||
kTurnTcpProtoAddr.proto, true);
|
||||
ProtocolAddress secure_addr(kTurnTlsProtoAddr.address,
|
||||
kTurnTlsProtoAddr.proto);
|
||||
CreateTurnPort(kTurnUsername, kTurnPassword, secure_addr);
|
||||
turn_port_->PrepareAddress();
|
||||
EXPECT_TRUE_SIMULATED_WAIT(turn_error_, kSimulatedRtt * 2, fake_clock_);
|
||||
|
||||
@ -192,10 +192,10 @@ class BasicPortAllocatorTest : public testing::Test,
|
||||
turn_server.credentials = credentials;
|
||||
|
||||
if (!udp_turn.IsNil()) {
|
||||
turn_server.ports.push_back(ProtocolAddress(udp_turn, PROTO_UDP, false));
|
||||
turn_server.ports.push_back(ProtocolAddress(udp_turn, PROTO_UDP));
|
||||
}
|
||||
if (!tcp_turn.IsNil()) {
|
||||
turn_server.ports.push_back(ProtocolAddress(tcp_turn, PROTO_TCP, false));
|
||||
turn_server.ports.push_back(ProtocolAddress(tcp_turn, PROTO_TCP));
|
||||
}
|
||||
allocator_->AddTurnServer(turn_server);
|
||||
}
|
||||
@ -1449,7 +1449,7 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithServerAddressResolve) {
|
||||
RelayCredentials credentials(kTurnUsername, kTurnPassword);
|
||||
turn_server.credentials = credentials;
|
||||
turn_server.ports.push_back(
|
||||
ProtocolAddress(rtc::SocketAddress("localhost", 3478), PROTO_UDP, false));
|
||||
ProtocolAddress(rtc::SocketAddress("localhost", 3478), PROTO_UDP));
|
||||
allocator_->AddTurnServer(turn_server);
|
||||
|
||||
allocator_->set_step_delay(kMinimumStepDelay);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user