mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-23 07:04:26 +01:00
Remove internal socks http proxy and use .net60 socks support (#3240)
This commit is contained in:
@@ -1,14 +1,22 @@
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.HostedServices;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
{
|
||||
public class Socks5HttpClientHandler : HttpClientHandler
|
||||
{
|
||||
public Socks5HttpClientHandler(Socks5HttpProxyServer sock5)
|
||||
public Socks5HttpClientHandler(BTCPayServerOptions opts)
|
||||
{
|
||||
this.Proxy = new WebProxy(sock5.Uri);
|
||||
if (opts.SocksEndpoint is IPEndPoint endpoint)
|
||||
{
|
||||
this.Proxy = new WebProxy($"socks5://{endpoint.Address}:{endpoint.Port}");
|
||||
}
|
||||
else if (opts.SocksEndpoint is DnsEndPoint endpoint2)
|
||||
{
|
||||
this.Proxy = new WebProxy($"socks5://{endpoint2.Host}:{endpoint2.Port}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user