Code Monkey home page Code Monkey logo

go-tun2socks's Introduction

go-tun2socks

Build Status

A tun2socks implementation written in Go.

If you're looking for an easy to use tun2socks implementation for iOS, you might be interested in leaf and ileaf. leaf implements tun2socks and it's written in Rust, with significantly less memory usage and significantly better performance compares to the Go version.

To run the tun2socks command line program, depending on OS, you may need to run it as root, create the TUN interface and/or configure IP address of the interface manually. Moreover, you should add corresponding routes to the routing table manually. Mind that you often want to use some different system DNS resolvers, and your proxy server should support UDP.

To use go-tun2socks as a library in your own project, refer to the following files/repos for some ideas:

It's recommended to write your own SOCKS layer. For example, you can create a "tun2shadowsocks" program by implementing a Shadowsocks handler, see https://github.com/Jigsaw-Code/outline-go-tun2socks/tree/master/shadowsocks

It's also recommended to write your own TUN layer to connect the TUN interface and go-tun2socks, see https://github.com/eycorsican/go-tun2socks/tree/master/tun for examples.

The following projects are using go-tun2socks:

go-tun2socks's People

Contributors

alalamav avatar czxichen avatar darienraymond avatar eycorsican avatar lucashanmail avatar zyc9012 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-tun2socks's Issues

socks代理

貌似不支持指定socks代理的用户名密码?

关于ipv6

测试发现 ipv6 数据包处理后并没用回调到 TCPAcceptFn,不知道如果添加IPv6 支持的话,lwip是否也也需要做一些改动。
//export TCPAcceptFn
func TCPAcceptFn(arg unsafe.Pointer, newpcb *C.struct_tcp_pcb, err C.err_t) C.err_t {...}

内存增长太快,导致iOS Network Extension触发内存限制(15M)崩溃

作者你好!
导入库到iOS Network Extension中,启用后,只要有请求,内存就会增长,Network Extension有15M内存限制的问题,导致该进程被系统杀死。我们编译库时已开启go的内存回收功能,但是内存还是会增长,当然比不开启效果好一些。
请问你有什么好的方法处理这个问题吗?你在Kitsunebi这个APP中是怎么处理这个问题的呢?

UDP 报文增多时出现 `socket: too many open files`

环境描述

客户端配置 /etc/v2ray/config.json 使用 VMESS+WS+TLS+CDN

{
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 1080,
      "protocol": "socks",
      "sniffing": {
        "enabled": false,
        "destOverride": ["http", "tls"]
    },
      "settings": {
        "auth": "noauth",
        "udp": true
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "${EDGE_HOSTNAME}",
            "port": 443,
            "users": [
              {
                "id": "${UUID}",
                "alterId": 32
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "wsSettings": {
          "connectionReuse": true,
          "path": "/ws/",
          "headers": null
        }
      },
      "mux": {"enabled": true}
    },
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "adblock"
    }
  ],
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules": [
      {
        "type": "field",
        "domain": [
          "googeadsserving.cn"
        ],
        "outboundTag": "adblock"
      },
      {
        "type": "field",
        "ip": [
          "geoip:private",
          "geoip:cn"
        ],
        "outboundTag": "direct"
      }
    ]
  }
}

客户端启动脚本和相关描述

# 内核开启转发功能
sysctl -w net.ipv4.ip_forward=1

# 确保 tun2socks 使用的代理服务器直接访问
ip route add x.x.x.x/32 via 192.168.158.2

# 启动 tun2socks 并使用 v2ray 代理并指定 v2ray 配置
./build/tun2socks -tunName tun1 -tunAddr 240.0.0.2 -tunGw 240.0.0.1 -tunMask 255.255.255.0 -proxyType v2ray -vconfig "/etc/v2ray/config.json" -applog

# 给 tun1 配置 IP 地址并且使之上线
ip addr add 240.0.0.1 dev tun1
ip link set dev tun1 up

