#include "net/socket/socks_client_socket.h"
#include <utility>
#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/sys_byteorder.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/dns/public/dns_query_type.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/log/net_log.h"
#include "net/log/net_log_event_type.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
namespace net {
static const char kEmptyUserId[] = …;
static const unsigned int kWriteHeaderSize = …;
static const unsigned int kReadHeaderSize = …;
static const uint8_t kServerResponseOk = …;
static const uint8_t kServerResponseRejected = …;
static const uint8_t kServerResponseNotReachable = …;
static const uint8_t kServerResponseMismatchedUserId = …;
static const uint8_t kSOCKSVersion4 = …;
static const uint8_t kSOCKSStreamRequest = …;
struct SOCKS4ServerRequest { … };
static_assert …;
struct SOCKS4ServerResponse { … };
static_assert …;
SOCKSClientSocket::SOCKSClientSocket(
std::unique_ptr<StreamSocket> transport_socket,
const HostPortPair& destination,
const NetworkAnonymizationKey& network_anonymization_key,
RequestPriority priority,
HostResolver* host_resolver,
SecureDnsPolicy secure_dns_policy,
const NetworkTrafficAnnotationTag& traffic_annotation)
: … { … }
SOCKSClientSocket::~SOCKSClientSocket() { … }
int SOCKSClientSocket::Connect(CompletionOnceCallback callback) { … }
void SOCKSClientSocket::Disconnect() { … }
bool SOCKSClientSocket::IsConnected() const { … }
bool SOCKSClientSocket::IsConnectedAndIdle() const { … }
const NetLogWithSource& SOCKSClientSocket::NetLog() const { … }
bool SOCKSClientSocket::WasEverUsed() const { … }
NextProto SOCKSClientSocket::GetNegotiatedProtocol() const { … }
bool SOCKSClientSocket::GetSSLInfo(SSLInfo* ssl_info) { … }
int64_t SOCKSClientSocket::GetTotalReceivedBytes() const { … }
void SOCKSClientSocket::ApplySocketTag(const SocketTag& tag) { … }
int SOCKSClientSocket::Read(IOBuffer* buf,
int buf_len,
CompletionOnceCallback callback) { … }
int SOCKSClientSocket::ReadIfReady(IOBuffer* buf,
int buf_len,
CompletionOnceCallback callback) { … }
int SOCKSClientSocket::CancelReadIfReady() { … }
int SOCKSClientSocket::Write(
IOBuffer* buf,
int buf_len,
CompletionOnceCallback callback,
const NetworkTrafficAnnotationTag& traffic_annotation) { … }
int SOCKSClientSocket::SetReceiveBufferSize(int32_t size) { … }
int SOCKSClientSocket::SetSendBufferSize(int32_t size) { … }
void SOCKSClientSocket::DoCallback(int result) { … }
void SOCKSClientSocket::OnIOComplete(int result) { … }
void SOCKSClientSocket::OnReadWriteComplete(CompletionOnceCallback callback,
int result) { … }
int SOCKSClientSocket::DoLoop(int last_io_result) { … }
int SOCKSClientSocket::DoResolveHost() { … }
int SOCKSClientSocket::DoResolveHostComplete(int result) { … }
const std::string SOCKSClientSocket::BuildHandshakeWriteBuffer() const { … }
int SOCKSClientSocket::DoHandshakeWrite() { … }
int SOCKSClientSocket::DoHandshakeWriteComplete(int result) { … }
int SOCKSClientSocket::DoHandshakeRead() { … }
int SOCKSClientSocket::DoHandshakeReadComplete(int result) { … }
int SOCKSClientSocket::GetPeerAddress(IPEndPoint* address) const { … }
int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { … }
ResolveErrorInfo SOCKSClientSocket::GetResolveErrorInfo() const { … }
}