FlowerWrong / tun2socks

Redirect tun flow to socks 5 in golang, support tcp and udp.
425 stars 107 forks source link

fail on macOS. operation not permitted. #45

Closed lgh06 closed 5 years ago

lgh06 commented 5 years ago

➜ shine ./excute-global.bash
2018/10/24 19:16:04 main.go:37: [app] config file path is config-global.ini 2018/10/24 19:16:04 proxies.go:62: [proxies] default proxy: "B" 2018/10/24 19:16:04 tun_darwin.go:27: Create tun interface failederror in syscall.RawSyscall(syscall.SYS_CONNECT, ...): operation not permitted

ran darwin binary file from release.

lgh06 commented 5 years ago

it worked after sudo, but no effect. What should I do next? thx.

2018/10/25 10:06:01 main.go:37: [app] config file path is config-global.ini 2018/10/25 10:06:01 proxies.go:62: [proxies] default proxy: "B" 2018/10/25 10:06:01 tun_darwin.go:29: [tun] interface name is utun1 2018/10/25 10:06:01 cmd.go:14: [command] ifconfig utun1 198.18.0.0 198.18.0.0 mtu 1500 netmask 255.254.0.0 up 2018/10/25 10:06:01 cmd.go:14: [command] route -n add -net 198.18.0.0 -netmask 255.254.0.0 -interface utun1 2018/10/25 10:06:01 cmd.go:14: [command] route -n add -net 91.108.4.0 -netmask 255.255.252.0 -interface utun1 2018/10/25 10:06:01 cmd.go:14: [command] route -n add -net 91.108.56.0 -netmask 255.255.252.0 -interface utun1 2018/10/25 10:06:01 cmd.go:14: [command] route -n add -net 109.239.140.0 -netmask 255.255.255.0 -interface utun1 2018/10/25 10:06:01 cmd.go:14: [command] route -n add -net 149.154.160.0 -netmask 255.255.240.0 -interface utun1 2018/10/25 10:06:01 cmd.go:14: [command] route -n add -net 149.154.167.0 -netmask 255.255.255.0 -interface utun1 2018/10/25 10:06:01 cmd.go:14: [command] route -n add -host 8.8.8.8 -interface utun1 2018/10/25 10:06:01 cmd.go:14: [command] route -n add -host 4.4.4.4 -interface utun1 2018/10/25 10:06:01 main.go:95: [app] run tun2socks(0.50) success 2018/10/25 10:06:01 cmd.go:38: [shell] output Current active networkservice is Wi-Fi, C6E2D63D-FE86-4B13-920D-BCDCEA52904E old dns is 127.0.0.1, set dns to 127.0.0.1 2018/10/25 10:06:01 dns.go:12: [dns] listen on 0.0.0.0:53

FlowerWrong commented 5 years ago

Did you have ran a socks server in local or in the vps? see socks 5 replay server config

My env:

  1. start ss-server in vps
  2. start ss-local in 127.0.0.1:1080
  3. start tun2socks with proxy config url = socks5://127.0.0.1:1080
lgh06 commented 5 years ago

I have updated my log posted above.
I can ensure my socks5 proxy works fine and my SwichyOmega works fine and I changed its config file to the right ip&port.

Do I need further steps?
and after I control+C to stop tun2socks, I must change my DNS to previous setting manually...

lgh06 commented 5 years ago

I know ss-local runs on my mac & ss-server runs on remote VPS.... I am not a noob...

How I can debug it... or how I can trace it worked or not, on my mac setting or another command line?...

FlowerWrong commented 5 years ago
  1. You can test the local dns server. dig @127.0.0.1 google.com, it will return a fake ip like 192.18.0.123 if it worked.
  2. restart you local socks5 proxy with debug mode. curl google.com has log or not?
  3. restart you remote proxy server with debug mode. curl google.com has log or not?

If you are familiar with golang, you can write some logs by yourself.

How tun2socks works?

FlowerWrong commented 5 years ago

I am sorry. this app is broken now.

FlowerWrong commented 5 years ago

@lgh06 It worked now. fix commit

lgh06 commented 5 years ago

I will try.