# 调整缺省路由表
ip route add 0.0.0.0/1 via 240.0.0.1
ip route add 128.0.0.0/1 via 240.0.0.1

配置后通过 curl ip.sb 能看到已经是通过代理服务器访问。

现象描述

当流量增长的时候(特别是 UDP 流量) go-tun2socks 报错

2019/02/16 10:19:13 [unknown process] is connecting udp:x.x.x.x:xxxx
2019/02/16 10:19:13 [unknown process] is connecting udp:x.x.x.x:xxxx
2019/02/16 10:19:13 [unknown process] is connecting udp:x.x.x.x:xxxx
2019/02/16 10:19:13 [Warning] failed to handler mux client connection > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://xxx.xxx/ws/):  > dial tcp x.x.x.x:443: socket: too many open files] > v2ray.com/core/common/retry: all retry attempts failed
2019/02/16 10:19:13 [unknown process] is connecting udp:x.x.x.x:xxxx

已经开启了 muxconnectionReuse 都没有什么缓解。

Module compatibility

go modules are not writable when downloaded to $GOPATH/mod/. For this reason, the make copy action, which copies LWIP header and source files for every build action, is not compatible with go modules, when go-tun2socks is used as a dependency.

  • What is the motivation for copying the LWIP files?
  • Would it be possible to include them directly from the LWIP directory?

Thanks.

建议增加一个Fake DNS的功能

有个想法,tun2socks进程监听53端口,并对dns查询回复如124.0.0.1之类的唯一的internal IP,然后将124.0.0.1的tcp连接或者udp包直接以socks5 domian的类型转发给socks server,就避免了dns 污染或者自建dns server的麻烦。

Logging levels

Unconditional logging can hurt performance and increase memory utilization. Given that golang's log package does not support logging levels (i.e. Error, Warning, Info, Debug), we should consider migrating to a configurable logging library.

Mature and widely used implementations include:

@eycorsican, I'm happy to implement this change as soon as we decide on a library.

如何在iOS中使用?gomobile 编译后执行报错「operation not permitted」

