Table of Contents

Class NetFilterOptions

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

Represents which destinations the server's clients may reach, and what their VPN adapters capture.

public class NetFilterOptions
Inheritance
NetFilterOptions
Inherited Members

Remarks

A setting left null takes its default, which the property of its name ending in Value gives. The DNS servers the server gives its clients are let through these ranges, though the isolation, local-network and port blocks still apply to them: a DNS server at an address that is not public works only with IncludeLocalNetwork.

Properties

BlockIpV6

Gets or sets a value indicating whether the server blocks IPv6 and tells its clients it carries none, or null for false.

public bool? BlockIpV6 { get; set; }

Property Value

bool?

BlockIpV6Value

Gets BlockIpV6, or its default, false.

[JsonIgnore]
public bool BlockIpV6Value { get; }

Property Value

bool

BlockTcpPorts

Gets or sets the TCP destination ports the server blocks, or null for port 25 alone.

public IReadOnlyList<PortRange>? BlockTcpPorts { get; set; }

Property Value

IReadOnlyList<PortRange>

BlockTcpPortsValue

Gets BlockTcpPorts, or its default, port 25 alone, as a user's mail to port 25 can get the server's IP blocked as a spam source. A list that is set replaces it.

[JsonIgnore]
public IReadOnlyList<PortRange> BlockTcpPortsValue { get; }

Property Value

IReadOnlyList<PortRange>

BlockUdpPorts

Gets or sets the UDP destination ports the server blocks, or null for none.

public IReadOnlyList<PortRange>? BlockUdpPorts { get; set; }

Property Value

IReadOnlyList<PortRange>

BlockUdpPortsValue

Gets BlockUdpPorts, or its default, none.

[JsonIgnore]
public IReadOnlyList<PortRange> BlockUdpPortsValue { get; }

Property Value

IReadOnlyList<PortRange>

ExcludeIpRanges

Gets or sets the destinations the server does not route, or null for none.

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

Property Value

IpRange[]

IncludeIpRanges

Gets or sets the only destinations the server routes, which it tells its clients, or null or empty for all of them.

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

Property Value

IpRange[]

IncludeLocalNetwork

Gets or sets a value indicating whether the clients may reach the server's local networks and its own addresses, and their VPN adapters capture local networks, or null for false.

public bool? IncludeLocalNetwork { get; set; }

Property Value

bool?

Remarks

Without it the server blocks its own addresses and every network that is not public (NonPublicNetworks): its loopback, its local networks, and its provider's network, such as the carriers' shared space, where a cloud's instance metadata may be. With it all of them are open, the loopback too, so a service that listens there for the machine alone is the clients' to reach.

IncludeLocalNetworkValue

Gets IncludeLocalNetwork, or its default, false.

[JsonIgnore]
public bool IncludeLocalNetworkValue { get; }

Property Value

bool

NetworkIsolation

Gets or sets a value indicating whether the server keeps its clients from reaching each other's virtual addresses, or null for true.

public bool? NetworkIsolation { get; set; }

Property Value

bool?

NetworkIsolationValue

Gets NetworkIsolation, or its default, true.

[JsonIgnore]
public bool NetworkIsolationValue { get; }

Property Value

bool

VpnAdapterExcludeIpRanges

Gets or sets the destinations the clients' VPN adapters leave out, or null for none.

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

Property Value

IpRange[]

VpnAdapterIncludeIpRanges

Gets or sets the only destinations the clients' VPN adapters capture, or null or empty for all of them.

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

Property Value

IpRange[]

Methods

ApplyDefaults()

Sets each option left null to its default; the ranges, which have none, stay as they are.

public void ApplyDefaults()

GetBlockedIpRanges()

Gets the destinations these ranges block: all that the server does not route or the adapters do not capture, and IPv6 under BlockIpV6.

public IpRangeOrderedList GetBlockedIpRanges()

Returns

IpRangeOrderedList

The ranges.

Remarks

The server lets its DNS servers out of these ranges, then blocks more besides, DNS servers in them included: its clients' virtual addresses under NetworkIsolation, and its own addresses and every network that is not public (NonPublicNetworks) unless IncludeLocalNetwork; the blocked ports apply too.

GetFinalIncludeIpRanges()

Gets the destinations the server routes: every address, narrowed to IncludeIpRanges where it is set and not empty, less ExcludeIpRanges.

public IpRangeOrderedList GetFinalIncludeIpRanges()

Returns

IpRangeOrderedList

The ranges.

GetFinalVpnAdapterIncludeIpRanges()

Gets the destinations the clients' VPN adapters capture: every address but the local networks, unless IncludeLocalNetwork, narrowed to VpnAdapterIncludeIpRanges where it is set and not empty, less VpnAdapterExcludeIpRanges.

public IEnumerable<IpRange> GetFinalVpnAdapterIncludeIpRanges()

Returns

IEnumerable<IpRange>

The ranges.

Merge(NetFilterOptions)

Copies over these options each one another set sets.

public void Merge(NetFilterOptions obj)

Parameters

obj NetFilterOptions

The options that win where they are set.