go-gost / gost

GO Simple Tunnel - a simple tunnel written in golang
https://gost.run
MIT License
4.25k stars 519 forks source link

指定interface参数时UDP不可用 #287

Open kamibook opened 1 year ago

kamibook commented 1 year ago

版本 gost 3.0.0-rc9 (go1.21.1 linux/amd64)

配置

services:
  - name: http
    addr: 1.1.1.1:20001
    interface: 1.1.1.1
    handler:
      type: http
      auth:
        username: user
        password: pass
      metadata:
        udp: true
    listener:
      type: tcp
      metadata:
        udp: true
  - name: socks
    addr: 1.1.1.2:20002
    interface: 1.1.1.2
    handler:
      type: socks5
      auth:
        username: user
        password: pass
      metadata:
        udp: true
    listener:
      type: tcp
      metadata:
        udp: true
  - name: ss
    addr: 1.1.1.3:20003
    interface: 1.1.1.3
    handler:
      type: ss
      auth:
        username: aes-256-gcm
        password: pass
    listener:
      type: tcp
  - name: ssu
    addr: 1.1.1.3:20003
    interface: 1.1.1.3
    handler:
      type: ssu
      auth:
        username: aes-256-gcm
        password: pass
    listener:
      type: udp
log:
  output: none
  level: debug
  format: json

SSTAP检测反馈

TCP测试开始.
[17:28]  正在测试TCP数据传递...
[17:28]  连接到SS节点...
[17:28]  已连接到SS节点.
[17:30]  测试TCP数据传递...通过!
[17:30]  延迟: 269 ms
[17:30]  测试完成!
[17:30]  //////////////////////////////////////////////
[17:30]  UDP测试开始.
[17:30]  正在测试UDP转发...
[17:30]  正在从代理服务器请求UDP转发...
[17:31]  服务器绑定在 88.88.38.218:43202.
[17:31]  UDP隧道已建立
[17:31]  正在测试数据传送...
[17:48]  测试UDP转发...未通过!
[17:48]  测试完成!
[17:48]  //////////////////////////////////////////////

当去掉interface参数UDP可用

 TCP测试开始.
[23:12]  正在测试TCP数据传递...
[23:12]  连接到SS节点...
[23:12]  已连接到SS节点.
[23:14]  测试TCP数据传递...通过!
[23:14]  延迟: 294 ms
[23:14]  测试完成!
[23:14]  //////////////////////////////////////////////
[23:14]  UDP测试开始.
[23:14]  正在测试UDP转发...
[23:14]  正在从代理服务器请求UDP转发...
[23:15]  服务器绑定在 88.88.38.218:36536.
[23:15]  UDP隧道已建立
[23:15]  正在测试数据传送...

日志

