v2fly / v2ray-core

A platform for building proxies to bypass network restrictions.
https://v2fly.org
MIT License
29.3k stars 4.63k forks source link

wless+ws+tls无法正常连接, #196

Closed Greatsaltedfish closed 4 years ago

Greatsaltedfish commented 4 years ago

除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。 如果你遇到的问题不是 V2Ray 的 bug,比如你不清楚要如何配置,请使用Discussion进行讨论。

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) 均为4.28.1 2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 客户端是透明代理方案 3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 无法正常代理 4) 你期待看到的正确表现是怎样的?

5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:

    // 在这里附上服务器端配置文件
{
        "log":{
                "access":"/var/log/v2ray/access.log",
                        "error":"/var/log/v2ray/error.log",
                        "loglevel":"debug"
        },
                "dns":{
                        "hosts":{
                                "abc.def.ghi:"127.0.0.1"
                        },
                        "servers":[
                        "8.8.8.8",
                        "8.8.4.4",
                        "1.1.1.1"
                        ]
                },
                "policy":{
                        "levels":{

                        },
                        "system":{
                                "statsInboundUplink": true,
                                "statsInboundDownlink": true
                        }

                },
                "inbounds":[
                {
                        "port":18975,
                        "listen":"127.0.0.1",
                        "protocol":"vless",
                        "settings":{
                                "clients":[
                                {
                                        "id":"aaaaaaaaaaaaaaaaaaaaaa"
                                }
                                ],
                                "decryption":"none",
                                "fallbacks":[{
                                        //"alpn":"",
                                        //"path":"",
                                        "dest":"abc.def.ghi:443"
                                }]

                        },
                        "steamSettings":{
                                "network":"ws",
                                "wsSettings":{
                                        "path":"/v2ray"
                                },
                                "security": "none"
                        }
                }
        ],"outbounds":[
        {
                "protocol":"freedom",
                        "settings":{}
        }
        ]
}

客户端配置:

    // 在这里附上客户端配置
{
"log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "debug"

  },
