v2ray-core icon indicating copy to clipboard operation
v2ray-core copied to clipboard

dial TLS connection failed

Open CrazyCxl opened this issue 7 months ago • 3 comments

你正在使用哪个版本的 V2Ray?

5.16.1

你的使用场景是什么?

ws+tls(cloudflare)+vmess

你看到的异常现象是什么?

之前用的好好的今天突然不能用了 Nginx 上的其他网站还能访问,只是速度变慢了

请附上你的配置

服务端配置:

{
    "inbounds": [
        {
            "port": 15055,
            "listen": "127.0.0.1",
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "id": "b0f52fbf-72b9-4ab2-a622-xxx",
                        "level": 1,
                        "alterId": 0,
                        "security": "aes-128-gcm"
                    },
                    {
                        "id": "0e308ed3-54b8-3ee7-0b5c-xxx",
                        "level": 1,
                        "alterId": 52,
                        "security": "aes-128-gcm"
                    }
                ]
            },
                "streamSettings": {
                "network": "ws",  
                "wsSettings": {
                    "path": "/ray"
                }
            },
            "tag": "cusvmess"
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom"
        }
    ]
}

客户端配置:

// Config file of V2Ray. This file follows standard JSON format, with comments support.
// Uncomment entries below to satisfy your needs. Also read our manual for more detail at
// https://www.v2ray.com/
{
  "log": {
    // By default, V2Ray writes access log to stdout.
    // "access": "/path/to/access/log/file",

    // By default, V2Ray write error log to stdout.
    // "error": "/path/to/error/log/file",

    // Log level, one of "debug", "info", "warning", "error", "none"
    "loglevel": "info"
  },
  // List of inbound proxy configurations.
  "inbounds": [{
    // Port to listen on. You may need root access if the value is less than 1024.
    "port": 28082,

    // IP address to listen on. Change to "0.0.0.0" to listen on all network interfaces.
    "listen": "127.0.0.1",

    // Tag of the inbound proxy. May be used for routing.
    "tag": "socks-inbound",

    // Protocol name of inbound proxy.
    "protocol": "socks",

    // Settings of the protocol. Varies based on protocol.
    "settings": {
      "auth": "noauth",
      "udp": false,
      "ip": "127.0.0.1"
    },

    // Enable sniffing on TCP connection.
    "sniffing": {
      "enabled": true,
      // Target domain will be overriden to the one carried by the connection, if the connection is HTTP or HTTPS.
      "destOverride": ["http", "tls"]
    }
  },
  {
	"port": 28081,
	"listen": "127.0.0.1",
	"protocol": "http",
	"settings": {
	"timeout": 0
	}
	}],
  // List of outbound proxy configurations.
  "outbounds": [{
	"protocol": "vmess", // 出口协议
    "settings": {
      "vnext": [{
        "address": "xxx.top", // 服务器地址,请修改为你自己的服务器 ip 或域名
        "port": 443,  // 服务器端口
        "users": [{ 
            "id": "b0f52fbf-72b9-4ab2-a622-xxx", //你的UUID, 此ID需与服务端保持一致
            "level": 1,
            "alterId": 0,  //此ID也需与客户端保持一致
            "security": "aes-128-gcm"
        }]
      }]
    },
    "streamSettings":{
        "network": "ws",
        "security": "tls",
        "tlsSettings": {
            "allowInsecure": false,
            "serverName": "xxx.top" //此域名是你服务器的域名
        },
        "wsSettings": {
            "path": "/ray", //与服务器配置及nginx配置相关
            "headers": {
                "Host": "xxx.top"  //这里填写你的域名,复制脚本请删除这句注释
            }
        }
    },
	"tag": "cusvmess"
	}],

  // Transport is for global transport settings. If you have multiple transports with same settings
  // (say mKCP), you may put it here, instead of in each individual inbound/outbounds.
  //"transport": {},

  // Routing controls how traffic from inbounds are sent to outbounds.
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules":[
      {
        // Blocks access to private IPs. Remove this if you want to access your router.
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      },
      {
        // Blocks major ads.
        "type": "field",
        "domain": ["geosite:category-ads"],
        "outboundTag": "blocked"
      }
    ]
  },


  // Policy controls some internal behavior of how V2Ray handles connections.
  // It may be on connection level by user levels in 'levels', or global settings in 'system.'
  "policy": {
    // Connection policys by user levels
    "levels": {
      "0": {
        "uplinkOnly": 0,
        "downlinkOnly": 0
      }
    },
    "system": {
      "statsInboundUplink": false,
      "statsInboundDownlink": false
    }
  },

  // Stats enables internal stats counter.
  // This setting can be used together with Policy and Api. 
  //"stats":{},

  // Api enables gRPC APIs for external programs to communicate with V2Ray instance.
  //"api": {
    //"tag": "api",
    //"services": [
    //  "HandlerService",
    //  "LoggerService",
    //  "StatsService"
    //]
  //},

  // You may add other entries to the configuration, but they will not be recognized by V2Ray.
  "other": {}
}


请附上出错时软件输出的错误日志

服务器端错误日志: 服务端没报错

