From 140fe6a50fd5ddb7a02c00a1dee7c1090d06e53e Mon Sep 17 00:00:00 2001 From: Kerry Jiang Date: Sun, 1 Sep 2024 14:58:50 -0700 Subject: [PATCH] expose procy api for client --- src/SuperSocket.Client/EasyClient.cs | 7 +++++++ src/SuperSocket.Client/IEasyClient.cs | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/SuperSocket.Client/EasyClient.cs b/src/SuperSocket.Client/EasyClient.cs index 1910a0a63..c1ec3c488 100644 --- a/src/SuperSocket.Client/EasyClient.cs +++ b/src/SuperSocket.Client/EasyClient.cs @@ -57,6 +57,8 @@ public class EasyClient : IEasyClient protected IConnection Connection { get; private set; } + public IConnector Proxy { get; set; } + protected ILogger Logger { get; set; } protected ConnectionOptions Options { get; private set; } @@ -120,6 +122,11 @@ protected virtual IConnector GetConnector() connectors.Add(new SslStreamConnector(security)); } + if (Proxy is IConnector proxy) + { + connectors.Add(proxy); + } + if (CompressionLevel != CompressionLevel.NoCompression) { connectors.Add(new GZipConnector(CompressionLevel)); diff --git a/src/SuperSocket.Client/IEasyClient.cs b/src/SuperSocket.Client/IEasyClient.cs index df101601b..f0336ffc3 100644 --- a/src/SuperSocket.Client/IEasyClient.cs +++ b/src/SuperSocket.Client/IEasyClient.cs @@ -16,6 +16,8 @@ public interface IEasyClient : IEasyClient where TReceivePackage : class { + IConnector Proxy { get; set; } + ValueTask ConnectAsync(EndPoint remoteEndPoint, CancellationToken cancellationToken = default); ValueTask ReceiveAsync();