blob: 6404134c4a19d8c5e1a0ee734a6b766e0fb4a778 [file] [log] [blame]
Jonas Oreland202994c2017-12-18 12:10:43 +01001/*
2 * Copyright 2017 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "p2p/client/turnportfactory.h"
12
13#include <memory>
14
15#include "p2p/base/turnport.h"
16
17namespace cricket {
18
Yves Gerey665174f2018-06-19 15:03:05 +020019TurnPortFactory::~TurnPortFactory() {}
Jonas Oreland202994c2017-12-18 12:10:43 +010020
21std::unique_ptr<Port> TurnPortFactory::Create(
22 const CreateRelayPortArgs& args,
23 rtc::AsyncPacketSocket* udp_socket) {
Jonas Oreland202994c2017-12-18 12:10:43 +010024 TurnPort* port = TurnPort::Create(
Yves Gerey665174f2018-06-19 15:03:05 +020025 args.network_thread, args.socket_factory, args.network, udp_socket,
26 args.username, args.password, *args.server_address,
27 args.config->credentials, args.config->priority, args.origin,
Jonas Oreland202994c2017-12-18 12:10:43 +010028 args.turn_customizer);
29 port->SetTlsCertPolicy(args.config->tls_cert_policy);
30 return std::unique_ptr<Port>(port);
31}
32
Yves Gerey665174f2018-06-19 15:03:05 +020033std::unique_ptr<Port> TurnPortFactory::Create(const CreateRelayPortArgs& args,
34 int min_port,
35 int max_port) {
Jonas Oreland202994c2017-12-18 12:10:43 +010036 TurnPort* port = TurnPort::Create(
Benjamin Wrightd6f86e82018-05-08 13:12:25 -070037 args.network_thread, args.socket_factory, args.network, min_port,
38 max_port, args.username, args.password, *args.server_address,
39 args.config->credentials, args.config->priority, args.origin,
40 args.config->tls_alpn_protocols, args.config->tls_elliptic_curves,
41 args.turn_customizer, args.config->tls_cert_verifier);
Jonas Oreland202994c2017-12-18 12:10:43 +010042 port->SetTlsCertPolicy(args.config->tls_cert_policy);
43 return std::unique_ptr<Port>(port);
44}
45
46} // namespace cricket