Table of Contents

Class VpnHoodLinuxApp

Namespace
VpnHood.AppLib.App.Linux
Assembly
VpnHood.AppLib.App.Linux.dll

Provides the app as Linux runs it: in a root service, one per lock folder, with the VPN service in a process of its own, the VPN host, which the service starts at a connect.

public class VpnHoodLinuxApp : Singleton<VpnHoodLinuxApp>, IAsyncDisposable
Inheritance
VpnHoodLinuxApp
Implements
Inherited Members

Remarks

Stopping it is disposing it, asynchronously, which tries to take the tunnel down before the process ends.

Methods

Dispose(bool)

Releases the instance; with disposing and when it is the registered one, unregisters it.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true when called from Dispose().

Remarks

It does not disconnect the VPN first, as DisposeAsync() does; a second call does nothing.

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

Remarks

It tries to disconnect the VPN first; a failure to disconnect is logged, not thrown.

Init(AppInitParams, VpnHoodLinuxAppPaths)

Starts the app, once: it takes the single-instance lock in the paths' lock folder before anything is built, tries to remove what a crashed run of the app ID left, without failing where it cannot, then starts the app; a second call gives the app started already.

public static VpnHoodLinuxApp Init(AppInitParams initParams, VpnHoodLinuxAppPaths paths)

Parameters

initParams AppInitParams

The init params.

paths VpnHoodLinuxAppPaths

Where the app keeps things, as its host decides.

Returns

VpnHoodLinuxApp

The app.

Remarks

An ad provider that names countries both to include and to exclude fails the start.

Exceptions

OverflowException

A duration in a built-in access key is out of range.

InvalidDataException

A built-in access key decodes to JSON null.

JsonException

A built-in access key holds no valid access key.

NotSupportedException

A built-in access key's version is not one the app reads.

FormatException

A built-in access key is no valid Base64, or an endpoint or a duration in it is not valid.

InvalidOperationException

The core app has started already, outside this class.

AnotherInstanceIsRunningException

Another instance of the app holds the lock.