Add config to to enable/disable permissions checks in EmulatedTURNServer
Bug: chromium:1024965 Change-Id: I91b8d29932f08b3011635e62a0879c645b89f106 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372260 Auto-Submit: Jonas Oreland <jonaso@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Jonas Oreland <jonaso@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43611}
This commit is contained in:
parent
35f73ddca4
commit
99dfa391ca
@ -92,6 +92,7 @@ struct EmulatedEndpointConfig {
|
|||||||
struct EmulatedTURNServerConfig {
|
struct EmulatedTURNServerConfig {
|
||||||
EmulatedEndpointConfig client_config;
|
EmulatedEndpointConfig client_config;
|
||||||
EmulatedEndpointConfig peer_config;
|
EmulatedEndpointConfig peer_config;
|
||||||
|
bool enable_permission_checks = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// EmulatedTURNServer is an abstraction for a TURN server.
|
// EmulatedTURNServer is an abstraction for a TURN server.
|
||||||
|
|||||||
@ -119,18 +119,21 @@ class EmulatedTURNServer::AsyncPacketSocketWrapper
|
|||||||
const rtc::SocketAddress local_address_;
|
const rtc::SocketAddress local_address_;
|
||||||
};
|
};
|
||||||
|
|
||||||
EmulatedTURNServer::EmulatedTURNServer(std::unique_ptr<rtc::Thread> thread,
|
EmulatedTURNServer::EmulatedTURNServer(const EmulatedTURNServerConfig& config,
|
||||||
|
std::unique_ptr<rtc::Thread> thread,
|
||||||
EmulatedEndpoint* client,
|
EmulatedEndpoint* client,
|
||||||
EmulatedEndpoint* peer)
|
EmulatedEndpoint* peer)
|
||||||
: thread_(std::move(thread)), client_(client), peer_(peer) {
|
: thread_(std::move(thread)), client_(client), peer_(peer) {
|
||||||
ice_config_.username = "keso";
|
ice_config_.username = "keso";
|
||||||
ice_config_.password = "keso";
|
ice_config_.password = "keso";
|
||||||
SendTask(thread_.get(), [this]() {
|
SendTask(thread_.get(), [this, enable_permission_checks =
|
||||||
|
config.enable_permission_checks]() {
|
||||||
RTC_DCHECK_RUN_ON(thread_.get());
|
RTC_DCHECK_RUN_ON(thread_.get());
|
||||||
turn_server_ = std::make_unique<cricket::TurnServer>(thread_.get());
|
turn_server_ = std::make_unique<cricket::TurnServer>(thread_.get());
|
||||||
turn_server_->set_realm(kTestRealm);
|
turn_server_->set_realm(kTestRealm);
|
||||||
turn_server_->set_realm(kTestSoftware);
|
turn_server_->set_realm(kTestSoftware);
|
||||||
turn_server_->set_auth_hook(this);
|
turn_server_->set_auth_hook(this);
|
||||||
|
turn_server_->set_enable_permission_checks(enable_permission_checks);
|
||||||
|
|
||||||
auto client_socket = Wrap(client_);
|
auto client_socket = Wrap(client_);
|
||||||
turn_server_->AddInternalSocket(client_socket, cricket::PROTO_UDP);
|
turn_server_->AddInternalSocket(client_socket, cricket::PROTO_UDP);
|
||||||
|
|||||||
@ -42,7 +42,8 @@ class EmulatedTURNServer : public EmulatedTURNServerInterface,
|
|||||||
// Create an EmulatedTURNServer.
|
// Create an EmulatedTURNServer.
|
||||||
// `thread` is a thread that will be used to run cricket::TurnServer
|
// `thread` is a thread that will be used to run cricket::TurnServer
|
||||||
// that expects all calls to be made from a single thread.
|
// that expects all calls to be made from a single thread.
|
||||||
EmulatedTURNServer(std::unique_ptr<rtc::Thread> thread,
|
EmulatedTURNServer(const EmulatedTURNServerConfig& config,
|
||||||
|
std::unique_ptr<rtc::Thread> thread,
|
||||||
EmulatedEndpoint* client,
|
EmulatedEndpoint* client,
|
||||||
EmulatedEndpoint* peer);
|
EmulatedEndpoint* peer);
|
||||||
~EmulatedTURNServer() override;
|
~EmulatedTURNServer() override;
|
||||||
|
|||||||
@ -371,7 +371,7 @@ EmulatedTURNServerInterface* NetworkEmulationManagerImpl::CreateTURNServer(
|
|||||||
str.AppendFormat("turn_server_%u",
|
str.AppendFormat("turn_server_%u",
|
||||||
static_cast<unsigned>(turn_servers_.size()));
|
static_cast<unsigned>(turn_servers_.size()));
|
||||||
auto turn = std::make_unique<EmulatedTURNServer>(
|
auto turn = std::make_unique<EmulatedTURNServer>(
|
||||||
time_controller_->CreateThread(str.str()), client, peer);
|
config, time_controller_->CreateThread(str.str()), client, peer);
|
||||||
auto out = turn.get();
|
auto out = turn.get();
|
||||||
turn_servers_.push_back(std::move(turn));
|
turn_servers_.push_back(std::move(turn));
|
||||||
return out;
|
return out;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user