Class VpnAdapterOptions
- Namespace
- VpnHood.Net.VpnAdapters.Abstractions
- Assembly
- VpnHood.Net.VpnAdapters.Abstractions.dll
Provides the options of one run of a VPN adapter, from its start to its stop; each restart uses them again.
public class VpnAdapterOptions
- Inheritance
-
VpnAdapterOptions
- Inherited Members
Properties
AllVRoutes
Gets AllVRoutesIpV4 and AllVRoutesIpV6 together.
public static IReadOnlyList<IpNetwork> AllVRoutes { get; }
Property Value
AllVRoutesIpV4
Gets the two IPv4 halves, 0.0.0.0/1 and 128.0.0.0/1, which route every IPv4 address through the interface while staying more specific than the host's default route.
public static IReadOnlyList<IpNetwork> AllVRoutesIpV4 { get; }
Property Value
AllVRoutesIpV6
Gets the two IPv6 halves, ::/1 and 8000::/1, which route every IPv6 address through the interface while staying more specific than the host's default route.
public static IReadOnlyList<IpNetwork> AllVRoutesIpV6 { get; }
Property Value
DnsServers
Gets the DNS servers the interface gives the host. Those of an IP version the interface does not carry are left out. The default is none.
public IReadOnlyList<IPAddress> DnsServers { get; init; }
Property Value
ExcludeApps
Gets the apps whose traffic stays out of the tunnel, by package ID, or null for none. This app itself is never left out.
public IEnumerable<string>? ExcludeApps { get; init; }
Property Value
Remarks
Only an adapter whose IsAppFilterSupported is true applies it. It cannot be non-empty together with IncludeApps.
IncludeApps
Gets the only apps whose traffic goes into the tunnel, by package ID, or null for every app. This app itself is always added.
public IEnumerable<string>? IncludeApps { get; init; }
Property Value
Remarks
Only an adapter whose IsAppFilterSupported is true applies it. It cannot be non-empty together with ExcludeApps.
IncludeNetworks
Gets the networks routed through the tunnel. The default is none.
public IEnumerable<IpNetwork> IncludeNetworks { get; init; }
Property Value
Remarks
With AutoMetric, networks that cover every address of an IP version are routed as its two halves (AllVRoutesIpV4, AllVRoutesIpV6). Where the adapter leaves the probe networks out of its routes, that comes first, and what remains is routed as it is.
Metric
Gets the interface's route metric, or null to leave the system's.
public int? Metric { get; init; }
Property Value
- int?
Mtu
Gets the interface's MTU in bytes, or null to leave the system's. It also sizes the buffer each packet is read into, which holds 65,535 bytes in a run without it.
public int? Mtu { get; init; }
Property Value
- int?
ServerIp
Gets the VPN server's address, for an adapter whose OS asks for it, or null.
public IPAddress? ServerIp { get; init; }
Property Value
SessionName
Gets the session's name, which the OS shows where it can, or null or empty for none.
public required string? SessionName { get; init; }
Property Value
UseNat
Gets a value indicating whether the adapter translates the virtual networks to the host's primary addresses (NAT), as a server does. The default is false.
public bool UseNat { get; init; }
Property Value
Remarks
A start with it fails when the adapter's NAT does not translate IPv4; IPv6 is translated only where the adapter supports it.
VirtualIpNetworkV4
Gets the interface's IPv4 address with its network in the tunnel, or null to carry no IPv4.
public IpNetwork? VirtualIpNetworkV4 { get; init; }
Property Value
VirtualIpNetworkV6
Gets the interface's IPv6 address with its network in the tunnel, or null to carry no IPv6. When the address cannot be added, the run goes on without IPv6.
public IpNetwork? VirtualIpNetworkV6 { get; init; }