Skip to content

Interface ILinkService

Namespace: Void.Proxy.Api.Links
Assembly: Void.Proxy.Api.dll

Manages the lifecycle of instances that connect players to backend servers, and provides methods to establish or look up player-to-server connections.

public interface ILinkService

Properties

All

Gets all currently active links — links that have completed authentication and are actively forwarding traffic between a player and a backend server.

IReadOnlyList<ILink> All { get; }

Property Value

IReadOnlyList<ILink>

Methods

ConnectAsync(IPlayer, IServer, CancellationToken)

Connects the specified player to the given backend server. If the target server is unreachable, the player is redirected back to their previous server. If the previous server is also unreachable, the player is kicked with an explanatory message.

ValueTask<ConnectionResult> ConnectAsync(IPlayer player, IServer server, CancellationToken cancellationToken = default)

Parameters

player IPlayer

The player to connect.

server IServer

The target backend server.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

ValueTask<ConnectionResult>

if the player connected to the target or the previous server; if neither the target nor the previous server could be reached.

ConnectPlayerAnywhereAsync(IPlayer, CancellationToken)

Connects the specified player to the first available backend server by firing a to let plugins nominate a preferred server. If no plugin selects a server, every configured server is tried in order until one accepts the player.

ValueTask<ConnectionResult> ConnectPlayerAnywhereAsync(IPlayer player, CancellationToken cancellationToken = default)

Parameters

player IPlayer

The player to connect.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

ValueTask<ConnectionResult>

if a server was found and the player authenticated successfully; if no available server accepted the player.

ConnectPlayerAnywhereAsync(IPlayer, IEnumerable<IServer>, CancellationToken)

Connects the specified player to the first available backend server that is not in ignoredServers by firing a to let plugins nominate a preferred server. If no plugin selects a server, every configured server not in the ignore list is tried in order.

ValueTask<ConnectionResult> ConnectPlayerAnywhereAsync(IPlayer player, IEnumerable<IServer> ignoredServers, CancellationToken cancellationToken = default)

Parameters

player IPlayer

The player to connect.

ignoredServers IEnumerable<IServer>

Servers that must not be considered during this connection attempt.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

ValueTask<ConnectionResult>

if a server was found and the player authenticated successfully; if no available server accepted the player.

HasLink(IPlayer)

Determines whether the specified player has an active link to a backend server.

bool HasLink(IPlayer player)

Parameters

player IPlayer

The player to check.

Returns

bool

true if the player has an active link; otherwise, false.

Attempts to retrieve the active link for the specified player. A link is considered active once authentication has completed and traffic forwarding has started.

bool TryGetLink(IPlayer player, out ILink? link)

Parameters

player IPlayer

The player whose active link to look up.

link ILink?

When this method returns true, contains the player’s active link; otherwise, null.

Returns

bool

true if an active link was found; otherwise, false.

Attempts to retrieve a link for the specified player that is currently in the authentication phase and has not yet been promoted to an active link. A weak link is created at the start of the connection attempt and exists until authentication either succeeds — at which point it also becomes an active link — or fails.

bool TryGetWeakLink(IPlayer player, out ILink? link)

Parameters

player IPlayer

The player whose pending link to look up.

link ILink?

When this method returns true, contains the player’s pending link; otherwise, null.

Returns

bool

true if a pending link was found; otherwise, false.