Revert "Remove deprecated ProxyInfo code"

This reverts commit f54e0133d7.
This commit is contained in:
Oscar Mira 2024-07-13 11:09:49 +02:00
parent 7d35ded3f2
commit 46f324994c
No known key found for this signature in database
GPG key ID: B371B98C5DC32237
10 changed files with 82 additions and 1 deletions

View file

@ -444,6 +444,7 @@ rtc_source_set("packet_socket_factory") {
deps = [
":async_dns_resolver",
"../rtc_base:async_packet_socket",
"../rtc_base:proxy_info",
"../rtc_base:socket_address",
"../rtc_base/system:rtc_export",
]

View file

@ -101,6 +101,7 @@ specific_include_rules = {
],
"packet_socket_factory\.h": [
"+rtc_base/proxy_info.h",
"+rtc_base/async_packet_socket.h",
"+rtc_base/socket_address.h",
],

View file

@ -18,6 +18,7 @@
#include "api/async_dns_resolver.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/proxy_info.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/system/rtc_export.h"
@ -65,10 +66,30 @@ class RTC_EXPORT PacketSocketFactory {
uint16_t max_port,
int opts) = 0;
// TODO(tommi): Remove once implementations outside of webrtc have been moved
// over to the `CreateClientTcpSocket` variant that does not use ProxyInfo.
[[deprecated]] virtual AsyncPacketSocket* CreateClientTcpSocket(
const SocketAddress& local_address,
const SocketAddress& remote_address,
const ProxyInfo& proxy_info,
const std::string& user_agent,
const PacketSocketTcpOptions& tcp_options) {
return CreateClientTcpSocket(local_address, remote_address, tcp_options);
}
// TODO(tommi): Make pure virtual. This temporary implementation is for
// derived classes outside of webrtc that don't override this function but
// override the deprecated version instead.
virtual AsyncPacketSocket* CreateClientTcpSocket(
const SocketAddress& local_address,
const SocketAddress& remote_address,
const PacketSocketTcpOptions& tcp_options) = 0;
const PacketSocketTcpOptions& tcp_options) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return CreateClientTcpSocket(local_address, remote_address, ProxyInfo(),
std::string(), tcp_options);
#pragma clang diagnostic pop
}
virtual std::unique_ptr<webrtc::AsyncDnsResolverInterface>
CreateAsyncDnsResolver() = 0;

View file

@ -129,6 +129,7 @@ rtc_library("rtc_p2p") {
"../rtc_base:network",
"../rtc_base:network_constants",
"../rtc_base:network_route",
"../rtc_base:proxy_info",
"../rtc_base:rate_tracker",
"../rtc_base:refcount",
"../rtc_base:rtc_numerics",
@ -244,6 +245,7 @@ rtc_library("basic_packet_socket_factory") {
"../rtc_base:async_udp_socket",
"../rtc_base:checks",
"../rtc_base:logging",
"../rtc_base:proxy_info",
"../rtc_base:socket",
"../rtc_base:socket_adapters",
"../rtc_base:socket_address",
@ -342,6 +344,7 @@ rtc_library("connection") {
"../rtc_base:net_helper",
"../rtc_base:network",
"../rtc_base:network_constants",
"../rtc_base:proxy_info",
"../rtc_base:rate_tracker",
"../rtc_base:rtc_numerics",
"../rtc_base:safe_minmax",
@ -666,6 +669,7 @@ rtc_library("port") {
"../rtc_base:mdns_responder_interface",
"../rtc_base:net_helper",
"../rtc_base:network",
"../rtc_base:proxy_info",
"../rtc_base:rate_tracker",
"../rtc_base:socket_address",
"../rtc_base:stringutils",
@ -700,6 +704,7 @@ rtc_library("port_allocator") {
"../rtc_base:checks",
"../rtc_base:crypto_random",
"../rtc_base:network",
"../rtc_base:proxy_info",
"../rtc_base:socket_address",
"../rtc_base:ssl",
"../rtc_base:threading",
@ -722,6 +727,7 @@ rtc_library("port_interface") {
"../api/task_queue:task_queue",
"../rtc_base:async_packet_socket",
"../rtc_base:callback_list",
"../rtc_base:proxy_info",
"../rtc_base:socket_address",
"//third_party/abseil-cpp/absl/strings:string_view",
]
@ -1158,6 +1164,7 @@ if (rtc_include_tests) {
"../rtc_base:net_test_helpers",
"../rtc_base:network",
"../rtc_base:network_constants",
"../rtc_base:proxy_info",
"../rtc_base:rtc_base_tests_utils",
"../rtc_base:socket",
"../rtc_base:socket_adapters",

View file

@ -19,6 +19,7 @@
#include "api/async_dns_resolver.h"
#include "api/packet_socket_factory.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/proxy_info.h"
#include "rtc_base/socket.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/socket_factory.h"

View file

@ -320,6 +320,21 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
const rtc::SocketAddress& addr,
const std::vector<uint16_t>& unknown_types);
[[deprecated]] void set_proxy(absl::string_view user_agent,
const rtc::ProxyInfo& proxy) {
RTC_DCHECK_NOTREACHED();
user_agent_ = std::string(user_agent);
proxy_ = proxy;
}
[[deprecated]] const std::string& user_agent() override {
RTC_DCHECK_NOTREACHED();
return user_agent_;
}
[[deprecated]] const rtc::ProxyInfo& proxy() override {
RTC_DCHECK_NOTREACHED();
return proxy_;
}
void EnablePortPackets() override;
// Called if the port has no connections and is no longer useful.
@ -489,6 +504,9 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
IceRole ice_role_;
uint64_t tiebreaker_;
bool shared_socket_;
// Information to use when going through a proxy.
std::string user_agent_;
rtc::ProxyInfo proxy_;
// A virtual cost perceived by the user, usually based on the network type
// (WiFi. vs. Cellular). It takes precedence over the priority when

View file

@ -25,6 +25,7 @@
#include "p2p/base/transport_description.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/callback_list.h"
#include "rtc_base/proxy_info.h"
#include "rtc_base/socket_address.h"
namespace rtc {
@ -153,6 +154,10 @@ class PortInterface {
// The factory used to create the sockets of this port.
virtual rtc::PacketSocketFactory* socket_factory() const = 0;
[[deprecated("Unsupported function")]] virtual const std::string&
user_agent() = 0;
[[deprecated("Unsupported function")]] virtual const rtc::ProxyInfo&
proxy() = 0;
// Identifies the generation that this port was created in.
virtual uint32_t generation() const = 0;

View file

@ -59,6 +59,7 @@
#include "rtc_base/network/received_packet.h"
#include "rtc_base/network/sent_packet.h"
#include "rtc_base/network_constants.h"
#include "rtc_base/proxy_info.h"
#include "rtc_base/socket.h"
#include "rtc_base/socket_adapters.h"
#include "rtc_base/socket_address.h"

View file

@ -1363,6 +1363,12 @@ rtc_library("dscp") {
sources = [ "dscp.h" ]
}
rtc_library("proxy_info") {
visibility = [ "*" ]
sources = [ "proxy_info.h" ]
deps = []
}
rtc_library("file_rotating_stream") {
sources = [
"file_rotating_stream.cc",

20
rtc_base/proxy_info.h Normal file
View file

@ -0,0 +1,20 @@
/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_PROXY_INFO_H_
#define RTC_BASE_PROXY_INFO_H_
namespace rtc {
// TODO(tommi): Remove.
struct ProxyInfo {};
} // namespace rtc
#endif // RTC_BASE_PROXY_INFO_H_