Seji64 / SniDust

SmartDNS Proxy to hide your GeoLocation. Based on DnsDist and nginx
GNU General Public License v3.0
156 stars 43 forks source link

Localhost socks5 #35

Closed iriszz1 closed 10 months ago

iriszz1 commented 1 year ago

hi~

how do i make sniproxy use localhost socks5 proxy for http/s upstream? it seems like docker cant access local proxy.

is there any workaround to get sniproxy use socks5?

alstolten commented 11 months ago

Hi @iriszz1 took me some time. It only works if you attach the snidust container to the host network. In addition you need to pass the environment variable SNIPROXY_GENERAL__UPSTREAM_SOCKS5 to the container. So if you use:

~~docker run --network=host -e SNIPROXY_GENERAL__UPSTREAM_SOCKS5="socks5://localhost:<socks-port>" ...~~

the container will run in the host network context, ie can reach localhost and other addresses reachable by the host.

Sorry, the above won't work, my bad. --network=host will force snidust to resolve all names to localhost. What works though if you keep the other option, ssh into the container and open a socks5 proxy from within the container, eg. with ssh -D. (side note, you need to install ssh first, with apk add openssh)