Jonas Oreland | 202994c | 2017-12-18 12:10:43 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | namespace cricket { |
| 18 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 19 | TurnPortFactory::~TurnPortFactory() {} |
Jonas Oreland | 202994c | 2017-12-18 12:10:43 +0100 | [diff] [blame] | 20 | |
| 21 | std::unique_ptr<Port> TurnPortFactory::Create( |
| 22 | const CreateRelayPortArgs& args, |
| 23 | rtc::AsyncPacketSocket* udp_socket) { |
Jonas Oreland | 202994c | 2017-12-18 12:10:43 +0100 | [diff] [blame] | 24 | TurnPort* port = TurnPort::Create( |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 25 | 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 Oreland | 202994c | 2017-12-18 12:10:43 +0100 | [diff] [blame] | 28 | args.turn_customizer); |
| 29 | port->SetTlsCertPolicy(args.config->tls_cert_policy); |
| 30 | return std::unique_ptr<Port>(port); |
| 31 | } |
| 32 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 33 | std::unique_ptr<Port> TurnPortFactory::Create(const CreateRelayPortArgs& args, |
| 34 | int min_port, |
| 35 | int max_port) { |
Jonas Oreland | 202994c | 2017-12-18 12:10:43 +0100 | [diff] [blame] | 36 | TurnPort* port = TurnPort::Create( |
Benjamin Wright | d6f86e8 | 2018-05-08 13:12:25 -0700 | [diff] [blame] | 37 | 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 Oreland | 202994c | 2017-12-18 12:10:43 +0100 | [diff] [blame] | 42 | port->SetTlsCertPolicy(args.config->tls_cert_policy); |
| 43 | return std::unique_ptr<Port>(port); |
| 44 | } |
| 45 | |
| 46 | } // namespace cricket |