Table of Contents

Class ServerConfig

Namespace
VpnHood.Core.Server.Access.Configurations
Assembly
VpnHood.Core.Server.Access.dll

Represents a VPN server's configuration, as its access manager gives it (Server_Configure(ServerInfo, CancellationToken)) and a local file may override.

public class ServerConfig
Inheritance
ServerConfig
Derived
Inherited Members

Remarks

A setting left null takes its default, which the property of its name ending in Value gives. In JSON, the three groups are named Tracking, Session and NetFilter.

Properties

AddListenerIpsToNetwork

Gets or sets the network interface the server adds its TCP endpoints' addresses to where the system lacks them, where it manages its network (Linux); null, empty or * for the first interface.

public string? AddListenerIpsToNetwork { get; set; }

Property Value

string

Certificates

Gets or sets the TLS certificates the server presents; at least one is required. The default is none.

public CertificateData[] Certificates { get; set; }

Property Value

CertificateData[]

ConfigCode

Gets or sets the configuration's code, which the server reports in its status: an answer with another code makes it ask for its configuration again. The default is empty.

public string ConfigCode { get; set; }

Property Value

string

DnsServers

Gets or sets the DNS servers the server gives its clients, which its filter lets out of its ranges, or null for Google's.

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

Property Value

IPAddress[]

DnsServersValue

Gets DnsServers, or its default, Google's.

[JsonIgnore]
public IPAddress[] DnsServersValue { get; }

Property Value

IPAddress[]

EnableHttp01Challenge

Gets or sets a value indicating whether the server answers ACME HTTP-01 challenges on port 80 of its TCP endpoints' addresses, with the access manager's key authorizations, or null for false.

public bool? EnableHttp01Challenge { get; set; }

Property Value

bool?

EnableHttp01ChallengeValue

Gets EnableHttp01Challenge, or its default, false.

[JsonIgnore]
public bool EnableHttp01ChallengeValue { get; }

Property Value

bool

LogAnonymizer

Gets or sets a value indicating whether the server's logging redacts the addresses and IDs it formats, which the tracking options' records and some reports leave as they are, or null for true.

public bool? LogAnonymizer { get; set; }

Property Value

bool?

LogAnonymizerValue

Gets LogAnonymizer, or its default, true.

[JsonIgnore]
public bool LogAnonymizerValue { get; }

Property Value

bool

MaxCompletionPortThreads

Gets or sets the thread pool's most I/O completion threads: null for 65,535, chosen so I/O rather slows together than waits in a queue, and 0 to leave the runtime's.

public int? MaxCompletionPortThreads { get; set; }

Property Value

int?

MinCompletionPortThreads

Gets or sets the thread pool's least I/O completion threads: null for 30 times the pool's minimum at the time, at each configuration, and 0 to leave it.

public int? MinCompletionPortThreads { get; set; }

Property Value

int?

NetFilterOptions

Gets or sets which destinations the server's clients may reach.

[JsonPropertyName("NetFilter")]
public NetFilterOptions NetFilterOptions { get; set; }

Property Value

NetFilterOptions

QuicEndPoints

Gets or sets the endpoints the server takes QUIC on, or null for none.

[JsonConverter(typeof(ArrayConverter<IPEndPoint, IPEndPointConverter>))]
public IPEndPoint[]? QuicEndPoints { get; set; }

Property Value

IPEndPoint[]

QuicEndPointsValue

Gets QuicEndPoints, or its default, none.

[JsonIgnore]
public IPEndPoint[] QuicEndPointsValue { get; }

Property Value

IPEndPoint[]

ReverseProxyIpRanges

Gets or sets more addresses the server trusts to name the client's IP in X-Forwarded-For, or null for none.

public IpRange[]? ReverseProxyIpRanges { get; set; }

Property Value

IpRange[]

ReverseProxyIpRangesValue

Gets ReverseProxyIpRanges, or its default, none.

[JsonIgnore]
public IpRange[] ReverseProxyIpRangesValue { get; }

Property Value

IpRange[]

ReverseProxyProviders

