Table of Contents

Interface IAccessManager

Namespace
VpnHood.Core.Server.Access.Managers
Assembly
VpnHood.Core.Server.Access.dll

Defines the access manager a VPN server answers to: it admits sessions, counts their traffic, and configures the server.

public interface IAccessManager : IDisposable
Inherited Members

Methods

Acme_GetHttp01KeyAuthorization(string, CancellationToken)

Gets the key authorization of an ACME HTTP-01 challenge's token, which the server serves on port 80.

Task<string> Acme_GetHttp01KeyAuthorization(string token, CancellationToken cancellationToken)

Parameters

token string

The challenge's token.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<string>

A task whose result is the key authorization.

Exceptions

KeyNotFoundException

The access manager knows no such token, or serves no HTTP-01 challenge.

Server_Configure(ServerInfo, CancellationToken)

Sends what the server is and has, and gets its configuration.

Task<ServerConfig> Server_Configure(ServerInfo serverInfo, CancellationToken cancellationToken)

Parameters

serverInfo ServerInfo

The server's info.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<ServerConfig>

A task whose result is the configuration.

Server_UpdateStatus(ServerStatus, CancellationToken)

Sends the server's status, with its sessions' usage, and gets what the access manager wants of it.

Task<ServerCommand> Server_UpdateStatus(ServerStatus serverStatus, CancellationToken cancellationToken)

Parameters

serverStatus ServerStatus

The status.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<ServerCommand>

A task whose result is the access manager's answer: the configuration's code and the sessions' states.

Session_AddUsage(ulong, Traffic, string?, CancellationToken)

Adds a session's traffic, and a rewarded ad's data, without closing it.

Task<SessionResponse> Session_AddUsage(ulong sessionId, Traffic traffic, string? adData, CancellationToken cancellationToken)

Parameters

sessionId ulong

The session's ID.

traffic Traffic

The session's traffic since its last report.

adData string

A rewarded ad's data, or null.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<SessionResponse>

A task whose result is the session's state.

Session_AddUsages(SessionUsage[], CancellationToken)

Adds the traffic of many sessions, and their closes, in one call.

Task<Dictionary<ulong, SessionResponse>> Session_AddUsages(SessionUsage[] sessionUsages, CancellationToken cancellationToken)

Parameters

sessionUsages SessionUsage[]

The sessions' usage.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<Dictionary<ulong, SessionResponse>>

A task whose result is each session's state, by its ID; the server sends again no entry the answer leaves out or answers with an error.

Session_Close(ulong, Traffic, CancellationToken)

Closes a session with its last traffic.

Task<SessionResponse> Session_Close(ulong sessionId, Traffic traffic, CancellationToken cancellationToken)

Parameters

sessionId ulong

The session's ID.

traffic Traffic

The session's traffic since its last report.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<SessionResponse>

A task whose result is the session's last state.

Session_Create(SessionRequestEx, CancellationToken)

Creates a session for a client's hello.

Task<SessionResponseEx> Session_Create(SessionRequestEx sessionRequestEx, CancellationToken cancellationToken)

Parameters

sessionRequestEx SessionRequestEx

The client's request, with what the server knows of the client.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<SessionResponseEx>

A task whose result is the session, or its refusal in its error code.

Session_Get(ulong, IPEndPoint, IPAddress?, CancellationToken)

Gets a session the server does not hold in memory, as after a restart, to take it up again.

Task<SessionResponseEx> Session_Get(ulong sessionId, IPEndPoint hostEndPoint, IPAddress? clientIp, CancellationToken cancellationToken)

Parameters

sessionId ulong

The session's ID.

hostEndPoint IPEndPoint

The server's endpoint the client came to.

clientIp IPAddress

The client's IP, or null.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<SessionResponseEx>

A task whose result is the session, or its error in its error code.

Session_GetAll(CancellationToken)

Gets the server's sessions, to take them up again at its start.

Task<SessionResponseEx[]> Session_GetAll(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<SessionResponseEx[]>

A task whose result is the sessions.