1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-07 16:06:15 +00:00

change SetProxy method to support socks5 proxy.

This commit is contained in:
Mohammad Reza 2022-04-07 12:44:12 +04:30
parent 41f38e040e
commit 4db43517b7

View File

@ -212,9 +212,12 @@ namespace CryptoExchange.Net.Sockets
/// <inheritdoc /> /// <inheritdoc />
public virtual void SetProxy(ApiProxy proxy) public virtual void SetProxy(ApiProxy proxy)
{ {
_socket.Options.Proxy = new WebProxy(proxy.Host, proxy.Port);
if (proxy.Login != null) _socket.Options.Proxy = new WebProxy
_socket.Options.Proxy.Credentials = new NetworkCredential(proxy.Login, proxy.Password); {
Address = new Uri($"{proxy.Host}:{proxy.Port}"),
Credentials = proxy.Password == null ? null : new NetworkCredential(proxy.Login, proxy.Password)
};
} }
/// <inheritdoc /> /// <inheritdoc />