Table of Contents

Class VpnAdapterSettings

Namespace
VpnHood.Net.VpnAdapters.Abstractions
Assembly
VpnHood.Net.VpnAdapters.Abstractions.dll

Provides the settings a VPN adapter is made with, which hold for its whole life; what changes from one run to the next is in VpnAdapterOptions.

public class VpnAdapterSettings
Inheritance
VpnAdapterSettings
Derived
Inherited Members

Remarks

An adapter hands its packets on to no one, so it disposes each one once it is written: it has no setting for that, as a packet transport's options do.

Properties

AdapterName

Gets the name of the adapter's interface.

public required string AdapterName { get; init; }

Property Value

string

AppId

Gets the ID of the app the adapter belongs to, which the adapter writes on its interface where the OS lets it, such as a Linux tun's alias, or null to write none.

public string? AppId { get; init; }

Property Value

string

Remarks

A name alone says nothing about whose a leftover interface is. Any string will do: an adapter writes what its OS takes, derived from it where needed.

AutoMetric

Gets a value indicating whether routes that cover every address of an IP version are split into its two halves, which win over the host's default route without changing its metric. The default is true. Where the adapter leaves the probe networks out of its routes, that comes first, and what remains is routed as it is.

public bool AutoMetric { get; init; }

Property Value

bool

AutoRestart

Gets a value indicating whether the adapter keeps itself started: after I/O errors, or a restart whose start failed, it starts again after a delay, until its Stop() or disposal. The default is false, where such a stop raises Failed instead.

public bool AutoRestart { get; init; }

Property Value

bool

Blocking

Gets a value indicating whether a send to a full queue waits for room, up to BlockingTimeout. When false, a full queue drops its oldest packet instead.

public required bool Blocking { get; init; }

Property Value

bool

Remarks

A waiting SendPacketQueued(IpPacket) holds its thread; the async send waits without one. Disposing the adapter releases the waits.

BlockingTimeout

Gets how long a blocking send waits for room before it drops its packet, or null to wait until there is room or the adapter is disposed.

public TimeSpan? BlockingTimeout { get; init; }

Property Value

TimeSpan?

MaxPacketSendDelay

Gets the backoff limit for a packet the interface cannot take. The delay starts at 5 milliseconds; after each refusal, the adapter drops the packet if the delay exceeds this limit, or else doubles the delay, waits, and tries again. The default, 500 milliseconds, allows waits up to 640 milliseconds, about 1.3 seconds in all, besides the interface's own write waits.

public TimeSpan MaxPacketSendDelay { get; init; }

Property Value

TimeSpan

QueueCapacity

Gets the number of packets the adapter's send queue holds, or null for DefaultQueueCapacity.

public int? QueueCapacity { get; init; }

Property Value

int?