Table of Contents

Interface IProxyEndPointsApi

Namespace
VpnHood.AppLib.Api
Assembly
VpnHood.AppLib.Api.dll

Represents the app's API for its proxy servers: the list the VPN may reach its server through, with each one's state.

public interface IProxyEndPointsApi

Remarks

A failure comes as IAppApi describes, in process and over HTTP.

Methods

Add(ProxyEndPoint, CancellationToken)

Adds a proxy, or updates the saved one with the same address, keeping how it has behaved.

Task<AppProxyEndPointInfo> Add(ProxyEndPoint proxyEndPoint, CancellationToken cancellationToken)

Parameters

proxyEndPoint ProxyEndPoint

The proxy.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<AppProxyEndPointInfo>

A task whose result is the proxy, with its state.

Exceptions

NotSupportedException

The scheme names no proxy protocol the app speaks.

ArgumentException

The proxy's address is empty, not valid, or has no scheme or no host.

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

Delete(string, CancellationToken)

Deletes a proxy.

Task Delete(string proxyEndPointId, CancellationToken cancellationToken)

Parameters

proxyEndPointId string

The proxy's ID.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

Exceptions

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

DeleteAll(bool, bool, bool, bool, CancellationToken)

Deletes the proxies in the given states.

Task DeleteAll(bool deleteSucceeded, bool deleteFailed, bool deleteUnknown, bool deleteDisabled, CancellationToken cancellationToken)

Parameters

deleteSucceeded bool

true to delete the proxies that last succeeded.

deleteFailed bool

true to delete the proxies that last failed.

deleteUnknown bool

true to delete the proxies not tried yet.

deleteDisabled bool

true to delete the disabled proxies.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

Exceptions

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

DisableAllFailed(CancellationToken)

Disables every proxy that last failed.

Task DisableAllFailed(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

Exceptions

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

Get(string, CancellationToken)

Gets a proxy.

Task<AppProxyEndPointInfo> Get(string proxyEndPointId, CancellationToken cancellationToken)

Parameters

proxyEndPointId string

The proxy's ID.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<AppProxyEndPointInfo>

A task whose result is the proxy, with its state.

Exceptions

KeyNotFoundException

No proxy has proxyEndPointId.

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

GetDevice(CancellationToken)

Gets the device's own proxy, as its settings tell it.

Task<AppProxyEndPointInfo?> GetDevice(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<AppProxyEndPointInfo>

A task whose result is the proxy, or null where the device has none.

Exceptions

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

Import(string, CancellationToken)

Adds the proxies a text lists.

Task Import(string content, CancellationToken cancellationToken)

Parameters

content string

The text, one proxy per line.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

Exceptions

ArgumentException

The settings' most proxies to keep is 0 or less.

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

List(string?, bool, bool, bool, bool, int?, int?, CancellationToken)

Lists the proxies in the given states, a page at a time.

Task<ListResult<AppProxyEndPointInfo>> List(string? search, bool includeSucceeded, bool includeFailed, bool includeUnknown, bool includeDisabled, int? recordIndex, int? recordCount, CancellationToken cancellationToken)

Parameters

search string

A text the proxies must contain, or null for all.

includeSucceeded bool

true to include the proxies that last succeeded.

includeFailed bool

true to include the proxies that last failed.

includeUnknown bool

true to include the proxies not tried yet.

includeDisabled bool

true to include the disabled proxies.

recordIndex int?

The index of the page's first proxy, or null for the first.

recordCount int?

How many proxies the page holds at most, or null for all.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<ListResult<AppProxyEndPointInfo>>

A task whose result is the page, with the count of all the proxies that match.

Exceptions

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

Parse(string, ProxyEndPointDefaults, CancellationToken)

Reads a proxy from its text, without adding it.

Task<AppProxyEndPointInfo> Parse(string text, ProxyEndPointDefaults defaults, CancellationToken cancellationToken)

Parameters

text string

The proxy's address, as a URL or as a host and port.

defaults ProxyEndPointDefaults

What the text leaves out, as the protocol and port.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<AppProxyEndPointInfo>

A task whose result is the proxy, without a state.

Exceptions

NotSupportedException

The scheme names no proxy protocol the app speaks.

ArgumentException

The text is empty, not valid, or has no host; or it names no scheme and no port the defaults can place.

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

ReloadUrl(CancellationToken)

Reads the proxy list again from the address the settings' automatic update names.

Task ReloadUrl(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

Exceptions

HttpRequestException

The list could not be read.

InvalidOperationException

The settings name no address to read the list from.

ArgumentException

The settings' most proxies to keep is 0 or less.

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

ResetStates(CancellationToken)

Forgets every proxy's state, so each is tried anew.

Task ResetStates(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

Remarks

A disabled proxy stays disabled.

Exceptions

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.

Update(string, ProxyEndPoint, CancellationToken)

Changes a proxy.

Task<AppProxyEndPointInfo> Update(string proxyEndPointId, ProxyEndPoint proxyEndPoint, CancellationToken cancellationToken)

Parameters

proxyEndPointId string

The proxy's ID.

proxyEndPoint ProxyEndPoint

The proxy as it is to be.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<AppProxyEndPointInfo>

A task whose result is the proxy, with its state.

Exceptions

NotSupportedException

The scheme names no proxy protocol the app speaks.

ArgumentException

The proxy's address is empty, not valid, or has no scheme or no host.

KeyNotFoundException

No proxy has proxyEndPointId.

ApiException

Over HTTP, the app failed with an exception of a type the transport does not rebuild, which ExceptionTypeName names, or answered with an error it does not name.

OperationCanceledException

cancellationToken was canceled: over HTTP always, in process where the call honours it.