From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- .../src/Impostor.Api/Net/IHazelConnection.cs | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Impostor-dev/src/Impostor.Api/Net/IHazelConnection.cs (limited to 'Impostor-dev/src/Impostor.Api/Net/IHazelConnection.cs') diff --git a/Impostor-dev/src/Impostor.Api/Net/IHazelConnection.cs b/Impostor-dev/src/Impostor.Api/Net/IHazelConnection.cs new file mode 100644 index 0000000..4e6c4b3 --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Net/IHazelConnection.cs @@ -0,0 +1,41 @@ +using System.Net; +using System.Threading.Tasks; +using Impostor.Api.Net.Messages; + +namespace Impostor.Api.Net +{ + /// + /// Represents the connection of the client. + /// + public interface IHazelConnection + { + /// + /// Gets the IP endpoint of the client. + /// + IPEndPoint EndPoint { get; } + + /// + /// Gets a value indicating whether the client is connected to the server. + /// + bool IsConnected { get; } + + /// + /// Gets the client of the connection. + /// + IClient? Client { get; set; } + + /// + /// Sends a message writer to the connection. + /// + /// The message. + /// + ValueTask SendAsync(IMessageWriter writer); + + /// + /// Disconnects the client and invokes the disconnect handler. + /// + /// A reason. + /// + ValueTask DisconnectAsync(string? reason); + } +} \ No newline at end of file -- cgit v1.1-26-g67d0