tun/* 目录中,并没有tun_ios.go的实现,使用gomobile编译后,在运行中执行到

#github.com/songgao/water/syscalls_darwin.go

if _, _, errno := syscall.RawSyscall(syscall.SYS_CONNECT, uintptr(fd), uintptr(addrP), uintptr(sockaddrCtlSize)); errno != 0 {
	err = errno
	return nil, fmt.Errorf("error in syscall.RawSyscall(syscall.SYS_CONNECT, ...): %v", err)
}

会返回错误「operation not permitted」

是否有什么变通的方式可以实现?

如果使用ss的本地socks5代理貌似不行

route add 0.0.0.0 mask 0.0.0.0 10.0.0.1 metric 6
route add 127.0.0.1 192.168.0.1 metric 5
.\tun2socks-windows-4.0-amd64.exe -tunAddr 10.0.0.2 -tunGw 10.0.0.1 -proxyType socks -proxyServer 127.0.0.1:1080
#127.0.0.1:1080为shadowsocks客户端侦听的端口

以上三个命令执行完之后就上不了网了,看了网卡状态信息都没问题!!

使用远程的shadowsocks服务端代理
.\tun2socks-windows-4.0-amd64.exe -tunAddr 10.0.0.2 -tunGw 10.0.0.1 -proxyType socks -proxyServer x.xxx.xx.x8:1111 -proxyCipher CHACHA20-IETF -proxyPassword xxxx -proxyType shadowsocks
没有问题

routing

released exec windows still using ip route Linux by default?,
2019/01/14 23:35:32 device name: Ethernet 2
2019/01/14 23:35:33 set Ethernet 2 with net/mask: 240.0.0.2/255.255.255.0 through DHCP
2019/01/14 23:35:33 set Ethernet 2 with dns: 114.114.114.114,223.5.5.5 through DHCP

Support Cone NAT

The NAT type for UDP connections is Symmetric NAT at the moment. We should be able to shift to another more flexible NAT type in the future, e.g. Restricted Cone NAT.

LWIP编译失败

             from ../../lwip/input.go:5:

../../lwip/src/include/lwip/arch.h:119: error: redefinition of typedef 'u8_t'
../../lwip/src/include/arch/cc_others.h:46: note: previous declaration of 'u8_t' was here
../../lwip/src/include/lwip/arch.h:120: error: redefinition of typedef 's8_t'
../../lwip/src/include/arch/cc_others.h:47: note: previous declaration of 's8_t' was here
../../lwip/src/include/lwip/arch.h:121: error: redefinition of typedef 'u16_t'
../../lwip/src/include/arch/cc_others.h:48: note: previous declaration of 'u16_t' was here
../../lwip/src/include/lwip/arch.h:122: error: redefinition of typedef 's16_t'
../../lwip/src/include/arch/cc_others.h:49: note: previous declaration of 's16_t' was here
../../lwip/src/include/lwip/arch.h:123: error: redefinition of typedef 'u32_t'
../../lwip/src/include/arch/cc_others.h:50: note: previous declaration of 'u32_t' was here
../../lwip/src/include/lwip/arch.h:124: error: redefinition of typedef 's32_t'
../../lwip/src/include/arch/cc_others.h:51: note: previous declaration of 's32_t' was here

能否提供个windows下的 makefile .谢谢

tun2socks的UDP包貌似有转发问题

tun2socks用的是最新的v1.11.1版本,用的是socks handler,参数是

-tunName $TUN -delayICMP 1 -udpTimeout 2m -proxyType socks -proxyServer $SOCKS

socks server 是v2ray socks inbound,udp已经开启并测试pass

直接 nc 8.8.8.8 53 用tcp连接是可行通过的,并且v2ray log 里也有记录

2019/02/13 20:51:32 tcp:10.0.0.2:55594 accepted tcp:8.8.8.8:53

但是dig baidu.com的时候,tun2socks输出

2019/02/13 12:53:34 new proxy connection for target: udp:223.5.5.5:53
2019/02/13 12:53:35 new proxy connection for target: udp:114.114.114.114:53
2019/02/13 12:53:40 new proxy connection for target: udp:223.5.5.5:53
2019/02/13 12:53:41 new proxy connection for target: udp:114.114.114.114:53

然后dig显示超时。v2ray log里啥都没有。

我检查了很多次配置貌似都没问题啊。

Windows下启动没有网关?

打算用这个加速游戏,下载1.9.0版本、用Tap-windows-9.22.1-I602创建网卡,根据README里的介绍:
tun2socks -tunName tun1 -tunAddr 10.0.0.2 -tunGw 10.0.0.1 -proxyType socks -proxyServer 127.0.0.1:1082
1082端口是SSR的代理入口、可用,
启动后查看网络信息默认网关项为空而且Ping不通,请问如何解决呢?
另外想问一下像这样代理服务器在本地的情况下,该如何配置路由表和其他选项呢?

感谢作者!

Exit when computer wake up from sleep

OS Environment: Windows 10 Pro Version 1809 (Build 17763.316)

Step to Reproduce the Issue:

  1. Install the TAP-Windows Adapter (Version 9.22.1-I602)
  2. Run tun2socks with tun2socks -tunAddr 10.0.0.2 -tunGw 10.0.0.1 -proxyType socks -proxyServer <my socks server> -tunDns <mydns>. All things go well and the computer can access the internet through <my socks server>.
  3. Sleep the laptop.
  4. Wake the laptop after a while.
  5. tun2socks exit with: copying data failed: The I/O operation has been aborted because of either a thread exit or an application request.

Expected Behavior: tun2socks should continue running and attempt to recover all the stuff after waking up the computer.

Thank you very much!

Edited:
After testing, I guess this issue is because windows closed the Virtual Adapter when computer goes to sleep. Because when I manually disable the virtual adapter, tun2socks will quit with the same behavior. So I suggest to add a -daemon or -service option which can force tun2socks continue running even if there is no suitable adapter and trying to reconnect when the adapter is set up.

udp是从socks代理出去的吗

./build/tun2socks -tunName tun1 -tunAddr 240.0.0.2 -tunGw 240.0.0.1 -proxyType socks -proxyServer 127.0.0.1:1080

socks是v2ray的inbound.

发现跑起来后可以正常访问谷歌等外网,icmp ping也可以ping通墙外,但是测试udp的时候不通

我用
dig @8.8.8.8 www.google.com
测试的,一直超时

由于懒得动原来电脑上v2ray的json文件,把v2ray当socks类型的代理用,直接用你的tun2socks socks类型的handler.

这个版本的tun2socks udp转发默认就支持吗?需要特殊设置吗?比如原版badvpn-udpgw

如何转发到目的地,而不是特定远程socks?

我的socks5服务器在本地127.0.0.1运行,它内部实现了ACL,部分访问不会通过特定的远程socks走,而是直接连接目的地,这不会造成死循环吗?

正常的:tun->本地socks->路由->旁路->eth0->远程目的地
死循环:tun->本地socks->路由->未旁路->tun..

macOS无法指定tunName

使用 ./build/tun2socks -tunName tun1 命令指定名称创建新TUN后,指定的名称不生效。仍然按照系统自带的utunx命名(其中x为递增正整数)

macOS版本:10.14.4

编译出错

hi。
cd $GOPATH
go get github.com/eycorsican/go-tun2socks/cmd/tun2socks
cd $GOPATH/src/github.com/eycorsican/go-tun2socks
go get -d ./...
make clean
make build

在make build这步遇错:
...
github.com/eycorsican/go-tun2socks/core
v2ray.com/core/common/net

v2ray.com/core/common/net

../../../../../v2ray.com/core/common/net/system.go:11:21: undefined: net.ListenConfig
github.com/eycorsican/go-tun2socks/proxy/echo
github.com/eycorsican/go-tun2socks/proxy/shadowsocks
github.com/eycorsican/go-tun2socks/proxy/socks
make: *** [Makefile:88: build] Error 2
root@wh:~/go/gopath/src/github.com/eycorsican/go-tun2socks#

如何解决?

window版本能否提供指定网络适配器功能

windows版本遍历网络适配器后,默认选择了第一个找到的tap0901/tap0801的适配器,能否提供一个选项,供使用者指定适配器,如:-tunName "Another TAP Network Adapter"

更改tags版本命名规则以适配go module

go module 只认格式为 v1.0.0, 不认 v1.0
所以导致用go1.11用go mod编译只会下载v1.2.1的版本而忽略v1.8
看是否可以更改一下tags的命名适配一下

虽然目前用 v0.0.0-20180709150244-b83507d68741d2bef572d1a8b7ee8a62d1a374ad 也可以下载最新版,但是这个方法太脏了

貌似nat有问题?

用go-tun2socks玩gta5,在线好友显示为不在线,网络信息显示'nat不可用,udp可能遭禁用'

无法编译为windows可执行文件

修改编译参数(Make文件,行68)为
cd $(CMDDIR) &amp;&amp; GOARCH='386' GOOS='windows' $(GOBUILD) -o $(BUILDDIR)/$(PROGRAM) -v

执行make build编译后报如下错误

github.com/eycorsican/go-tun2socks/cmd/tun2socks

./main.go:44:2: undefined: lwip.Setup
./main.go:58:2: undefined: lwip.RegisterOutputFn
./main.go:71:10: undefined: lwip.Input
make: *** [build] Error 2

socks5 udp延迟会突然变高

使用版本:go-tun2socks 1.82,环境windows 10 x64
代理服务器程序:gost2.6、shadowsocks-libev
游戏:绝地求生
使用tun2socks内置的socks5直连代理服务器,可以正常游戏,但有时延迟会突然飙升一次,然后马上降下来,具体则是在请求某个服务器443端口之后,日志表现如下:
本地gost流,server 为代理服务器

2018/11/20 20:45:55 socks.go:465: [socks5-connect] 127.0.0.1:8793 >-< 34.195.78.241:443
2018/11/20 20:46:28 socks.go:693: [socks5-udp] 127.0.0.1:8775 >-< 127.0.0.1:62755
2018/11/20 20:46:28 socks.go:836: [udp-tun] server:prot -> 0 : read tcp 192.168.1.2:8776->server:prot: use of closed network connection
2018/11/20 20:46:28 socks.go:801: [udp-tun] server:prot <- <nil> : read udp [::]:62755: use of closed network connection
2018/11/20 20:46:29 socks.go:626: [socks5-udp] 127.0.0.1:8802 - [::]:62902 BIND ON 127.0.0.1:62902 OK
2018/11/20 20:46:30 socks.go:686: [socks5-udp] 127.0.0.1:8802 <-> 127.0.0.1:62902 [tun: server:16755]
2018/11/20 20:46:30 socks.go:689: [socks5-udp] 127.0.0.1:8802 <-> 127.0.0.1:62902

tun2socks 流

2018/11/20 20:45:54 new proxy connection for target: tcp:34.195.78.241:443

这种延迟高的问题使用本地socks5中转或公网中转也无法解决,但同一台服务器使用tun2socks内置的shadowsocks连接则不会出现这种情况。

整合V2Ray的可行性

proxy/socks似乎已经做成一个接口了,这个接口可以直接调用core.Dial,从而节省掉socks的开销。不知道在mobile的具体使用上是否可行。

mips版本无法使用

机器是网件3800,使用tun2socks-linux-mips.zip包里的文件,放到/usr/bin/里后,运行显示
-ash: tun2socks-linux-mips: not found
然后尝试使用ldd检查缺少什么库:
root@OpenWrt:~# ldd /usr/bin/tun2socks-linux-mips
/lib/ld.so.1 (0x77f2c000)
libpthread.so.0 => /lib/ld.so.1 (0x77f2c000)
libc.so.6 => /lib/ld.so.1 (0x77f2c000)
Error loading shared library ld.so.1: No such file or directory (needed by /usr/bin/tun2socks-linux-mips)
Error relocating /usr/bin/tun2socks-linux-mips: __fprintf_chk: symbol not found
Error relocating /usr/bin/tun2socks-linux-mips: __printf_chk: symbol not found
Error relocating /usr/bin/tun2socks-linux-mips: __vfprintf_chk: symbol not found

请问是什么问题呢?

使用内置的v2ray好像udp转发有问题

用的最新源码编译的版本,环境是windows 10 x64
使用tun2socks内置的v2ray无法进入吃鸡等需要UDP的游戏,NatTypeTester测试出的NAT类型为Symmetric
如果单独运行v2ray,通过socks5连接到tun2socks则可以正常玩游戏,但是速度会严重下降,使用内置v2ray或者v2ray的socks端口的时候能跑满200M宽带,而通过socks5连接到tun2socks只有50M

1.14.0版本windows-amd64使用一段时间会断流

1.14.0版本windows-amd64使用几分钟就会出现断流情况,需要关闭再重新打开才能使用,过一段时间,又需要重启,反反复复(win10环境)
1.13.0版本windows-amd64使用正常,不会断流(win10环境)

error on compiling for arm32 bit

github.com/eycorsican/go-tun2socks/proxy/socks

proxy/socks/tcp.go:60:37: undefined: core.ParseTCPAddr
proxy/socks/udp.go:101:28: undefined: core.ParseTCPAddr

走udp流量时,报错发生异常。

版本是v1.9.0,我用go1.11.4.linux-arm64自己编译的binary。
我的应用环境是用tun2socks承载openvpn的udp流量,我怀疑是mtu的问题。
我openvpn的tun0的mtu默认用的是1500。因为后端代理的问题,tun2socks的tun1用的mtu是1300。
不知道是不是2个tun的mtu不一样,造成tun2socks触发异常?谢谢!

出错信息如下:

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x5de7c100004d pc=0x980990]

runtime stack:
runtime.throw(0xb66638, 0x2a)
        /usr/local/go/src/runtime/panic.go:608 +0x4c
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:374 +0x2a4

goroutine 8 [syscall]:
runtime.cgocall(0x97e5e8, 0x40000f7d48, 0x29)
        /usr/local/go/src/runtime/cgocall.go:128 +0x48 fp=0x40000f7d10 sp=0x40000f7ce0 pc=0x409018
github.com/eycorsican/go-tun2socks/core._Cfunc_input(0x7f80001060, 0x7f80001000)
        _cgo_gotypes.go:335 +0x3c fp=0x40000f7d40 sp=0x40000f7d10 pc=0x5d2c1c
github.com/eycorsican/go-tun2socks/core.Input.func2(0x7f80001060, 0xc1)
        /root/go/src/github.com/eycorsican/go-tun2socks/core/input.go:23 +0x40 fp=0x40000f7d70 sp=0x40000f7d40 pc=0x5d8000
github.com/eycorsican/go-tun2socks/core.Input(0x400016c000, 0xc1, 0x5dc, 0x0, 0x0, 0x0)
        /root/go/src/github.com/eycorsican/go-tun2socks/core/input.go:23 +0x70 fp=0x40000f7db0 sp=0x40000f7d70 pc=0x5d4370
github.com/eycorsican/go-tun2socks/core.(*lwipStack).Write(0x4000069950, 0x400016c000, 0xc1, 0x5dc, 0x4000010080, 0x400016c000, 0x5dc)
        /root/go/src/github.com/eycorsican/go-tun2socks/core/lwip.go:77 +0x30 fp=0x40000f7df0 sp=0x40000f7db0 pc=0x5d4660
github.com/eycorsican/go-tun2socks/filter.(*icmpFilter).Write(0x400000e800, 0x400016c000, 0xc1, 0x5dc, 0xc1, 0x0, 0x0)
        /root/go/src/github.com/eycorsican/go-tun2socks/filter/filter.go:43 +0x100 fp=0x40000f7e50 sp=0x40000f7df0 pc=0x5d9f20
io.copyBuffer(0x7f9c068050, 0x400000e800, 0x7f9c023000, 0x400007a840, 0x400016c000, 0x5dc, 0x5dc, 0xa6ffa0, 0x0, 0x7f9c023000)
        /usr/local/go/src/io/io.go:404 +0x194 fp=0x40000f7ec0 sp=0x40000f7e50 pc=0x46c784
io.CopyBuffer(0x7f9c068050, 0x400000e800, 0x7f9c023000, 0x400007a840, 0x400016c000, 0x5dc, 0x5dc, 0x0, 0x0, 0x0)
        /usr/local/go/src/io/io.go:375 +0x58 fp=0x40000f7f20 sp=0x40000f7ec0 pc=0x46c598
main.main.func2(0x7f9c068050, 0x400000e800, 0xc20b40, 0x400007a840)
        /root/go/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:145 +0xa4 fp=0x40000f7fb0 sp=0x40000f7f20 pc=0x97dd54
runtime.goexit()
        /usr/local/go/src/runtime/asm_arm64.s:1114 +0x4 fp=0x40000f7fb0 sp=0x40000f7fb0 pc=0x458214
created by main.main
        /root/go/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:144 +0x9a4

goroutine 1 [chan receive]:
main.main()
        /root/go/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:155 +0xa98

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
        /usr/local/go/src/runtime/sigqueue.go:139 +0xb8
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:23 +0x18
created by os/signal.init.0
        /usr/local/go/src/os/signal/signal_unix.go:29 +0x30

goroutine 7 [chan receive]:
github.com/eycorsican/go-tun2socks/proxy.(*DNSCache).cleanUp(0x4000135200)
        /root/go/src/github.com/eycorsican/go-tun2socks/proxy/dns_cache.go:43 +0x1a0
created by github.com/eycorsican/go-tun2socks/proxy.NewDNSCache
        /root/go/src/github.com/eycorsican/go-tun2socks/proxy/dns_cache.go:28 +0x6c

goroutine 58 [IO wait]:
internal/poll.runtime_pollWait(0x7f9c067e30, 0x72, 0x40001a2000)
        /usr/local/go/src/runtime/netpoll.go:173 +0x3c
internal/poll.(*pollDesc).wait(0x40001ea598, 0x72, 0xffffffffffffff00, 0xc1c580, 0x114eeb8)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x90
internal/poll.(*pollDesc).waitRead(0x40001ea598, 0x40001a2000, 0x800, 0x800)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x30
internal/poll.(*FD).Read(0x40001ea580, 0x40001a2000, 0x800, 0x800, 0x0, 0x0, 0x0)
        /usr/local/go/src/internal/poll/fd_unix.go:169 +0x134
net.(*netFD).Read(0x40001ea580, 0x40001a2000, 0x800, 0x800, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/fd_unix.go:202 +0x3c
net.(*conn).Read(0x40001b2040, 0x40001a2000, 0x800, 0x800, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/net.go:177 +0x50
github.com/eycorsican/go-tun2socks/proxy/socks.(*udpHandler).handleTCP(0x4000032690, 0xc29e20, 0x40001e80e0, 0xc28700, 0x40001b2040)
        /root/go/src/github.com/eycorsican/go-tun2socks/proxy/socks/udp.go:47 +0xac
created by github.com/eycorsican/go-tun2socks/proxy/socks.(*udpHandler).Connect
        /root/go/src/github.com/eycorsican/go-tun2socks/proxy/socks/udp.go:132 +0x3f4

goroutine 59 [IO wait]:
internal/poll.runtime_pollWait(0x7f9c067d60, 0x72, 0x40001a2800)
        /usr/local/go/src/runtime/netpoll.go:173 +0x3c
internal/poll.(*pollDesc).wait(0x40001ea698, 0x72, 0xffffffffffffff00, 0xc1c580, 0x114eeb8)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x90
internal/poll.(*pollDesc).waitRead(0x40001ea698, 0x40001a2800, 0x800, 0x800)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x30
internal/poll.(*FD).Read(0x40001ea680, 0x40001a2800, 0x800, 0x800, 0x0, 0x0, 0x0)
        /usr/local/go/src/internal/poll/fd_unix.go:169 +0x134
net.(*netFD).Read(0x40001ea680, 0x40001a2800, 0x800, 0x800, 0x3655f1321c1, 0x1198900, 0x0)
        /usr/local/go/src/net/fd_unix.go:202 +0x3c
net.(*conn).Read(0x40001b2048, 0x40001a2800, 0x800, 0x800, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/net.go:177 +0x50
github.com/eycorsican/go-tun2socks/proxy/socks.(*udpHandler).fetchUDPInput(0x4000032690, 0xc29e20, 0x40001e80e0, 0xc28760, 0x40001b2048)
        /root/go/src/github.com/eycorsican/go-tun2socks/proxy/socks/udp.go:69 +0xe8
created by github.com/eycorsican/go-tun2socks/proxy/socks.(*udpHandler).Connect
        /root/go/src/github.com/eycorsican/go-tun2socks/proxy/socks/udp.go:144 +0x5bc

关于速度问题请教

用pve虚拟了两台linux,一台v2ray,一台go-tun2socks。
单独v2ray---------->目标vps,200M带宽跑满没问题,go-tun2socks-------->v2ray--------->目标vps,只能到65M上下。机器性能应该不存在瓶颈,请教可能是哪的问题,谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.