"dns": {

        "hosts": {
                "abc.def.ghi:443": "1.1.1.1"
        },
        "servers": [
        "208.67.222.222", // 非中中国大陆域名使用 Google 的 DNS
        "1.1.1.1", // 非中中国大陆域名使用 Cloudflare 的 DNS(备用)
        "114.114.114.114", // 114 的 DNS (备用)
        {
                "address": "223.5.5.5", //中国大陆域名使用阿里的 DNS
                "port": 53,
                "domains": [
                        "geosite:cn",
                "ntp.org",  // NTP 服务器
                "abc.def.ghi"

                ]
        }
        ]
},
        "stats": {},
        "routing": {
                "domainStrategy": "IPOnDemand",
                "rules": [
                { // 劫持 53 端口 UDP 流量,使用 V2Ray 的 DNS
                        "type": "field",
                        "inboundTag": [
                                "transparent"
                        ],
                        "port": 53,
                        "network": "udp",
                        "outboundTag": "dns-out" 
                },    
                { // 直连 123 端口 UDP 流量(NTP 协议)
                        "type": "field",
                        "inboundTag": [
                                "transparent"
                        ],
                        "port": 123,
                        "network": "udp",
                        "outboundTag": "direct" 
                },    
                {
                        "type": "field", 
                        "ip": [ 
                                // 设置 DNS 配置中的国内 DNS 服务器地址直连,以达到 DNS 分流目的
                                "223.5.5.5",
                        "101.6.6.6",
                        "114.114.114.114"
                        ],
                        "outboundTag": "direct"
                },
                {
                        "type": "field",
                        "ip": [ 
                                // 设置 DNS 配置中的国内 DNS 服务器地址走代理,以达到 DNS 分流目的
                                "208.67.222.222",
                        "8.8.8.8",
                        "1.1.1.1"
                        ],
                        "outboundTag": "proxy" // 改为你自己代理的出站 tag
                },
                { // 广告拦截
                        "type": "field", 
                        "domain": [
                                "geosite:category-ads-all"
                        ],
                        "outboundTag": "blocked"
                },
                { // BT 流量直连
                        "type": "field",
                        "protocol":["bittorrent"], 
                        "outboundTag": "direct"
                },
                        { // 直连中国大陆主流网站 ip 和 保留 ip
                                "type": "field", 
                                "ip": [
                                        "geoip:private",
                                "geoip:cn"
                                ],
                                "outboundTag": "direct"
                        },
      { // 直连中国大陆主流网站域名
        "type": "field", 
        "domain": [
          "geosite:cn"
        ],
        "outboundTag": "direct"
      },{
        "type":"field",
        "domain":[
          "gc.kis.scr.kaspersky-labs.com",
          "regexp:\\.bilibili.com$",
          "regexp:\\.freebuf.com$",
         "regexp:\\.163.com$",
         "regexp:\\.taobao.com$", 
         "mirrors.ustc.edu.cn",
        "mirrors.tuna.tsinghua.edu.cn$"
        ],
        "outboundTag":"direct"
      }
    ]

  },
  "policy": {},
  "reverse": {},
  "inbounds": [
    {
      "tag":"transparent",
      "port": 4563,
      "protocol": "dokodemo-door",
      "settings": {
        "network": "tcp,udp",
        "followRedirect": true
      },
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "streamSettings": {
        "sockopt": {
          "tproxy": "tproxy" // 透明代理使用 TPROXY 方式
        }
      }
    },
    {
      "port": 1880, 
      "protocol": "socks", // 入口协议为 SOCKS 5
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      },
      "settings": {
        "auth": "noauth"
      }
    }

  ],
  "outbounds": [
    {
      "tag":"proxy",
      "protocol":"vless",
      "settings":{
        "vnext":[
          {
            "address":"abc.def.ghi",
            "port":443,
            "users":[
              {
                "id":"aaaaaaaaaaaaaaaaaaaaaa",
                "encryption": "none",
                "level": 0
              }
            ]
          }
        ]
      },"mux":{
        "enabled":true,
         "concurrency":8

      },      
      "streamSettings":{
          "network": "ws",
         "WsSettings":{
         "path":"/ggcvay"
          },
        "security": "tls",
        "sockopt": {
          "mark": 255
        }
      }
    },{
      "tag":"direct",
      "protocol": "freedom",
    "settings": {
      "domainStrategy": "UseIP"
    },
    "streamSettings": {
      "sockopt": {
        "mark": 255
      }
    }     
    },
    {
      "tag":"blocked",
      "protocol":"blackhole",
      "settings":{
          "response": {
              "type": "none"
            }
      }
    },
    {
      "tag": "dns-out",
      "protocol": "dns",
      "streamSettings": {
        "sockopt": {
          "mark": 255
        }
      }  
    }

  ],
  "transport": {}
}

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

服务器端错误日志:

    // 在这里附上服务器端日志
2020/09/15 08:13:47 [Info] [2377553241] v2ray.com/core/proxy/vless/inbound: firstLen = 274
2020/09/15 08:13:47 [Info] [2377553241] v2ray.com/core/proxy/vless/inbound: fallback starts > v2ray.com/core/proxy/vless/encoding: invalid request version
2020/09/15 08:13:48 [Info] [2377553241] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/vless/inbound: fallback ends > context canceled

客户端错误日志:

    // 在这里附上客户端日志
