OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 thread_->socketserver()->CreateAsyncSocket(SOCK_STREAM); | 90 thread_->socketserver()->CreateAsyncSocket(SOCK_STREAM); |
91 if (proto == cricket::PROTO_TLS) { | 91 if (proto == cricket::PROTO_TLS) { |
92 // For TLS, wrap the TCP socket with an SSL adapter. The adapter must | 92 // For TLS, wrap the TCP socket with an SSL adapter. The adapter must |
93 // be configured with a self-signed certificate for testing. | 93 // be configured with a self-signed certificate for testing. |
94 // Additionally, the client will not present a valid certificate, so we | 94 // Additionally, the client will not present a valid certificate, so we |
95 // must not fail when checking the peer's identity. | 95 // must not fail when checking the peer's identity. |
96 rtc::SSLAdapter* adapter = rtc::SSLAdapter::Create(socket); | 96 rtc::SSLAdapter* adapter = rtc::SSLAdapter::Create(socket); |
97 adapter->SetRole(rtc::SSL_SERVER); | 97 adapter->SetRole(rtc::SSL_SERVER); |
98 adapter->SetIdentity( | 98 adapter->SetIdentity( |
99 rtc::SSLIdentity::Generate("test turn server", rtc::KeyParams())); | 99 rtc::SSLIdentity::Generate("test turn server", rtc::KeyParams())); |
100 adapter->set_ignore_bad_cert(true); | 100 adapter->SetIgnoreBadCert(true); |
101 socket = adapter; | 101 socket = adapter; |
102 } | 102 } |
103 socket->Bind(int_addr); | 103 socket->Bind(int_addr); |
104 socket->Listen(5); | 104 socket->Listen(5); |
105 server_.AddInternalServerSocket(socket, proto); | 105 server_.AddInternalServerSocket(socket, proto); |
106 } else { | 106 } else { |
107 RTC_NOTREACHED() << "Unknown protocol type: " << proto; | 107 RTC_NOTREACHED() << "Unknown protocol type: " << proto; |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
(...skipping 18 matching lines...) Expand all Loading... |
129 return ComputeStunCredentialHash(username, realm, username, key); | 129 return ComputeStunCredentialHash(username, realm, username, key); |
130 } | 130 } |
131 | 131 |
132 TurnServer server_; | 132 TurnServer server_; |
133 rtc::Thread* thread_; | 133 rtc::Thread* thread_; |
134 }; | 134 }; |
135 | 135 |
136 } // namespace cricket | 136 } // namespace cricket |
137 | 137 |
138 #endif // WEBRTC_P2P_BASE_TESTTURNSERVER_H_ | 138 #endif // WEBRTC_P2P_BASE_TESTTURNSERVER_H_ |
OLD | NEW |