51 if (credentials ==
null)
69 if (credentials ==
null)
97 address.TryWriteBytes(
buffer.AsSpan(4), out var _);
103 address.TryWriteBytes(
buffer.AsSpan(4), out var _);
113 await
WriteAsync(
stream,
buffer.AsMemory(0, num + 6), async).ConfigureAwait(continueOnCapturedContext:
false);
125 _ => throw new SocksException(System.SR.net_socks_bad_address_type),
126 }), async).ConfigureAwait(continueOnCapturedContext:
false);
151 if (!address.IsIPv4MappedToIPv6)
158 else if (!isVersion4a)
170 if (array2.Length == 0)
174 iPAddress = array2[0];
176 if (iPAddress ==
null)
181 buffer[7] =
byte.MaxValue;
190 if (iPAddress ==
null)
196 await
WriteAsync(
stream,
buffer.AsMemory(0, num), async).ConfigureAwait(continueOnCapturedContext:
false);
228 if (expected != version)
246 while (
buffer.Length != 0)
248 int num = ((!async) ?
stream.Read(
buffer.Span) : (await
stream.ReadAsync(
buffer).ConfigureAwait(continueOnCapturedContext:
false)));
static ArrayPool< T > Shared
static void WriteUInt16BigEndian(Span< byte > destination, ushort value)
static Task< IPAddress[]> GetHostAddressesAsync(string hostNameOrAddress)
static IPAddress[] GetHostAddresses(string hostNameOrAddress)
static async ValueTask ReadToFillAsync(Stream stream, Memory< byte > buffer, bool async)
static ValueTask WriteAsync(Stream stream, Memory< byte > buffer, bool async)
static byte EncodeString(ReadOnlySpan< char > chars, Span< byte > buffer, string parameterName)
static async ValueTask EstablishSocks5TunnelAsync(Stream stream, string host, int port, Uri proxyUri, NetworkCredential credentials, bool async)
static async ValueTask EstablishSocksTunnelAsync(Stream stream, string host, int port, Uri proxyUri, ICredentials proxyCredentials, bool async, CancellationToken cancellationToken)
static void VerifyProtocolVersion(byte expected, byte version)
static async ValueTask EstablishSocks4TunnelAsync(Stream stream, bool isVersion4a, string host, int port, Uri proxyUri, NetworkCredential credentials, bool async, CancellationToken cancellationToken)
bool TryWriteBytes(Span< byte > destination, out int bytesWritten)
static bool TryParse([NotNullWhen(true)] string? ipString, [NotNullWhen(true)] out IPAddress? address)
static string net_http_invalid_response_premature_eof
static string Format(string resourceFormat, object p1)
static string net_socks_no_auth_method
static string net_socks_ipv6_notsupported
static string net_socks_auth_failed
static string net_socks_string_too_long
static string net_socks_no_ipv4_address
static string net_socks_unexpected_version
static string net_socks_connection_failed
static string net_socks_auth_required
NetworkCredential? GetCredential(Uri uri, string authType)