Table of Contents

Interface INetConfigurationProvider

Namespace
VpnHood.Core.Server.Abstractions
Assembly
VpnHood.Core.Server.dll

Represents what manages the server machine's network for the server: its interfaces' addresses and TCP's congestion control, as the server's configuration asks.

public interface INetConfigurationProvider

Methods

AddIpAddress(IPAddress, string, CancellationToken)

Adds an IP address to a network interface.

Task AddIpAddress(IPAddress ipAddress, string interfaceName, CancellationToken cancellationToken)

Parameters

ipAddress IPAddress

The address.

interfaceName string

The interface's name.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes once the address is added.

Exceptions

OperationCanceledException

cancellationToken was canceled.

GetInterfaceNames(CancellationToken)

Gets the names of the machine's network interfaces, as the provider lists them.

Task<string[]> GetInterfaceNames(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<string[]>

A task whose result is the names.

Exceptions

OperationCanceledException

cancellationToken was canceled.

GetTcpCongestionControl(CancellationToken)

Gets the name of the TCP congestion control the machine uses, as bbr or cubic.

Task<string> GetTcpCongestionControl(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<string>

A task whose result is the name.

Exceptions

OperationCanceledException

cancellationToken was canceled.

IpAddressExists(IPAddress, CancellationToken)

Gets whether an IP address is on one of the machine's network interfaces.

Task<bool> IpAddressExists(IPAddress ipAddress, CancellationToken cancellationToken)

Parameters

ipAddress IPAddress

The address.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<bool>

A task whose result is true where the address is there.

Exceptions

OperationCanceledException

cancellationToken was canceled.

RemoveIpAddress(IPAddress, string)

Removes an IP address from a network interface.

void RemoveIpAddress(IPAddress ipAddress, string interfaceName)

Parameters

ipAddress IPAddress

The address.

interfaceName string

The interface's name.

Remarks

It is synchronous, as the server's quick close calls it too.

SetTcpCongestionControl(string, CancellationToken)

Sets the TCP congestion control the machine uses; a provider may leave it as it is where the machine allows no change.

Task SetTcpCongestionControl(string value, CancellationToken cancellationToken)

Parameters

value string

The congestion control's name, as bbr.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes once the provider is done.

Exceptions

OperationCanceledException

cancellationToken was canceled.