FlowerWrong / tun2socks

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

socks connect request fail #55

Closed JayBitron closed 5 years ago

JayBitron commented 5 years ago

Hello, as soon I try to resolve a domain with 8.8.8.8 it crashes:

root@localhost:/usr/local/scripts# ./tun2socks --config=tun2socks.ini
2019/02/04 03:07:22 main.go:37: [app] config file path is tun2socks.ini
2019/02/04 03:07:22 proxies.go:62: [proxies] default proxy: "B"
2019/02/04 03:07:22 tun_linux.go:29: [tun] interface name is tun0
2019/02/04 03:07:22 cmd.go:14: [command] ifconfig tun0 198.18.0.0 netmask 255.254.0.0
2019/02/04 03:07:22 cmd.go:14: [command] route add -net 198.18.0.0/15 dev tun0
2019/02/04 03:07:22 cmd.go:14: [command] route add -net 91.108.4.0/22 dev tun0
2019/02/04 03:07:22 cmd.go:14: [command] route add -net 91.108.56.0/22 dev tun0
2019/02/04 03:07:22 cmd.go:14: [command] route add -net 109.239.140.0/24 dev tun0
2019/02/04 03:07:22 cmd.go:14: [command] route add -net 149.154.160.0/20 dev tun0
2019/02/04 03:07:22 cmd.go:14: [command] route add -net 149.154.167.0/24 dev tun0
2019/02/04 03:07:22 cmd.go:14: [command] route add -host 8.8.8.8 dev tun0
2019/02/04 03:07:22 cmd.go:14: [command] route add -host 4.4.4.4 dev tun0
2019/02/04 03:07:22 main.go:95: [app] run tun2socks(0.50) success
2019/02/04 03:07:22 cmd.go:36: [shell] run shell command failed exit status 127
2019/02/04 03:07:22 cmd.go:38: [shell] output
2019/02/04 03:07:22 dns.go:12: [dns] listen on 0.0.0.0:53
2019/02/04 03:07:37 udp2socks5.go:126: [error] socks connect request fail, retcode: 7
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x52 pc=0x8529f4]

goroutine 38 [running]:
github.com/FlowerWrong/tun2socks/tun2socks.(*UDPTunnel).Run(0x0, 0xc4202201e0, 0x1d, 0x1d, 0x0)
        /Users/kingyang/go/src/github.com/FlowerWrong/tun2socks/tun2socks/udp2socks5.go:158 +0x74
created by github.com/FlowerWrong/tun2socks/tun2socks.(*App).NewUDPEndpointAndListenIt
        /Users/kingyang/go/src/github.com/FlowerWrong/tun2socks/tun2socks/udp.go:76 +0x945

The command I run: nslookup youtube.com 8.8.8.8 but ping 8.8.8.8 works just fine.

I have config it with tor.

Thanks.

FlowerWrong commented 5 years ago

Is your code newest?

JayBitron commented 5 years ago

I use the latest binary file you provided in the releases tab.

FlowerWrong commented 5 years ago

Please compile it by yourself. The releases are outdated.

JayBitron commented 5 years ago

There are many bugs while compiling as I mentioned in #56 that's why I used the binary.

JayBitron commented 5 years ago

Still from the latest it gives me the same error and crashes while using it with tor but there is no problem with shadowsocks, from what I found tor socks doesn't support udp, so there is a problem it here, it should not crash and give some error instead.