Gets or sets the reverse proxies whose published addresses the server trusts to name the client's IP in X-Forwarded-For, which the access manager locks and locates; or null for Cloudflare's alone.

public ReverseProxyProvider[]? ReverseProxyProviders { get; set; }

Property Value

ReverseProxyProvider[]

Remarks

Any other sender is taken at its own address.

ReverseProxyProvidersValue

Gets ReverseProxyProviders, or its default, Cloudflare alone: not CloudFront, as edge code on any AWS account may write X-Forwarded-For, and CloudFront marks none of it.

[JsonIgnore]
public ReverseProxyProvider[] ReverseProxyProvidersValue { get; }

Property Value

ReverseProxyProvider[]

ServerSecret

Gets or sets the server's secret, which the server token carries and the requests' proofs come from, or null to keep the server's own.

public byte[]? ServerSecret { get; set; }

Property Value

byte[]

SessionOptions

Gets or sets the limits, timeouts and buffers of the server's sessions.

[JsonPropertyName("Session")]
public SessionOptions SessionOptions { get; set; }

Property Value

SessionOptions

SwapMemorySizeMb

Gets or sets the swap the server wants in all, in megabytes, where it manages swap (Linux): its own swap file makes up what the system's other swap lacks, and null or 0 removes its own.

public int? SwapMemorySizeMb { get; set; }

Property Value

int?

TcpCongestionControl

Gets or sets the TCP congestion control the server sets on its OS where it manages its network (Linux), or null to leave the OS's. The default is bbr.

public string? TcpCongestionControl { get; set; }

Property Value

string

TcpCongestionControlValue

Gets TcpCongestionControl, which has no default of its own here.

[JsonIgnore]
public string? TcpCongestionControlValue { get; }

Property Value

string

TcpEndPoints

Gets or sets the TCP endpoints the server listens on, or null for port 443 on every IPv4 and IPv6 address.

[JsonConverter(typeof(ArrayConverter<IPEndPoint, IPEndPointConverter>))]
public IPEndPoint[]? TcpEndPoints { get; set; }

Property Value

IPEndPoint[]

TcpEndPointsValue

Gets TcpEndPoints, or its default: port 443 on every IPv4 and IPv6 address.

[JsonIgnore]
public IPEndPoint[] TcpEndPointsValue { get; }

Property Value

IPEndPoint[]

TrackingOptions

Gets or sets what the server's track log records.

[JsonPropertyName("Tracking")]
public TrackingOptions TrackingOptions { get; set; }

Property Value

TrackingOptions

UdpEndPoints

Gets or sets the endpoints of the tunnel's UDP channel, or null for none.

[JsonConverter(typeof(ArrayConverter<IPEndPoint, IPEndPointConverter>))]
public IPEndPoint[]? UdpEndPoints { get; set; }

Property Value

IPEndPoint[]

UdpEndPointsValue

Gets UdpEndPoints, or its default, none.

[JsonIgnore]
public IPEndPoint[] UdpEndPointsValue { get; }

Property Value

IPEndPoint[]

UpdateStatusInterval

Gets or sets how often the server sends its status to the access manager, or null for 2 minutes; the sessions' sync interval (SyncInterval) caps it.

[JsonConverter(typeof(TimeSpanConverter))]
public TimeSpan? UpdateStatusInterval { get; set; }

Property Value

TimeSpan?

UpdateStatusIntervalValue

Gets UpdateStatusInterval, or its default, 2 minutes.

[JsonIgnore]
public TimeSpan UpdateStatusIntervalValue { get; }

Property Value

TimeSpan

Methods

ApplyDefaults()

Sets each setting left null to its default, so the configuration shows the values it runs with; the QUIC endpoints, the server's secret and the thread, swap and interface settings stay as they are.

public void ApplyDefaults()

Merge(ServerConfig)

Copies over this configuration each setting another one sets, but its code and its certificates, as a local file's over the access manager's.

public void Merge(ServerConfig obj)

Parameters

obj ServerConfig

The configuration whose settings win where it sets them.