Table of Contents

Class ClientOptions

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

Provides the options of a VPN connection, which the app writes for the VPN service, in its config folder, as VpnConfigFileName.

public class ClientOptions
Inheritance
ClientOptions
Inherited Members

Fields

SampleAccessKey

A sample access key, of VpnHood's public servers, for tests and samples.

public const string SampleAccessKey = "vh:eyJ2Ijo0LCJuYW1lIjoiVnBuSG9vZCBTYW1wbGUiLCJzaWQiOiIxMzAwIiwidGlkIjoiYTM0Mjk4ZDktY2YwYi00MGEwLWI5NmMtZGJhYjYzMWQ2MGVjIiwiaWF0IjoiMjAyNS0wMS0zMVQxMDoxNDozMi4xMTQ0NjI5WiIsInNlYyI6Im9wcTJ6M0M0ak9rdHNodXl3c0VKNXc9PSIsInNlciI6eyJjdCI6IjIwMjUtMDEtMzBUMDg6NTM6MzhaIiwiaG5hbWUiOiJkb3dubG9hZC5taWNyb3NvZnQuY29tIiwiaHBvcnQiOjAsImlzdiI6ZmFsc2UsInNlYyI6InZhQnFVOVJDM1FIYVc0eEY1aWJZRnc9PSIsImNoIjoiOURQUTYvcmRySmFybU90NmQyVHRRMmE2cjlzPSIsInVybCI6Imh0dHBzOi8vZ2l0bGFiLmNvbS92cG5ob29kL1Zwbkhvb2QuRmFybUtleXMvLS9yYXcvbWFpbi9HbG9iYWxfRmFybV9lbmNyeXB0ZWRfdG9rZW4udHh0IiwidXJscyI6WyJodHRwczovL2dpdGxhYi5jb20vdnBuaG9vZC9WcG5Ib29kLkZhcm1LZXlzLy0vcmF3L21haW4vR2xvYmFsX0Zhcm1fZW5jcnlwdGVkX3Rva2VuLnR4dCIsImh0dHBzOi8vYml0YnVja2V0Lm9yZy92cG5ob29kL3Zwbmhvb2QuZmFybWtleXMvcmF3L21haW4vR2xvYmFsX0Zhcm1fZW5jcnlwdGVkX3Rva2VuLnR4dCIsImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS92cG5ob29kL1Zwbkhvb2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ybyIsIlBML01hem92aWEiLCJSVS9Nb3Njb3ciLCJTRy9TaW5nYXBvcmUiLCJaQS9HYXV0ZW5nIiwiRVMvTWFkcmlkIiwiVFIvQnVyc2EgUHJvdmluY2UiLCJBRS9EdWJhaSIsIkdCL0VuZ2xhbmQgIiwiVVMvT3JlZ29uICIsIlVTL1ZpcmdpbmlhIl0sImxvYzIiOlsiQU0vWWVyZXZhbiIsIkFVL05ldyBTb3V0aCBXYWxlcyIsIkJSL1NhbyBQYXVsbyIsIkNBL1F1ZWJlYyIsIkZSL0hhdXRzLWRlLUZyYW5jZSIsIkRFL0JlcmxpbiIsIkhLL0hvbmcgS29uZyIsIklOL01haGFyYXNodHJhIiwiSlAvVG9reW8iLCJLWi9BbG1hdHkiLCJNWC9RdWVyZXRhcm8iLCJQTC9NYXpvdmlhIiwiUlUvTW9zY293IiwiU0cvU2luZ2Fwb3JlIiwiWkEvR2F1dGVuZyIsIkVTL01hZHJpZCIsIlRSL0J1cnNhIFByb3ZpbmNlIiwiQUUvRHViYWkiLCJHQi9FbmdsYW5kIFsjdW5ibG9ja2FibGVdIiwiVVMvT3JlZ29uIFt+I3VuYmxvY2thYmxlXSIsIlVTL1ZpcmdpbmlhIl19LCJ0YWdzIjpbXSwiaXNwdWIiOnRydWUsImNwb2xzIjpbeyJjY3MiOlsiKiJdLCJuIjoxMCwicGJ0IjoxMCwicGJyIjo2MCwicGJwIjp0cnVlLCJwYmMiOnRydWV9XX0="

Field Value

string

VpnConfigFileName

The name of the file of the connection's options in the VPN service's config folder: vpn.config.

public const string VpnConfigFileName = "vpn.config"

Field Value

string

VpnLogFileName

The name of the VPN service's log file in its config folder: vpn.log.

public const string VpnLogFileName = "vpn.log"

Field Value

string

VpnStatusFileName

The name of the file of the connection's status in the VPN service's config folder: vpn.status.

public const string VpnStatusFileName = "vpn.status"

Field Value

string

Properties

AccessCode

Gets or sets the premium code to connect with, or null.

public string? AccessCode { get; set; }

Property Value

string

AccessKey

