Table of Contents

Class ClientTransportOptions

Namespace
VpnHood.Core.Client.Abstractions
Assembly
VpnHood.Core.Client.Abstractions.dll

Provides the transport's settings the app tunes and the client uses, held by reference down to the session's configuration in each process, so no layer restates them.

public class ClientTransportOptions
Inheritance
ClientTransportOptions
Inherited Members

Remarks

Every setting has its own default. The two kernel-buffer settings are the exception: null there leaves the socket at the OS's own size.

Properties

AutoWaitTimeout

Gets or sets how long the client waits before it tries again. The default is 30 seconds.

public TimeSpan AutoWaitTimeout { get; set; }

Property Value

TimeSpan

LimitedMemory

Gets a new instance of the constrained preset, for a host that runs network code inside a memory-capped process — today the iOS/tvOS Network Extension under its ~52 MB jetsam limit.

public static ClientTransportOptions LimitedMemory { get; }

Property Value

ClientTransportOptions

Remarks

Every value was measured against that cap. Nothing else needs it: the limit is the platform's, not a property of the device, which is why an Apple Silicon Mac running the same iOS binary takes NormalMemory instead.

MaxPacketChannelCount

Gets or sets the most packet channels the client keeps over TCP or QUIC, which the server may lower. The default is 8.

public int MaxPacketChannelCount { get; set; }

Property Value

int

Remarks

Over TCP, each is a whole connection, with its TLS and buffers, so the count trades memory for throughput: packet mode carries every tunneled flow over these, and upload spreads across them by source port. Over QUIC, each is a stream, and streams may share a connection. UDP has one channel.

MaxUdpClientCount

Gets or sets the most of a session's UDP forwarding workers. The default is 100.

public int MaxUdpClientCount { get; set; }

Property Value

int

MaxUdpDnsClientCount

Gets or sets the most of a session's DNS forwarding workers. The default is 70.

public int MaxUdpDnsClientCount { get; set; }

Property Value

int

NormalMemory

Gets a new instance of the ordinary transport, every setting at its own default: what every host runs unless something constrains it — Windows, Linux, macOS, Android, and an iOS app running on an Apple Silicon Mac.

public static ClientTransportOptions NormalMemory { get; }

Property Value

ClientTransportOptions

Remarks

It is named for asking nothing unusual rather than for wanting a lot of memory: LimitedMemory is the exception, this is the norm.

PacketChannelBufferSize

Gets or sets the buffer sizes of a packet channel's connection. The default is about 256 KB each way.

public TransferBufferSize PacketChannelBufferSize { get; set; }

Property Value

TransferBufferSize

ServerQueryTimeout

Gets or sets how long a query of a server's status may take. The default is 5 seconds.

public TimeSpan ServerQueryTimeout { get; set; }

Property Value

TimeSpan

SessionTimeout

Gets or sets how long a session may go without reaching its server, after an error, before it ends. The default is 3 days.

public TimeSpan SessionTimeout { get; set; }

Property Value

TimeSpan

StreamForwardingBufferSize

Gets or sets the buffer sizes of a TCP connection the client forwards. The default is about 8 KB (8,191 bytes) each way.

public TransferBufferSize StreamForwardingBufferSize { get; set; }

Property Value

TransferBufferSize

TcpConnectTimeout

Gets or sets how long the session's first request to the server may take, its connection included, before the server's own request timeout takes over; and how long a TCP connection the client opens outside the tunnel may take. The default is 30 seconds.

public TimeSpan TcpConnectTimeout { get; set; }

Property Value

TimeSpan

TcpKernelBufferSize

Gets or sets the kernel buffer sizes of the client's TCP sockets, but those of the packet channels it connects directly, or null for the OS's own.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public TransferBufferSize? TcpKernelBufferSize { get; set; }

Property Value

TransferBufferSize?

TcpPacketChannelKernelBufferSize

Gets or sets the kernel buffer sizes of the TCP packet channels to the server, or null for the OS's own, not TcpKernelBufferSize's, so the tunnel's sockets can autotune while the others stay small. A packet channel through a proxy keeps TcpKernelBufferSize's, as the proxy makes its socket.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public TransferBufferSize? TcpPacketChannelKernelBufferSize { get; set; }

Property Value

TransferBufferSize?

UdpChannelBufferSize

Gets or sets the kernel buffer sizes of the UDP socket of the UDP channel to the server. The default is 1 MB each way.

public TransferBufferSize UdpChannelBufferSize { get; set; }

Property Value

TransferBufferSize

UdpForwardingBufferSize

Gets or sets the buffer sizes of forwarded UDP's sockets. The default is 1 MB each way.

public TransferBufferSize UdpForwardingBufferSize { get; set; }

Property Value

TransferBufferSize

UdpForwardingQueueCapacity

Gets or sets the packets a UDP forwarder's queue holds. The default is 200.

public int UdpForwardingQueueCapacity { get; set; }

Property Value

int

UnstableTimeout

Gets or sets how long the client tries to reach its server, unstable, before it waits. The default is 60 seconds.

public TimeSpan UnstableTimeout { get; set; }

Property Value

TimeSpan

Methods

ForCurrentPlatform()

Picks the preset that fits the current host. Apple mobile platforms (iOS / tvOS) run network code inside memory-capped Network Extensions, so they get LimitedMemory; everything else gets NormalMemory so throughput is unaffected. Detection is by OS family, not a runtime memory probe: an extension's real limit is enforced by jetsam and is not visible through GetGCMemoryInfo(), which reports total device RAM.

This is what AppOptions.Transport starts as, so a head gets the right preset without writing anything. One case it cannot see: an iOS app running on Apple Silicon under "Designed for iPad" reports IsIOS() with no Mac Catalyst marker, so it is indistinguishable from a real device here. Only a head can tell, by asking Foundation (NSProcessInfo.ProcessInfo.IsiOSApplicationOnMac), and it assigns the preset itself.

public static ClientTransportOptions ForCurrentPlatform()

Returns

ClientTransportOptions

A new LimitedMemory preset on iOS and tvOS; otherwise, a new NormalMemory one.