Skip to content

Commit

Permalink
expose procy api for client
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryjiang committed Sep 1, 2024
1 parent 1968619 commit 140fe6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/SuperSocket.Client/EasyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public class EasyClient<TReceivePackage> : IEasyClient<TReceivePackage>

protected IConnection Connection { get; private set; }

public IConnector Proxy { get; set; }

protected ILogger Logger { get; set; }

protected ConnectionOptions Options { get; private set; }
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions src/SuperSocket.Client/IEasyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public interface IEasyClient<TReceivePackage, TSendPackage> : IEasyClient<TRecei
public interface IEasyClient<TReceivePackage>
where TReceivePackage : class
{
IConnector Proxy { get; set; }

ValueTask<bool> ConnectAsync(EndPoint remoteEndPoint, CancellationToken cancellationToken = default);

ValueTask<TReceivePackage> ReceiveAsync();
Expand Down

0 comments on commit 140fe6a

Please sign in to comment.