xjasonlyu / tun2socks

tun2socks - powered by gVisor TCP/IP stack
https://github.com/xjasonlyu/tun2socks/wiki
GNU General Public License v3.0
3.13k stars 433 forks source link

[Feature] Instructions for a local socks proxy #158

Closed iopq closed 1 year ago

iopq commented 2 years ago

Description

I think the sample configuration might be breaking my local proxy since it affects its own routing

Is this feature related to a specific bug?

No response

Do you have a specific solution in mind?

Include a sample config to use with an already existing proxy running on the same machine

iopq commented 2 years ago

https://dev.to/jadolg/tunneling-all-your-internet-connections-through-a-socks-proxy-4f5i

the step that's missing for me is ensuring the local proxy still connects through the default gateway

ip r a $server_ip via $default_gateway

iopq commented 2 years ago

https://dev.to/jadolg/tunneling-all-your-internet-connections-through-a-socks-proxy-4f5i

I saw this website so I adapted some of the steps, here are all of them:

  sudo ip tuntap add mode tun dev tun0
  sudo ip addr add 198.18.0.1/15 dev tun0
  sudo ip link set dev tun0 up

  curl --socks5 socks5://localhost:1080 https://myip.wtf/json

  sudo ip route del default
  sudo ip route add default via 198.18.0.1 dev tun0 metric 1
  sudo ip route add default via $your_gateway dev wlp38s0 metric 10

  sudo ip r a $remote_proxy_address via $your_gateway
  tun2socks -device tun0 -proxy socks5://127.0.0.1:1080 -interface wlp38s0

where wlp38s0 is my wifi interface

4-FLOSS-Free-Libre-Open-Source-Software commented 2 years ago
  tun2socks -device tun0 -proxy socks5://127.0.0.1:1080 -interface wlp38s0

where wlp38s0 is my wifi interface

No, see:

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

jseparovic commented 1 year ago

Did anyone get this working with a local socks proxy? I can't seem to avoid looping after trying a few different suggestions.

iopq commented 1 year ago

The best implementation is here

https://github.com/v2rayA/v2rayA/blob/25975fb8e57a882fa5147ab93a6974317ebcdfba/service/core/iptables/tproxy.go#L68

I just switched to using this program directly, but using a fork for xray