mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-10 17:36:19 +00:00
Fix for setting proxy on socket
This commit is contained in:
parent
d3cd128ca8
commit
0229405775
@ -29,6 +29,7 @@ namespace CryptoExchange.Net.Sockets
|
||||
|
||||
protected IDictionary<string, string> cookies;
|
||||
protected IDictionary<string, string> headers;
|
||||
protected HttpConnectProxy proxy;
|
||||
|
||||
public int Id { get; }
|
||||
public DateTime? DisconnectTime { get; set; }
|
||||
@ -194,6 +195,10 @@ namespace CryptoExchange.Net.Sockets
|
||||
EnableAutoSendPing = true,
|
||||
AutoSendPingInterval = 10
|
||||
};
|
||||
|
||||
if (proxy != null)
|
||||
socket.Proxy = proxy;
|
||||
|
||||
socket.Security.EnabledSslProtocols = SSLProtocols;
|
||||
socket.Opened += (o, s) => Handle(openHandlers);
|
||||
socket.Closed += (o, s) => Handle(closeHandlers);
|
||||
@ -253,7 +258,7 @@ namespace CryptoExchange.Net.Sockets
|
||||
|
||||
public virtual void SetProxy(string host, int port)
|
||||
{
|
||||
socket.Proxy = IPAddress.TryParse(host, out var address)
|
||||
proxy = IPAddress.TryParse(host, out var address)
|
||||
? new HttpConnectProxy(new IPEndPoint(address, port))
|
||||
: new HttpConnectProxy(new DnsEndPoint(host, port));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user