➜  v2ray journalctl -xfu v2ray
Jul 23 17:54:25 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 17:54:25 [Warning] [2266517740] app/dispatcher: default route for tcp:translate.google.com:443
Jul 23 17:54:36 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 17:54:36 [Warning] [3498883133] app/dispatcher: default route for tcp:content-autofill.googleapis.com:443
Jul 23 17:54:39 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 17:54:39 [Warning] [1542315227] app/dispatcher: default route for udp:8.8.8.8:53
Jul 23 17:54:40 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 17:54:40 [Warning] [619409657] app/dispatcher: default route for tcp:clients2.google.com:443
Jul 23 17:56:01 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 17:56:01 [Warning] [1018583429] app/dispatcher: default route for udp:119.29.29.29:53
Jul 23 17:56:01 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 17:56:01 [Warning] [1856363099] app/dispatcher: default route for udp:119.29.29.29:53
Jul 23 17:56:41 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 17:56:41 [Warning] [491026417] app/dispatcher: default route for tcp:optimizationguide-pa.googleapis.com:443
Jul 23 17:57:34 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 17:57:34 [Warning] [3993633671] app/dispatcher: default route for udp:119.29.29.29:53
Jul 23 17:57:37 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 17:57:37 [Warning] [2128357793] app/dispatcher: default route for tcp:clients2.google.com:443
Jul 23 18:01:03 hwsrv-622030.hostwindsdns.com v2ray[1811875]: 2024/07/23 18:01:03 [Warning] [2655369947] app/dispatcher: default route for tcp:www.v2ex.com:443

客户端错误日志:

2024/07/23 17:42:37 [Warning] V2Ray 5.16.1 started
2024/07/23 17:42:41 [Info] [602500551] proxy/http: request to Method [CONNECT] Host [www.google.com.hk:443] with URL [//www.google.com.hk:443]
2024/07/23 17:42:41 [Info] [547277721] proxy/http: request to Method [CONNECT] Host [www.google.com:443] with URL [//www.google.com:443]
2024/07/23 17:42:41 127.0.0.1:22051 accepted //www.google.com:443 [cusvmess]
2024/07/23 17:42:41 127.0.0.1:22052 accepted //www.google.com.hk:443 [cusvmess]
2024/07/23 17:42:41 [Warning] [547277721] app/dispatcher: default route for tcp:www.google.com:443
2024/07/23 17:42:41 [Warning] [602500551] app/dispatcher: default route for tcp:www.google.com.hk:443
2024/07/23 17:42:41 [Info] [547277721] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:42:41 [Info] [602500551] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:42:49 [Info] [602500551] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:42:49 [Info] [547277721] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:42:58 [Info] [547277721] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:42:58 [Info] [602500551] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:43:06 [Info] [547277721] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:43:06 [Info] [602500551] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:43:11 [Info] [602500551] app/proxyman/inbound: connection ends > proxy/http: connection ends > context canceled
2024/07/23 17:43:11 [Info] [547277721] app/proxyman/inbound: connection ends > proxy/http: connection ends > context canceled
2024/07/23 17:43:12 [Info] [602500551] proxy/vmess/outbound: tunneling request to tcp:www.google.com.hk:443 via xxx.top:443
2024/07/23 17:43:12 [Info] [602500551] app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: connection ends > context canceled
2024/07/23 17:43:12 [Info] [2046647027] proxy/http: request to Method [CONNECT] Host [www.google.com:443] with URL [//www.google.com:443]
2024/07/23 17:43:12 [Info] [1688578322] proxy/http: request to Method [CONNECT] Host [www.google.com.hk:443] with URL [//www.google.com.hk:443]
2024/07/23 17:43:12 [Warning] [1688578322] app/dispatcher: default route for tcp:www.google.com.hk:443
2024/07/23 17:43:12 [Info] [1688578322] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:43:12 127.0.0.1:22384 accepted //www.google.com.hk:443 [cusvmess]
2024/07/23 17:43:12 [Warning] [2046647027] app/dispatcher: default route for tcp:www.google.com:443
2024/07/23 17:43:12 [Info] [2046647027] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:43:12 127.0.0.1:22383 accepted //www.google.com:443 [cusvmess]
2024/07/23 17:43:15 [Info] [547277721] transport/internet/websocket: creating connection to tcp:xxx.top:443
2024/07/23 17:43:16 [Warning] [547277721] app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://xxx.top:443/ray):  > read tcp 192.168.1.200:22058->172.67.218.74:443: i/o timeout transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://xxx.top:443/ray):  > read tcp 192.168.1.200:22113->172.67.218.74:443: i/o timeout transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://xxx.top:443/ray):  > read tcp 192.168.1.200:22175->172.67.218.74:443: i/o timeout transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://xxx.top:443/ray):  > read tcp 192.168.1.200:22347->172.67.218.74:443: i/o timeout transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://xxx.top:443/ray):  > transport/internet/websocket: dial TLS connection failed > dial tcp: lookup xxx.top: operation was canceled] > common/retry: all retry attempts failed

请附上访问日志

➜  v2ray cat /var/log/v2ray/access.log
➜  v2ray cat /var/log/v2ray/error.log 
➜  v2ray 

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

server {
    listen       80;
    listen       443 ssl;
    server_name  xxx.top;

    #access_log  /var/log/nginx/host.access.log  main;

    ssl_certificate     /usr/share/nginx/cert/cloudflare_for_vps.crt;
    ssl_certificate_key /usr/share/nginx/cert/cloudflare_for_vps.key;
    ssl_session_cache   shared:SSL:1m;
    ssl_session_timeout 5m;
    ssl_ciphers         HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers  on;

    location / {
        root   /usr/share/nginx/html/;
        index  index.html index.htm;
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    location /ray {
        proxy_redirect off;
        proxy_intercept_errors on;
        proxy_pass http://127.0.0.1:15055; #假设WebSocket监听端口为5055
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        # 向后端传递访客ip
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

CrazyCxl avatar Jul 23 '24 10:07 CrazyCxl