Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] SOCKS5 commands for Tor: "0xF0" (Tor resolving) "0xF1" (Tor resolving PTR) #30

Open
przemyslaw0 opened this issue Jan 12, 2025 · 2 comments

Comments

@przemyslaw0
Copy link

This feature would allow clients to perform DNS lookups directly in the Bridge SOCKS5 port by sending to a upstream Tor SOCKS5 port (with -p socks5h://[...]), so, torsocks and tor-resolve command would work with Bridge.

It's already implemented in V2RAY.
This little project, Tor-DNS, also implements it.

Bridge doesn't recognize commands 0xF0 and 0xF1 actually:

$ bridge -b socks5h://127.0.0.1:9055 -p - -p socks5h://127.0.0.1:9050
2025/01/12 13:00:25 INFO DIAL "-" <- "socks5h://127.0.0.1:9050" <- LOCAL <- "socks5h://127.0.0.1:9055" LISTEN
 chains="{Bind:[{Probe: LB:[socks5h://127.0.0.1:9055]}] Proxy:[{Probe: LB:[-]} {Probe: LB:[socks5h://127.0.0.1:9050]}] IdleTimeout:0s}"
2025/01/12 13:00:42 INFO Connect chains="{Bind:[{Probe: LB:[socks5h://127.0.0.1:9055]}] Proxy:[{Probe: LB:[-]} {Probe: LB:[socks5h://127.0.0.1:9050]}] IdleTimeout:0s}" remote_address=127.0.0.1:49906
2025/01/12 13:00:42 INFO unsupported Command: socks 240
 chains="{Bind:[{Probe: LB:[socks5h://127.0.0.1:9055]}] Proxy:[{Probe: LB:[-]} {Probe: LB:[socks5h://127.0.0.1:9050]}] IdleTimeout:0s}"
2025/01/12 13:01:07 INFO Connect chains="{Bind:[{Probe: LB:[socks5h://127.0.0.1:9055]}] Proxy:[{Probe: LB:[-]} {Probe: LB:[socks5h://127.0.0.1:9050]}] IdleTimeout:0s}" remote_address=127.0.0.1:53336
2025/01/12 13:01:07 INFO unsupported Command: socks 240
 chains="{Bind:[{Probe: LB:[socks5h://127.0.0.1:9055]}] Proxy:[{Probe: LB:[-]} {Probe: LB:[socks5h://127.0.0.1:9050]}] IdleTimeout:0s}"
2025/01/12 13:01:07 INFO Connect chains="{Bind:[{Probe: LB:[socks5h://127.0.0.1:9055]}] Proxy:[{Probe: LB:[-]} {Probe: LB:[socks5h://127.0.0.1:9050]}] IdleTimeout:0s}" remote_address=127.0.0.1:53348
2025/01/12 13:01:07 INFO unsupported Command: socks 240
 chains="{Bind:[{Probe: LB:[socks5h://127.0.0.1:9055]}] Proxy:[{Probe: LB:[-]} {Probe: LB:[socks5h://127.0.0.1:9050]}] IdleTimeout:0s}"
$ tor-resolve -p 9055 g.co
Jan 12 13:00:42.625 [warn] Got SOCKS5 status response '7': command not supported
@wzshiming
Copy link
Owner

I've tested it, and both Tor Over Bridge and Bridge Over Tor seem to work.

# Proxy 1
bridge -b :1087 -p - -p xxxxxxx
# Test proxy 1
curl --socks5-hostname 127.0.0.1:1087 https://google.com
# Proxy 2 Tor Over Bridge
# ~/.torrc
# Socks5Proxy 127.0.0.1:1087
tor 
# Test proxy 2
curl --socks5-hostname 127.0.0.1:9050 https://google.com
# Proxy 3 Bridge Over Tor
bridge -b socks5://127.0.0.1:9055 -p - -p socks5h://127.0.0.1:9050
# Note that socks5 instead of socks5h with -b
# Test proxy 3
curl --socks5-hostname 127.0.0.1:9055 https://google.com

@przemyslaw0
Copy link
Author

CURL works with Bridge+Tor, but torsocks doesn't. Implementing support for Tor specific SOCKS5 commands would be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants