Skip to content

Add SOCKS5 forward proxy support(Redoed)

shelikhoo requested to merge shelikhoo/snowflake:dev-proxy-outbound-next into main

This change adds SOCKS5 forward proxy support to the snowflake. If TOR_PT_PROXY is set, and the value corresponds to a SOCKS5 proxy, the snowflake will use this proxy for communication with broker and proxy.

This is a merge request with a redo based rebase of !64 (closed) . I am happy this time no fork is necessary to get everything working, maybe the wait is worth it after all.

Things to look at:

  • in order to avoid more arguments, 1.1.1.1 was set as default socks5 dns resolver. we could add a setting to override this.
  • only SOCKS5 proxy are supported. HTTP proxy is not supported.

How to test if it is working:

The Socks5 proxy support is tested to work with v2ray v5.8.0's socks socks inbound with correct setting. To run a working local socks5 proxy, run ./v2ray run -format jsonv5 -c socks2freedom.json, with the following content as v2ray configuration file saved as a file named socks2freedom.json.

{
  "log": {
    "error": {
      "level": "Debug",
      "type": "Console"
    },
    "access": {
      "type": "None"
    }
  },
  "outbounds": [
    {
      "protocol": "freedom"
    }
  ],
  "inbounds": [
    {
      "protocol": "socks",
      "settings": {
        "udpEnabled": true,
        "address": "127.0.0.1",
        "packetEncoding":"Packet"
      },
      "port": 10808
    }
  ]
}

Add line Socks5Proxy 127.0.0.1:10808 to the torrc file to enable it.

(Subtask of #40069 (closed))

(Note to self: remember to rebase before merge)

Edited by shelikhoo

Merge request reports

Loading