using LumaTunnel.Shared.Models; namespace LumaTunnel.Client.Core.Abstractions; public interface IProxyConnector { ValueTask ConnectAsync(ProxyTarget target, CancellationToken cancellationToken = default); } public interface IHalfCloseable { ValueTask HalfCloseWriteAsync(CancellationToken cancellationToken = default); } public interface IRoutingService { ProxyMode Mode { get; set; } IReadOnlyList Rules { get; } void SetRules(IEnumerable rules); RouteAction Resolve(ProxyTarget target); } public interface ITunnelService : IAsyncDisposable { bool IsConnected { get; } event EventHandler? ConnectionStateChanged; Task ConnectAsync(TunnelCredentials credentials, CancellationToken cancellationToken = default); ValueTask OpenStreamAsync(ProxyTarget target, CancellationToken cancellationToken = default); Task DisconnectAsync(CancellationToken cancellationToken = default); } public sealed record TunnelCredentials(Uri TunnelUri, string DeviceId, string DeviceToken, string ClientVersion); public interface IProxyEngineService : IAsyncDisposable { bool IsRunning { get; } IReadOnlyCollection Connections { get; } event EventHandler? ConnectionsChanged; Task StartAsync(ProxyEngineOptions options, CancellationToken cancellationToken = default); Task StopAsync(CancellationToken cancellationToken = default); } public sealed record ProxyConnectionInfo( Guid Id, string Protocol, ProxyTarget Target, RouteAction Route, DateTimeOffset StartedAtUtc, long UploadBytes, long DownloadBytes); public interface INodeManagerService : IAsyncDisposable { NodeProfile? ActiveNode { get; } IReadOnlyList Nodes { get; } event EventHandler? ActiveNodeChanged; void SetNodes(IEnumerable nodes); Task ConnectBestAsync(CancellationToken cancellationToken = default); Task StartMonitoringAsync(CancellationToken cancellationToken = default); Task StopMonitoringAsync(CancellationToken cancellationToken = default); }