v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.29k stars 8.94k forks source link

无法正常代理 Xshell #1061

Closed LennoC closed 6 years ago

LennoC commented 6 years ago

Please skip to the English section below if you don't write Chinese.

中文: 提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。 除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) 服务端: 3.18.1 客户端: 3.18 2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 在xshell里使用socks5代理连接SSH,xshell5/6都会 3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 通过 v2 来代理连接远程设备,一直卡着如下面所示,重现率 100%,换回 3.14 的客户端,或者使用SS可以正常连接。

Looking up proxy server '127.0.0.1'... Host '127.0.0.1' resolved to 127.0.0.1. Connecting to 127.0.0.1:1080... Connection established. To escape to local shell, press 'Ctrl+Alt+]'.

4) 你期待看到的正确表现是怎样的? 可以正常连接 5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:
    // 在这里附上服务器端配置文件
{
    "log": {
            "access": "/var/log/v2ray/access.log",
            "error": "/var/log/v2ray/error.log",
            "loglevel": "info"
    },
    "inbound": {
            "listen": "127.0.0.1",
            "port": *0,
            "protocol": "vmess",
            "disableInsecureEncryption": true,
            "settings": {
                    "clients": [{
                            "id": "**",
                            "level": 1,
                            "alterId": 100,
                            "security": "auto"
                    }]
            },
            "streamSettings":{
                    "network":"ws",
                    "security": "auto",
                    "wsSettings":{
                            "path": "/path"
                            }
                    }
    },
    "inboundDetour": [
        {
            "listen": "127.0.0.1",
            "port": *1,
            "protocol": "vmess",
            "disableInsecureEncryption": true,          
            "settings": {
                    "clients": [{
                            "id": "**",
                            "level": 1,
                            "alterId": 64,
                            "security": "auto"
                    }]
            },
            "streamSettings": {
                    "network":"kcp",
                    "security": "",
                    "kcpSettings": {
                        "mtu": 1350,
                        "tti": 20,
                        "uplinkCapacity": 20,
                        "downlinkCapacity": 100,
                        "congestion": false,
                        "readBufferSize": 1,
                        "writeBufferSize": 1,
                        "header": {
                          "type": "wechat-video"
                        }
                    }
            }           
        }   
    ],
    "outbound": {
            "protocol": "freedom",
            "settings": {}
    },
    "outboundDetour": [
        {
            "protocol": "blackhole",
            "settings": {},
            "tag": "blocked"
        }
    ],
    "routing": {
        "strategy": "rules",
        "settings": {
            "rules": [
                {
                    "type": "field",
                    "ip": [
                        "0.0.0.0/8",
                        "10.0.0.0/8",
                        "100.64.0.0/10",
                        "127.0.0.0/8",
                        "169.254.0.0/16",
                        "172.16.0.0/12",
                        "192.0.0.0/24",
                        "192.0.2.0/24",
                        "192.168.0.0/16",
                        "198.18.0.0/15",
                        "198.51.100.0/24",
                        "203.0.113.0/24",
                        "::1/128",
                        "fc00::/7",
                        "fe80::/10"
                    ],
                    "outboundTag": "blocked"
                }
            ]
        }
    }
}
客户端配置:
    // 在这里附上客户端配置
{
  "log": {
    "access": "",
    "error": "",
    "loglevel": ""
  },
  "inbound": {
    "port": 2000,
    "listen": "127.0.0.1",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": true,
      "ip": "127.0.0.1",
      "clients": null
    },
    "streamSettings": null
  },
  "outbound": {
    "tag": "agentout",
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "**",
          "port": 443,
          "users": [
            {
              "id": "**",
              "alterId": 100,
              "security": "chacha20-poly1305"
            }
          ]
        }
      ],
      "servers": null
    },
    "streamSettings": {
      "network": "ws",
      "security": "tls",
      "tlsSettings": {
        "allowInsecure": true,
        "serverName": null
      },
      "tcpSettings": null,
      "kcpSettings": null,
      "wsSettings": {
        "connectionReuse": true,
        "path": "/path",
        "headers": null
      },
      "httpSettings": null
    },
    "mux": {
      "enabled": true
    }
  },
  "inboundDetour": null,
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {
        "response": null
      },
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "settings": {
        "response": {
          "type": "http"
        }
      },
      "tag": "blockout"
    }
  ],
  "dns": {
    "servers": [
      "8.8.8.8",
      "8.8.4.4",
      "localhost"
    ]
  },
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPIfNonMatch",
      "rules": [
        {
          "type": "field",
          "port": null,
          "outboundTag": "direct",
          "ip": [
            "0.0.0.0/8",
            "10.0.0.0/8",
            "100.64.0.0/10",
            "127.0.0.0/8",
            "169.254.0.0/16",
            "172.16.0.0/12",
            "192.0.0.0/24",
            "192.0.2.0/24",
            "192.168.0.0/16",
            "198.18.0.0/15",
            "198.51.100.0/24",
            "203.0.113.0/24",
            "::1/128",
            "fc00::/7",
            "fe80::/10"
          ],
          "domain": null
        },
        {
          "type": "field",
          "port": null,
          "outboundTag": "direct",
          "ip": null,
          "domain": [
            "geosite:cn"
          ]
        },
        {
          "type": "field",
          "port": null,
          "outboundTag": "direct",
          "ip": [
            "geoip:cn"
          ],
          "domain": null
        }
      ]
    }
  }
}

6) 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。

服务器端错误日志:
    // 在这里附上服务器端日志
无明显错误
客户端错误日志:
    // 在这里附上客户端日志
无明显错误

