titanium-web-proxy icon indicating copy to clipboard operation
titanium-web-proxy copied to clipboard

Set SOCKS5 as up stream proxy for localhost SOCKS proxy

Open thaiquangquy opened this issue 3 years ago • 1 comments

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);

thaiquangquy avatar Aug 01 '21 08:08 thaiquangquy

As I dont see your whole code:

  • You use SSLDecryption, this sets higher requirements..
  • Did you ensure that the rootCert is created and properly assigned & trusted? Try without decryptSsl: true, if it works, you limit the possible sources of evil.
  • Did you set ForwardToUpstreamGateway = true ? Defaults to false, so dont forget it.
  • Did you set any "exotic/problematic" options? Like Enable100ContinueBehaviour = true ?

Still issues with the upstream proxy?

  • Add a handling method for CustomUpstreamProxyFailure and get more data from SessionEventArgsBase - Exception property might be very useful.
  • Post more code context.

When I started working with this awesome code product, I had such issues nonstop... the fact that there are no documentary comments in the code base didnt make it better. The data from the external api doc - https://justcoding121.github.io/titanium-web-proxy/docs/api/Titanium.Web.Proxy.ProxyServer.html - I would have loved (and still would love) to have inside the code base...

trontronicent avatar Sep 12 '21 05:09 trontronicent