Gets or sets the access key to connect with, in its text form.

public required string AccessKey { get; set; }

Property Value

string

AdapterName

Gets or sets the name of the VPN adapter's interface.

public required string AdapterName { get; set; }

Property Value

string

AllowAlwaysOn

Gets or sets a value indicating whether the app lets the VPN connect as always on.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool AllowAlwaysOn { get; set; }

Property Value

bool

AllowAnonymousTracker

Gets or sets a value indicating whether the person lets their use be reported anonymously: the session to the server's analytics, which the server is told of and the client reports to itself where the server names a GA4 measurement ID; and the events of the app's trackers the VPN service makes again (TrackerFactoryInfos), which send nothing without it. The default is true.

public bool AllowAnonymousTracker { get; set; }

Property Value

bool

AllowChannelReuse

Gets or sets a value indicating whether the client keeps its link to the server, a TCP connection or a QUIC stream, once a request or a forwarded TCP connection over it ended cleanly, for the next one; a packet channel's is never kept, and a QUIC connection carries further streams either way. The default is true.

public bool AllowChannelReuse { get; set; }

Property Value

bool

AllowEndPointTracker

Gets or sets a value indicating whether the app's trackers get the availability events of the server endpoints the client checks while it finds one that answers; the event of a connect that succeeded carries its endpoint whatever this says.

public bool AllowEndPointTracker { get; set; }

Property Value

bool

AppId

Gets or sets the app's ID, which the adapter writes on its interface where it can (VpnAdapterSettings.AppId), or null.

public string? AppId { get; set; }

Property Value

string

AutoDisposeVpnAdapter

Gets or sets a value indicating whether the client disposes its VPN adapter with itself. The default is true.

public bool AutoDisposeVpnAdapter { get; set; }

Property Value

bool

ChannelProtocol

Gets or sets the protocol of the tunnel's packet channels. The default is Tcp.

public ChannelProtocol ChannelProtocol { get; set; }

Property Value

ChannelProtocol

ClientId

Gets or sets the client's ID, the same for its every session.

public required string ClientId { get; set; }

Property Value

string

CustomServerEndpoints

Gets or sets the server endpoints to connect to in place of the server token's, or null; while they are set, the client asks the server not to redirect it.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonConverter(typeof(ArrayConverter<IPEndPoint, IPEndPointConverter>))]
public IPEndPoint[]? CustomServerEndpoints { get; set; }

Property Value

IPEndPoint[]

Remarks

After the VPN service ended without closing, as in a crash, the server it was connected to under the same access key is tried first, before these.

DebugData1

Gets or sets text of debug switches the developer gave, such as /disable-WebSocket, or null.

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

Property Value

string

DebugData2

Gets or sets a second text the developer gave, or null; nothing in the library reads it.

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

Property Value

string

DnsServers

Gets or sets the DNS servers the person chose, or null for the automatic choice: the server's where the tunnel can carry them, else Google's.

[JsonConverter(typeof(ArrayConverter<IPAddress, IPAddressConverter>))]
public IPAddress[]? DnsServers { get; set; }

Property Value

IPAddress[]

Remarks

Where IncludeAll keeps DNS inside and the tunnel can carry no candidate, the connect fails.

DropQuic

Gets or sets a value indicating whether the client drops the QUIC bound for the tunnel, UDP to ports 80 and 443, so apps turn to TCP; it applies only while the client forwards IPv4 TCP, and then to either IP version.

public bool DropQuic { get; set; }

Property Value

bool

DropUdp

Gets or sets a value indicating whether the client drops the UDP bound for the tunnel, but to DNS's ports; it applies only while the client forwards IPv4 TCP, and then to either IP version.

public bool DropUdp { get; set; }

Property Value

bool

EndPointStrategy

Gets or sets how the client orders the server token's addresses. The default is Auto, the token's own strategy.

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

Property Value

EndPointStrategy

ExcludeApps

Gets or sets the apps to keep out of the tunnel, by ID, or null.

public string[]? ExcludeApps { get; set; }

Property Value

string[]

ForceLogSni

Gets or sets a value indicating whether the client reads and logs the domain names of the device's flows even where no domain rule needs them.

public bool ForceLogSni { get; set; }

Property Value

bool

IncludeApps

Gets or sets the only apps to let into the tunnel, by ID, or null for every app.

public string[]? IncludeApps { get; set; }

Property Value

string[]

IncludeIpRangesByDevice

Gets or sets the addresses the device's tunnel captures, before the server's ranges and the local-network split narrow them; the session's DNS servers, where its DNS plan is in the tunnel, are added whatever this says, and the VPN server's own address is always taken out. The default is every address.

[JsonConverter(typeof(ArrayConverter<IpRange, IpRangeConverter>))]
public IpRange[] IncludeIpRangesByDevice { get; set; }

Property Value

IpRange[]

IsAlwaysOn

