Skip to content

Interface ILink

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

Represents an active bidirectional forwarding session between a player and a backend Minecraft server.

public interface ILink : IEventListener, IAsyncDisposable

Implements

IEventListener, IAsyncDisposable

Extension Methods

LinkExtensions.SendPacketAsync<T>(ILink, CancellationToken), LinkExtensions.SendPacketAsync<T>(ILink, T, CancellationToken), LinkExtensions.SendPacketAsync<T>(ILink, Side, T, CancellationToken)

Remarks

A link owns two instances — one toward the player and one toward the server — and drives two concurrent forwarding loops that relay objects between them. Each inbound message is surfaced through the event system before being written to the opposite channel, allowing plugins to inspect or cancel individual packets. The link stops naturally when either side closes its connection, and raises followed by with the appropriate .

Properties

Channels

Gets an enumerable containing both and .

IEnumerable<INetworkChannel> Channels { get; }

Property Value

IEnumerable<INetworkChannel>

IsAlive

Gets a value indicating whether both forwarding tasks are still running.

bool IsAlive { get; }

Property Value

bool

Player

Gets the player whose client connection is being proxied through this link.

IPlayer Player { get; }

Property Value

IPlayer

PlayerChannel

Gets the network channel that faces the player’s client.

INetworkChannel PlayerChannel { get; }

Property Value

INetworkChannel

Server

Gets the backend server that the player is currently connected to through this link.

IServer Server { get; }

Property Value

IServer

ServerChannel

Gets the network channel that faces the backend server.

INetworkChannel ServerChannel { get; }

Property Value

INetworkChannel

Methods

StartAsync(CancellationToken)

Starts the bidirectional forwarding loops that relay network messages between the player and the server.

ValueTask StartAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A token that can be used to cancel the start operation.

Returns

ValueTask

Exceptions

InvalidOperationException

Thrown when the link has already been started.

StopAsync(CancellationToken)

Requests an orderly shutdown of both forwarding loops and waits for them to drain.

ValueTask StopAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A token that can be used to cancel the stop operation.

Returns

ValueTask

Exceptions

InvalidOperationException

Thrown when the link has not been started yet.