#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/socket/socks5_client_socket.h"
#include <utility>
#include "base/compiler_specific.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/strings/string_util.h"
#include "base/sys_byteorder.h"
#include "net/base/io_buffer.h"
#include "net/base/sys_addrinfo.h"
#include "net/base/tracing.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 {
const unsigned int SOCKS5ClientSocket::kGreetReadHeaderSize = …;
const unsigned int SOCKS5ClientSocket::kWriteHeaderSize = …;
const unsigned int SOCKS5ClientSocket::kReadHeaderSize = …;
const uint8_t SOCKS5ClientSocket::kSOCKS5Version = …;
const uint8_t SOCKS5ClientSocket::kTunnelCommand = …;
const uint8_t SOCKS5ClientSocket::kNullByte = …;
static_assert …;
static_assert …;
SOCKS5ClientSocket::SOCKS5ClientSocket(
std::unique_ptr<StreamSocket> transport_socket,
const HostPortPair& destination,
const NetworkTrafficAnnotationTag& traffic_annotation)
: … { … }
SOCKS5ClientSocket::~SOCKS5ClientSocket() { … }
int SOCKS5ClientSocket::Connect(CompletionOnceCallback callback) { … }
void SOCKS5ClientSocket::Disconnect() { … }
bool SOCKS5ClientSocket::IsConnected() const { … }
bool SOCKS5ClientSocket::IsConnectedAndIdle() const { … }
const NetLogWithSource& SOCKS5ClientSocket::NetLog() const { … }
bool SOCKS5ClientSocket::WasEverUsed() const { … }
NextProto SOCKS5ClientSocket::GetNegotiatedProtocol() const { … }
bool SOCKS5ClientSocket::GetSSLInfo(SSLInfo* ssl_info) { … }
int64_t SOCKS5ClientSocket::GetTotalReceivedBytes() const { … }
void SOCKS5ClientSocket::ApplySocketTag(const SocketTag& tag) { … }
int SOCKS5ClientSocket::Read(IOBuffer* buf,
int buf_len,
CompletionOnceCallback callback) { … }
int SOCKS5ClientSocket::Write(
IOBuffer* buf,
int buf_len,
CompletionOnceCallback callback,
const NetworkTrafficAnnotationTag& traffic_annotation) { … }
int SOCKS5ClientSocket::SetReceiveBufferSize(int32_t size) { … }
int SOCKS5ClientSocket::SetSendBufferSize(int32_t size) { … }
void SOCKS5ClientSocket::DoCallback(int result) { … }
void SOCKS5ClientSocket::OnIOComplete(int result) { … }
void SOCKS5ClientSocket::OnReadWriteComplete(CompletionOnceCallback callback,
int result) { … }
int SOCKS5ClientSocket::DoLoop(int last_io_result) { … }
const char kSOCKS5GreetWriteData[] = …;
int SOCKS5ClientSocket::DoGreetWrite() { … }
int SOCKS5ClientSocket::DoGreetWriteComplete(int result) { … }
int SOCKS5ClientSocket::DoGreetRead() { … }
int SOCKS5ClientSocket::DoGreetReadComplete(int result) { … }
int SOCKS5ClientSocket::BuildHandshakeWriteBuffer(std::string* handshake)
const { … }
int SOCKS5ClientSocket::DoHandshakeWrite() { … }
int SOCKS5ClientSocket::DoHandshakeWriteComplete(int result) { … }
int SOCKS5ClientSocket::DoHandshakeRead() { … }
int SOCKS5ClientSocket::DoHandshakeReadComplete(int result) { … }
int SOCKS5ClientSocket::GetPeerAddress(IPEndPoint* address) const { … }
int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { … }
}