Gets or sets a value indicating whether this connection is the always-on one, which a desktop's app makes itself; Android's system says so to the service instead. Either is refused without AllowAlwaysOn.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool IsAlwaysOn { get; set; }

Property Value

bool

LogServiceOptions

Gets or sets the options of the VPN service's log.

public LogServiceOptions LogServiceOptions { get; set; }

Property Value

LogServiceOptions

MaxPacketChannelTimespan

Gets or sets the longest age limit of a TCP or QUIC packet channel; an infinite one gives channels no age limit, though they still close for other causes. The default is 10 minutes.

public TimeSpan MaxPacketChannelTimespan { get; set; }

Property Value

TimeSpan

MinPacketChannelTimespan

Gets or sets the shortest age limit of a TCP or QUIC packet channel. Each channel's limit is drawn at random from this up to, but not including, MaxPacketChannelTimespan, both cut to whole seconds, or is that value where the two are then equal; a channel past its limit closes gracefully at its next check, for the client to open another. The UDP channel has no limit. The default is 5 minutes.

public TimeSpan MinPacketChannelTimespan { get; set; }

Property Value

TimeSpan

PlanId

Gets or sets the plan to connect with. The default is Normal.

public ConnectPlanId PlanId { get; set; }

Property Value

ConnectPlanId

ServerLocation

Gets or sets the server location to connect to, as Parse(string) reads one, or null for the automatic one.

public string? ServerLocation { get; set; }

Property Value

string

SessionName

Gets or sets the name the VPN adapter gives its session where the OS shows one, or null.

public string? SessionName { get; set; }

Property Value

string

SplitDnsMode

Gets or sets where DNS may go. The default is IncludeAll.

public SplitDnsMode SplitDnsMode { get; set; }

Property Value

SplitDnsMode

SplitLocalNetwork

Gets or sets a value indicating whether the local networks, with multicast and broadcast, stay out of the VPN, so their devices are reached directly; a DNS server of the session's that the tunnel carries stays in.

public bool SplitLocalNetwork { get; set; }

Property Value

bool

TrackerClientVersion

Gets or sets the version the trackers send: the app's own, where the servers get the client's (Version). The default is this assembly's version.

[JsonConverter(typeof(VersionConverter))]
public Version TrackerClientVersion { get; set; }

Property Value

Version

TrackerFactoryInfos

Gets or sets the app's tracker factories, which the VPN service makes again in its own process. The default is none.

public IReadOnlyList<TrackerFactoryInfo> TrackerFactoryInfos { get; set; }

Property Value

IReadOnlyList<TrackerFactoryInfo>

TrackerUserAgent

Gets or sets the user agent the trackers send: UserAgent with the device's model too. The default is the OS's version.

public string TrackerUserAgent { get; set; }

Property Value

string

Transport

Gets or sets the transport's tuning, which the client and its sessions hold by reference.

public ClientTransportOptions Transport { get; set; }

Property Value

ClientTransportOptions

UnroutedIpMode

Gets or sets what happens to a destination the server does not route. The default is Exclude.

public SplitUnsupportedIpMode UnroutedIpMode { get; set; }

Property Value

SplitUnsupportedIpMode

UnsupportedIpV6Mode

Gets or sets what happens to the IPv6 in the device's ranges when the server carries no IPv6 at all. The default is Block, so it does not go around the tunnel, where a WebRTC or STUN probe could learn the device's real address; IPv6 the person's own splits leave out still goes out directly.

public SplitUnsupportedIpMode UnsupportedIpV6Mode { get; set; }

Property Value

SplitUnsupportedIpMode

Remarks

UnroutedIpMode's Block blocks IPv6 too, whatever this says.

UseKillSwitch

Gets or sets a value indicating whether the kill switch is on, where the device has one: the app sets it only where the person turned it on and the plan allows it, so the service obeys it as it is.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool UseKillSwitch { get; set; }

Property Value

bool

UseNullCapture

Gets or sets a value indicating whether the VPN service connects with a null adapter, which captures nothing, for tests.

public bool UseNullCapture { get; set; }

Property Value

bool

UseTcpForwarding

Gets or sets a value indicating whether the client ends each TCP connection on the device and has the server open a new one, rather than carrying its packets.

public bool UseTcpForwarding { get; set; }

Property Value

bool

Remarks

It is a preference, for each IP version: a server that cannot forward TCP turns it off, and one that does not carry that version's TCP as packets, or a domain filter, which needs it, turns it on.

UserAgent

Gets or sets the user agent the servers get. The default is the OS's version.

public string UserAgent { get; set; }

Property Value

string

UserReview

Gets or sets the user's review of the app to send with the connection, or null.

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

Property Value

UserReview

Version

Gets or sets the client's version, which the servers get and may turn a client away by: the library's, whatever app runs it. The default is this assembly's version.

[JsonConverter(typeof(VersionConverter))]
public Version Version { get; set; }

Property Value

Version