Interface IAccessManager
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
tokenstringThe challenge's token.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
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
serverInfoServerInfoThe server's info.
cancellationTokenCancellationTokenThe 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
serverStatusServerStatusThe status.
cancellationTokenCancellationTokenThe 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
sessionIdulongThe session's ID.
trafficTrafficThe session's traffic since its last report.
adDatastringA rewarded ad's data, or null.
cancellationTokenCancellationTokenThe 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
sessionUsagesSessionUsage[]The sessions' usage.
cancellationTokenCancellationTokenThe 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
sessionIdulongThe session's ID.
trafficTrafficThe session's traffic since its last report.
cancellationTokenCancellationTokenThe 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
sessionRequestExSessionRequestExThe client's request, with what the server knows of the client.
cancellationTokenCancellationTokenThe 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
sessionIdulongThe session's ID.
hostEndPointIPEndPointThe server's endpoint the client came to.
clientIpIPAddressThe client's IP, or null.
cancellationTokenCancellationTokenThe 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
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task<SessionResponseEx[]>
A task whose result is the sessions.