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
ipAddressIPAddressThe address.
interfaceNamestringThe interface's name.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that completes once the address is added.
Exceptions
- OperationCanceledException
cancellationTokenwas canceled.
GetInterfaceNames(CancellationToken)
Gets the names of the machine's network interfaces, as the provider lists them.
Task<string[]> GetInterfaceNames(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- OperationCanceledException
cancellationTokenwas canceled.
GetTcpCongestionControl(CancellationToken)
Gets the name of the TCP congestion control the machine uses, as bbr or cubic.
Task<string> GetTcpCongestionControl(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- OperationCanceledException
cancellationTokenwas 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
ipAddressIPAddressThe address.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- OperationCanceledException
cancellationTokenwas canceled.
RemoveIpAddress(IPAddress, string)
Removes an IP address from a network interface.
void RemoveIpAddress(IPAddress ipAddress, string interfaceName)
Parameters
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
valuestringThe congestion control's name, as
bbr.cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that completes once the provider is done.
Exceptions
- OperationCanceledException
cancellationTokenwas canceled.