Table of Contents

Class VpnServiceContract

Namespace
VpnHood.Core.Client.VpnServices.Abstractions
Assembly
VpnHood.Core.Client.VpnServices.Abstractions.dll

Provides the version of the contract between an app and its VPN engine: the requests, options and files they share.

public static class VpnServiceContract
Inheritance
VpnServiceContract
Inherited Members

Remarks

The version goes up only for a change that is not growth: a request, field or file removed or renamed, or one that means something else. See "The VPN service contract" in docs/client-architecture.md.

Fields

MinVersion

The oldest version this library still speaks: 1.

public const int MinVersion = 1

Field Value

int

Version

The newest version this library speaks: 1.

public const int Version = 1

Field Value

int

Methods

Negotiate(VpnEngineInfo)

Finds the highest version this library and an engine both speak, which the app writes in the options (ContractVersion).

public static int Negotiate(VpnEngineInfo vpnEngineInfo)

Parameters

vpnEngineInfo VpnEngineInfo

The engine's report of itself.

Returns

int

The highest version both speak.

Exceptions

VpnServiceContractException

The two share no version.

Verify(int)

Checks that this library speaks the version options were written in, as an engine does before it reads them, rather than reading them as another.

public static void Verify(int contractVersion)

Parameters

contractVersion int

The options' version.

Exceptions

VpnServiceContractException

This library does not speak the version.