7) 请附上访问日志。在 Linux 中,日志通常在 /var/log/v2ray/access.log 文件中。

    // 在这里附上服务器端日志

8) 其它相关的配置文件(如 Nginx)和相关日志。 caddy+ws+tls,无明显错误

9) 如果 V2Ray 无法启动,请附上 --test 输出。

通常的命令为 /usr/bin/v2ray/v2ray --test --config /etc/v2ray/config.json。请按实际情况修改。

正常启动 10) 如果 V2Ray 服务运行不正常,请附上 journal 日志。

通常的命令为 journalctl -u v2ray

运行正常 请预览一下你填的内容再提交。

其他:同issue #1010 ,有解决方案:关闭Mux可正常,但是希望开发者能解决。

DarienRaymond commented 6 years ago

能否把客户端loglevel设为info,然后看一下连接时的输出?

DarienRaymond commented 6 years ago

另外请试一下 3.18.2

LennoC commented 6 years ago

@DarienRaymond 这是v2rayN里设为info时提供的log, error里的

2018/04/19 13:46:49 [Warning] Core: V2Ray v3.18 started 2018/04/19 13:46:49 [Info] [20862997] Proxy|Socks: TCP Connect request to tcp:mtalk.google.com:5228 2018/04/19 13:46:49 [Info] App|Router: looking for IP for domain: mtalk.google.com 2018/04/19 13:46:49 [Info] Transport|Internet|UDP: establishing new connection for udp:8.8.8.8:53 2018/04/19 13:46:49 [Info] App|Dispatcher: default route for udp:8.8.8.8:53 2018/04/19 13:46:49 [Info] App|Proxyman|Mux: dispatching request to udp:8.8.8.8:53 2018/04/19 13:46:49 [Info] Transport|Internet|WebSocket: creating connection to tcp:my.domain:443 2018/04/19 13:46:50 [Info] Proxy|VMess|Outbound: tunneling request to tcp:v1.mux.cool:9527 via tcp:my.domain:443 2018/04/19 13:46:50 [Info] [20862997] App|Dispatcher: default route for tcp:mtalk.google.com:5228 2018/04/19 13:46:50 [Info] [20862997] App|Proxyman|Mux: dispatching request to tcp:mtalk.google.com:5228 2018/04/19 13:46:53 [Info] [2250130355] App|Proxyman|Inbound: connection ends > Proxy|Socks: failed to read request > Proxy|Socks: insufficient header > read tcp 127.0.0.1:2000->127.0.0.1:60506: i/o timeout 2018/04/19 13:46:57 [Info] Transport|Internet|UDP: failed to handle UDP input > context canceled 2018/04/19 13:46:57 [Info] App|Proxyman|Mux: failed to fetch all input > context canceled 2018/04/19 13:46:58 [Warning] Core: V2Ray v3.18 started 2018/04/19 13:47:05 [Info] [559016050] Proxy|Socks: TCP Connect request to tcp:0.client-channel.google.com:443 2018/04/19 13:47:05 [Info] App|Router: looking for IP for domain: 0.client-channel.google.com 2018/04/19 13:47:05 [Info] Transport|Internet|UDP: establishing new connection for udp:8.8.8.8:53 2018/04/19 13:47:05 [Info] App|Dispatcher: default route for udp:8.8.8.8:53 2018/04/19 13:47:05 [Info] App|Proxyman|Mux: dispatching request to udp:8.8.8.8:53 2018/04/19 13:47:05 [Info] Transport|Internet|WebSocket: creating connection to tcp:my.domain:443 2018/04/19 13:47:06 [Info] Proxy|VMess|Outbound: tunneling request to tcp:v1.mux.cool:9527 via tcp:my.domain:443 2018/04/19 13:47:06 [Info] [559016050] App|Dispatcher: default route for tcp:0.client-channel.google.com:443 2018/04/19 13:47:06 [Info] [559016050] App|Proxyman|Mux: dispatching request to tcp:0.client-channel.google.com:443 2018/04/19 13:47:07 [Info] [2596571969] Proxy|Socks: TCP Connect request to tcp: 97...IP :38878 2018/04/19 13:47:07 [Info] [2596571969] App|Dispatcher: default route for tcp: 97...IP :38878 2018/04/19 13:47:07 [Info] [2596571969] App|Proxyman|Mux: dispatching request to tcp: 97...IP :38878 2018/04/19 13:47:11 [Info] [2961369632] Proxy|Socks: TCP Connect request to tcp:clients4.google.com:443 2018/04/19 13:47:11 [Info] App|Router: looking for IP for domain: clients4.google.com 2018/04/19 13:47:11 [Info] [2961369632] App|Dispatcher: default route for tcp:clients4.google.com:443 2018/04/19 13:47:11 [Info] [2961369632] App|Proxyman|Mux: dispatching request to tcp:clients4.google.com:443 2018/04/19 13:47:17 [Info] Transport|Internet|UDP: failed to handle UDP input > context canceled 2018/04/19 13:47:17 [Info] App|Proxyman|Mux: failed to fetch all input > context canceled

acces里的

2018/04/19 13:46:53 tcp:127.0.0.1:60506 rejected Proxy|Socks: insufficient header > read tcp 127.0.0.1:2000->127.0.0.1:60506: i/o timeout 2018/04/19 13:47:05 tcp:127.0.0.1:60525 accepted tcp:0.client-channel.google.com:443 2018/04/19 13:47:07 tcp:127.0.0.1:60527 accepted tcp:97...IP:38878

LennoC commented 6 years ago

@DarienRaymond 服务器和客户端全部换用3.18.2后,使用ws+caddy+tls可以通过xshell连上了。但是如果用的是h2+caddy+tls就还是不可以,症状跟之前一样。