2020/09/15 23:14:51 [Info] v2ray.com/core/transport/internet/udp: failed to handle UDP input > EOF
2020/09/15 23:14:51 [Debug] v2ray.com/core/app/dns: UDP:1.1.1.1:53 querying DNS for: api.openweathermap.org.
2020/09/15 23:14:51 [Debug] v2ray.com/core/transport/internet/udp: dispatch request to: udp:1.1.1.1:53
2020/09/15 23:14:51 [Info] v2ray.com/core/transport/internet/udp: establishing new connection for udp:1.1.1.1:53
2020/09/15 23:14:51 [Info] [547491689] v2ray.com/core/app/dispatcher: sniffed domain: api.openweathermap.org
2020/09/15 23:14:51 [Debug] v2ray.com/core/transport/internet/udp: dispatch request to: udp:1.1.1.1:53
2020/09/15 23:14:51 [Debug] v2ray.com/core/app/dns: UDP:1.1.1.1:1111 querying DNS for: api.openweathermap.org.
2020/09/15 23:14:51 [Info] v2ray.com/core/app/dispatcher: taking detour [proxy] for [udp:1.1.1.1:53]
2020/09/15 23:14:51 [Info] v2ray.com/core/common/mux: dispatching request to udp:1.1.1.1:53
2020/09/15 23:14:51 [Debug] v2ray.com/core/transport/internet/udp: dispatch request to: udp:1.1.1.1:1111
2020/09/15 23:14:51 [Info] v2ray.com/core/transport/internet/udp: establishing new connection for udp:1.1.1.1:1111
2020/09/15 23:14:51 [Debug] v2ray.com/core/transport/internet/udp: dispatch request to: udp:1.1.1.1:1111
2020/09/15 23:14:51 [Info] v2ray.com/core/app/dispatcher: taking detour [proxy] for [udp:1.1.1.1:1111]
2020/09/15 23:14:51 [Info] v2ray.com/core/common/mux: dispatching request to udp:1.1.1.1:1111
2020/09/15 23:14:51 [Debug] [2665918938] v2ray.com/core/proxy/dokodemo: processing connection from: 1.1.1.1:1111
2020/09/15 23:14:51 [Info] [2665918938] v2ray.com/core/proxy/dokodemo: received request for 1.1.1.1:1111
2020/09/15 23:14:51 [Info] [2665918938] v2ray.com/core/app/dispatcher: taking detour [direct] for [tcp:1.1.1.1:1111]
2020/09/15 23:14:51 [Info] [2665918938] v2ray.com/core/proxy/freedom: opening connection to tcp:1.1.1.1:1111
2020/09/15 23:14:51 [Info] [2665918938] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:1.1.1.1:1111
2020/09/15 23:14:52 [Info] [427855149] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/dns: connection ends > context canceled
2020/09/15 23:14:52 [Info] [427855149] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/dokodemo: connection ends > context canceled

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

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

8) 其它相关的配置文件(如 Nginx)和相关日志。 caddy:

    // 在这里附上服务器端日志
{
  "level": "error",
  "ts": 1600183078.746632,
  "logger": "http.log.access.log0",
  "msg": "handled request",
  "request": {
    "method": "GET",
    "uri": "/ggcvay",
    "proto": "HTTP/1.1",
    "remote_addr": "110.110.110.110",
    "host": "abc.def.ghi",
    "headers": {
      "User-Agent": [
        "Go-http-client/1.1"
      ],
      "Connection": [
        "Upgrade"
      ],
      "Sec-Websocket-Key": [
        "cs1jq+lTxiKFVSwbAppHDA=="
      ],
      "Sec-Websocket-Version": [
        "13"
      ],
      "Upgrade": [
        "websocket"
      ]
    },
    "tls": {
      "resumed": true,
      "version": 772,
      "ciphersuite": 4865,
      "proto": "http/1.1",
      "proto_mutual": true,
      "server_name": "abc.def.ghi"
    }
  },
  "common_log": "110.110.110.110 - - [15/Sep/2020:08:17:58 -0700] \"GET /v2ray HTTP/1.1\" 400 48",
  "duration": 1.003963482,
  "size": 48,
  "status": 400,
  "resp_headers": {
    "Server": [
      "Caddy"
    ]
  }
}

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

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

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

通常的命令为 journalctl -u v2ray

请预览一下你填的内容再提交。

nicholascw commented 4 years ago

服务器配置文件 steamSettings: 应为 streamSettings. Not a bug. Closed.