justcoding121 / titanium-web-proxy

A cross-platform asynchronous HTTP(S) proxy server in C#.
MIT License
1.92k stars 598 forks source link

Set SOCKS5 as up stream proxy for localhost SOCKS proxy #875

Open thaiquangquy opened 2 years ago

thaiquangquy commented 2 years ago

I am trying to set an upstream proxy for the localhost proxy. In order to to achieve: Client -> localhost proxy -> upstream proxy -> internet.

Setting the upstream with HTTPS proxy works fine but when I use SOCKS5 as upstream proxy, nothing works. Below is the code. What am I missing here?

        proxyServer.UpStreamHttpProxy = new ExternalProxy
        {
            HostName = "88.202.177.242",
            Port = 1085,
            ProxyType = ExternalProxyType.Socks5
        };

        proxyServer.UpStreamHttpsProxy = new ExternalProxy
        {
            HostName = "88.202.177.242",
            Port = 1085,
            ProxyType = ExternalProxyType.Socks5
        };

        var socksEndPoint = new SocksProxyEndPoint(IPAddress.Any, 1080, true)
        {
            // Generic Certificate hostname to use
            // When SNI is disabled by client
            //GenericCertificateName = "google.com"
        };

        proxyServer.AddEndPoint(socksEndPoint);
trontronicent commented 2 years ago

As I dont see your whole code: