Table of Contents

Class Socks5ProxyServerOptions

Namespace
VpnHood.Net.Proxies.Socks5ProxyServers
Assembly
VpnHood.Net.Proxies.dll

Provides the settings of a Socks5ProxyServer.

public class Socks5ProxyServerOptions
Inheritance
Socks5ProxyServerOptions
Inherited Members

Properties

Backlog

Gets the maximum number of pending connections the listener queues. The default is 512.

public int Backlog { get; init; }

Property Value

int

Remarks

It must be positive: the server's constructor throws ArgumentOutOfRangeException otherwise.

HandshakeTimeout

Gets how long a client has, from its connection's start, to complete the method negotiation and the authentication and to send its request. The default is 15 seconds.

public TimeSpan HandshakeTimeout { get; init; }

Property Value

TimeSpan

Remarks

The server's lookup of a domain name in the request counts against HostConnectionTimeout. It counts whole milliseconds, a fraction dropped: −1 ms (InfiniteTimeSpan) sets no limit; zero cancels the handshake as soon as the cancel runs, so it fails unless it has passed already; −2 ms or less fails every handshake at its start, and the server closes the connection.

HostConnectionTimeout

Gets or sets how long the server may take to reach a destination: the lookup of its domain name, when the request gives one, and the TCP connect. The default is 30 seconds.

public TimeSpan HostConnectionTimeout { get; set; }

Property Value

TimeSpan

Remarks

When it elapses, the client gets TtlExpired. It is read at each connect to a destination, so a change applies to the next connect, for a client accepted already too. It counts whole milliseconds, a fraction dropped: −1 ms (InfiniteTimeSpan) sets no limit; zero cancels each connect as soon as the cancel runs, so it fails unless the destination has accepted already; −2 ms or less fails every connect at its start.

ListenEndPoint

Gets the address and port the server listens on. Port 0 lets the system choose one, which ListenerEndPoint shows once the server has started.

public required IPEndPoint ListenEndPoint { get; init; }

Property Value

IPEndPoint

MaxConnections

Gets the maximum number of client connections the server serves at once. The default is MaxValue, which means no limit.

public int MaxConnections { get; init; }

Property Value

int

Remarks

A connection beyond it is accepted and closed at once. On a host with little memory, such as a mobile network extension, set a limit that fits its budget. It must be positive: the server's constructor throws ArgumentOutOfRangeException otherwise.

Password

Gets the password clients must give with Username. null means an empty password.

public string? Password { get; init; }

Property Value

string

TunnelHalfCloseTimeout

Gets how long, after one direction of a tunnel has ended (a TCP half-close) and the server has passed that end on, the other direction may still carry data before the tunnel is closed. The default is 15 seconds.

public TimeSpan TunnelHalfCloseTimeout { get; init; }

Property Value

TimeSpan

Remarks

It counts whole milliseconds, a fraction dropped: −1 ms (InfiniteTimeSpan) waits for the other direction without a limit; zero, or −2 ms or less, closes the tunnel without that wait, once the ended direction's end has been passed on.

Username

Gets the user name clients must give (RFC 1929), or null to serve clients without credentials.

public string? Username { get; init; }

Property Value

string

Remarks

When it is set, a client must authenticate with it and Password, and a client that offers no username and password authentication is refused. When it is null, a client that offers only username and password authentication is served whatever credentials it gives.