{"caller":"parsing/tls.go:47","level":"debug","msg":"load global TLS certificate files failed, use random generated certificate","time":"2023-09-29T03:26:39.839Z"}
{"caller":"parsing/service.go:132","handler":"http","kind":"listener","level":"debug","listener":"tcp","msg":"metadata: map[udp:true]","service":"http","time":"2023-09-29T03:26:39.840Z"}
{"caller":"tcp/listener.go:55","handler":"http","kind":"listener","level":"debug","listener":"tcp","msg":"pp: 0","service":"http","time":"2023-09-29T03:26:39.850Z"}
{"caller":"auth/auth.go:209","kind":"auther","level":"debug","msg":"load items 0","time":"2023-09-29T03:26:39.851Z"}
{"caller":"parsing/service.go:226","handler":"http","kind":"handler","level":"debug","listener":"tcp","msg":"metadata: map[udp:true]","service":"http","time":"2023-09-29T03:26:39.851Z"}
{"caller":"parsing/service.go:242","handler":"http","kind":"service","level":"info","listener":"tcp","msg":"listening on 88.88.51.135:20001/tcp","service":"http","time":"2023-09-29T03:26:39.851Z"}
{"caller":"parsing/service.go:132","handler":"socks5","kind":"listener","level":"debug","listener":"tcp","msg":"metadata: map[udp:true]","service":"socks","time":"2023-09-29T03:26:39.851Z"}
{"caller":"tcp/listener.go:55","handler":"socks5","kind":"listener","level":"debug","listener":"tcp","msg":"pp: 0","service":"socks","time":"2023-09-29T03:26:39.851Z"}
{"caller":"auth/auth.go:209","kind":"auther","level":"debug","msg":"load items 0","time":"2023-09-29T03:26:39.851Z"}
{"caller":"parsing/service.go:226","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"metadata: map[udp:true]","service":"socks","time":"2023-09-29T03:26:39.851Z"}
{"caller":"parsing/service.go:242","handler":"socks5","kind":"service","level":"info","listener":"tcp","msg":"listening on 88.88.38.218:20002/tcp","service":"socks","time":"2023-09-29T03:26:39.851Z"}
{"caller":"parsing/service.go:132","handler":"ss","kind":"listener","level":"debug","listener":"tcp","msg":"metadata: map[]","service":"ss","time":"2023-09-29T03:26:39.851Z"}
{"caller":"tcp/listener.go:55","handler":"ss","kind":"listener","level":"debug","listener":"tcp","msg":"pp: 0","service":"ss","time":"2023-09-29T03:26:39.852Z"}
{"caller":"auth/auth.go:209","kind":"auther","level":"debug","msg":"load items 0","time":"2023-09-29T03:26:39.852Z"}
{"caller":"parsing/service.go:226","handler":"ss","kind":"handler","level":"debug","listener":"tcp","msg":"metadata: map[]","service":"ss","time":"2023-09-29T03:26:39.852Z"}
{"caller":"parsing/service.go:242","handler":"ss","kind":"service","level":"info","listener":"tcp","msg":"listening on 88.88.39.51:20003/tcp","service":"ss","time":"2023-09-29T03:26:39.852Z"}
{"caller":"parsing/service.go:132","handler":"ssu","kind":"listener","level":"debug","listener":"udp","msg":"metadata: map[]","service":"ssu","time":"2023-09-29T03:26:39.852Z"}
{"caller":"auth/auth.go:209","kind":"auther","level":"debug","msg":"load items 0","time":"2023-09-29T03:26:39.852Z"}
{"caller":"parsing/service.go:226","handler":"ssu","kind":"handler","level":"debug","listener":"udp","msg":"metadata: map[]","service":"ssu","time":"2023-09-29T03:26:39.852Z"}
{"caller":"parsing/service.go:242","handler":"ssu","kind":"service","level":"info","listener":"udp","msg":"listening on 88.88.39.51:20003/udp","service":"ssu","time":"2023-09-29T03:26:39.852Z"}
{"caller":"v5/handler.go:75","handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58111 <> 88.88.38.218:20002","remote":"88.88.88.163:58111","service":"socks","time":"2023-09-29T03:26:48.325Z"}
{"caller":"v5/selector.go:28","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 1 [2]","service":"socks","time":"2023-09-29T03:26:48.328Z"}
{"caller":"v5/selector.go:51","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 2","service":"socks","time":"2023-09-29T03:26:48.328Z"}
{"caller":"v5/connect.go:20","cmd":"connect","dst":"www.baidu.com:80/tcp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58111 >> www.baidu.com:80","remote":"88.88.88.163:58111","service":"socks","time":"2023-09-29T03:26:48.902Z"}
{"caller":"chain/router.go:155","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"dial www.baidu.com:80/tcp","service":"socks","time":"2023-09-29T03:26:48.903Z"}
{"caller":"chain/router.go:175","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"route(retry=0) www.baidu.com:80","service":"socks","time":"2023-09-29T03:26:48.903Z"}
{"caller":"dialer/dialer.go:87","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"interface: enp1s0 88.88.38.218:0/tcp","service":"socks","time":"2023-09-29T03:26:48.903Z"}
{"caller":"v5/connect.go:52","cmd":"connect","dst":"www.baidu.com:80/tcp","handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58111 <-> www.baidu.com:80","remote":"88.88.88.163:58111","service":"socks","time":"2023-09-29T03:26:49.019Z"}
{"caller":"v5/handler.go:75","handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58112 <> 88.88.38.218:20002","remote":"88.88.88.163:58112","service":"socks","time":"2023-09-29T03:26:50.454Z"}
{"caller":"v5/selector.go:28","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 1 [2]","service":"socks","time":"2023-09-29T03:26:50.454Z"}
{"caller":"v5/selector.go:51","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 2","service":"socks","time":"2023-09-29T03:26:50.454Z"}
{"bind":"[::]:33986/udp","caller":"v5/udp.go:53","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"bind on [::]:33986 OK","remote":"88.88.88.163:58112","service":"socks","time":"2023-09-29T03:26:50.989Z"}
{"caller":"chain/router.go:155","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"dial /udp","service":"socks","time":"2023-09-29T03:26:50.989Z"}
{"caller":"chain/router.go:175","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"route(retry=0) ","service":"socks","time":"2023-09-29T03:26:50.989Z"}
{"caller":"dialer/dialer.go:87","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"interface: enp1s0 88.88.38.218:0/udp","service":"socks","time":"2023-09-29T03:26:50.989Z"}
{"bind":"[::]:33986/udp","caller":"v5/udp.go:78","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58112 <-> [::]:33986","remote":"88.88.88.163:58112","service":"socks","time":"2023-09-29T03:26:50.989Z"}
{"caller":"v5/connect.go:56","cmd":"connect","dst":"www.baidu.com:80/tcp","duration":2257908996,"handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58111 >-< www.baidu.com:80","remote":"88.88.88.163:58111","service":"socks","time":"2023-09-29T03:26:51.277Z"}
{"caller":"v5/handler.go:79","duration":2952885643,"handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58111 >< 88.88.38.218:20002","remote":"88.88.88.163:58111","service":"socks","time":"2023-09-29T03:26:51.278Z"}
{"bind":"[::]:33986/udp","caller":"v5/udp.go:81","cmd":"udp","duration":3266348126,"handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58112 >-< [::]:33986","remote":"88.88.88.163:58112","service":"socks","time":"2023-09-29T03:26:54.256Z"}
{"caller":"v5/handler.go:79","duration":3801379861,"handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58112 >< 88.88.38.218:20002","remote":"88.88.88.163:58112","service":"socks","time":"2023-09-29T03:26:54.256Z"}
{"caller":"v5/handler.go:75","handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58113 <> 88.88.38.218:20002","remote":"88.88.88.163:58113","service":"socks","time":"2023-09-29T03:26:54.547Z"}
{"caller":"v5/selector.go:28","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 1 [2]","service":"socks","time":"2023-09-29T03:26:54.551Z"}
{"caller":"v5/selector.go:51","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 2","service":"socks","time":"2023-09-29T03:26:54.551Z"}
{"bind":"[::]:37567/udp","caller":"v5/udp.go:53","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"bind on [::]:37567 OK","remote":"88.88.88.163:58113","service":"socks","time":"2023-09-29T03:26:55.113Z"}
{"caller":"chain/router.go:155","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"dial /udp","service":"socks","time":"2023-09-29T03:26:55.113Z"}
{"caller":"chain/router.go:175","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"route(retry=0) ","service":"socks","time":"2023-09-29T03:26:55.113Z"}
{"caller":"dialer/dialer.go:87","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"interface: enp1s0 88.88.38.218:0/udp","service":"socks","time":"2023-09-29T03:26:55.113Z"}
{"bind":"[::]:37567/udp","caller":"v5/udp.go:78","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58113 <-> [::]:37567","remote":"88.88.88.163:58113","service":"socks","time":"2023-09-29T03:26:55.113Z"}
{"bind":"[::]:37567/udp","caller":"v5/udp.go:81","cmd":"udp","duration":3279317729,"handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58113 >-< [::]:37567","remote":"88.88.88.163:58113","service":"socks","time":"2023-09-29T03:26:58.393Z"}
{"caller":"v5/handler.go:79","duration":3846029125,"handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58113 >< 88.88.38.218:20002","remote":"88.88.88.163:58113","service":"socks","time":"2023-09-29T03:26:58.393Z"}
{"caller":"v5/handler.go:75","handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58116 <> 88.88.38.218:20002","remote":"88.88.88.163:58116","service":"socks","time":"2023-09-29T03:26:58.672Z"}
{"caller":"v5/selector.go:28","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 1 [2]","service":"socks","time":"2023-09-29T03:26:58.672Z"}
{"caller":"v5/selector.go:51","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 2","service":"socks","time":"2023-09-29T03:26:58.672Z"}
{"bind":"[::]:44482/udp","caller":"v5/udp.go:53","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"bind on [::]:44482 OK","remote":"88.88.88.163:58116","service":"socks","time":"2023-09-29T03:26:59.228Z"}
{"caller":"chain/router.go:155","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"dial /udp","service":"socks","time":"2023-09-29T03:26:59.228Z"}
{"caller":"chain/router.go:175","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"route(retry=0) ","service":"socks","time":"2023-09-29T03:26:59.228Z"}
{"caller":"dialer/dialer.go:87","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"interface: enp1s0 88.88.38.218:0/udp","service":"socks","time":"2023-09-29T03:26:59.228Z"}
{"bind":"[::]:44482/udp","caller":"v5/udp.go:78","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58116 <-> [::]:44482","remote":"88.88.88.163:58116","service":"socks","time":"2023-09-29T03:26:59.228Z"}
{"bind":"[::]:44482/udp","caller":"v5/udp.go:81","cmd":"udp","duration":3276321029,"handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58116 >-< [::]:44482","remote":"88.88.88.163:58116","service":"socks","time":"2023-09-29T03:27:02.504Z"}
{"caller":"v5/handler.go:79","duration":3833025464,"handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58116 >< 88.88.38.218:20002","remote":"88.88.88.163:58116","service":"socks","time":"2023-09-29T03:27:02.505Z"}
{"caller":"v5/handler.go:75","handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58117 <> 88.88.38.218:20002","remote":"88.88.88.163:58117","service":"socks","time":"2023-09-29T03:27:02.744Z"}
{"caller":"v5/selector.go:28","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 1 [2]","service":"socks","time":"2023-09-29T03:27:02.744Z"}
{"caller":"v5/selector.go:51","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 2","service":"socks","time":"2023-09-29T03:27:02.744Z"}
{"bind":"[::]:52636/udp","caller":"v5/udp.go:53","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"bind on [::]:52636 OK","remote":"88.88.88.163:58117","service":"socks","time":"2023-09-29T03:27:03.263Z"}
{"caller":"chain/router.go:155","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"dial /udp","service":"socks","time":"2023-09-29T03:27:03.263Z"}
{"caller":"chain/router.go:175","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"route(retry=0) ","service":"socks","time":"2023-09-29T03:27:03.263Z"}
{"caller":"dialer/dialer.go:87","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"interface: enp1s0 88.88.38.218:0/udp","service":"socks","time":"2023-09-29T03:27:03.263Z"}
{"bind":"[::]:52636/udp","caller":"v5/udp.go:78","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58117 <-> [::]:52636","remote":"88.88.88.163:58117","service":"socks","time":"2023-09-29T03:27:03.263Z"}
{"bind":"[::]:52636/udp","caller":"v5/udp.go:81","cmd":"udp","duration":3262560490,"handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58117 >-< [::]:52636","remote":"88.88.88.163:58117","service":"socks","time":"2023-09-29T03:27:06.526Z"}
{"caller":"v5/handler.go:79","duration":3782086599,"handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58117 >< 88.88.38.218:20002","remote":"88.88.88.163:58117","service":"socks","time":"2023-09-29T03:27:06.526Z"}
{"caller":"v5/handler.go:75","handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58118 <> 88.88.38.218:20002","remote":"88.88.88.163:58118","service":"socks","time":"2023-09-29T03:27:06.806Z"}
{"caller":"v5/selector.go:28","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 1 [2]","service":"socks","time":"2023-09-29T03:27:06.806Z"}
{"caller":"v5/selector.go:51","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"5 2","service":"socks","time":"2023-09-29T03:27:06.806Z"}
{"bind":"[::]:48223/udp","caller":"v5/udp.go:53","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"bind on [::]:48223 OK","remote":"88.88.88.163:58118","service":"socks","time":"2023-09-29T03:27:07.325Z"}
{"caller":"chain/router.go:155","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"dial /udp","service":"socks","time":"2023-09-29T03:27:07.325Z"}
{"caller":"chain/router.go:175","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"route(retry=0) ","service":"socks","time":"2023-09-29T03:27:07.325Z"}
{"caller":"dialer/dialer.go:87","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","msg":"interface: enp1s0 88.88.38.218:0/udp","service":"socks","time":"2023-09-29T03:27:07.325Z"}
{"bind":"[::]:48223/udp","caller":"v5/udp.go:78","cmd":"udp","handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58118 <-> [::]:48223","remote":"88.88.88.163:58118","service":"socks","time":"2023-09-29T03:27:07.325Z"}
{"bind":"[::]:48223/udp","caller":"v5/udp.go:81","cmd":"udp","duration":268935428,"handler":"socks5","kind":"handler","level":"debug","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58118 >-< [::]:48223","remote":"88.88.88.163:58118","service":"socks","time":"2023-09-29T03:27:07.594Z"}
{"caller":"v5/handler.go:79","duration":788677976,"handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"88.88.38.218:20002","msg":"88.88.88.163:58118 >< 88.88.38.218:20002","remote":"88.88.88.163:58118","service":"socks","time":"2023-09-29T03:27:07.594Z"}
kamibook commented 1 year ago

补充,服务器为多IP,以上配置为三个公网IP