v2ray / v2ray-core

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

最新版本h2+tls连接经常性断流 #1187

Closed princelai closed 6 years ago

princelai commented 6 years ago

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明)

v2ray --version
V2Ray 3.29 (die Commanderin) Custom
A unified platform for anti-censorship.

2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 通过chromium上网,原来是靠SwitchOmega代理,后来经常断流以为是SwitchOmega的锅,就用系统代理接管了。系统Manjaro Linux

3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 经常性断流,大约每隔3-5分钟断流5-8分钟。需要代理的网站无法访问,同时直连的网站没有问题。

4) 你期待看到的正确表现是怎样的? 不断流

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

服务器端配置:

两台服务端配置都如下。

{
  "log": {
    "loglevel": "warning",
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log"
  },
  "inbound": {
    "port": 443,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "xxxxxxxxxxxxxxxxxxxxxx",
          "alterId": 32,
          "security": "auto"
        }
      ]
    },
    "streamSettings": {
      "network": "h2",
      "security": "tls",
      "httpSettings": {
        "path": "/get"
      },
      "tlsSettings": {
        "certificates": [
          {
            "certificateFile": "/etc/v2ray/v2ray.crt",
            "keyFile": "/etc/v2ray/v2ray.key"
          }
        ]
      }
    }
  },
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  },
  "outboundDetour": [
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "strategy": "rules",
    "settings": {
      "rules": [
        {
          "type": "field",
          "ip": [
            "geoip:private"
          ],
          "outboundTag": "blocked"
        }
      ]
    }
  }
}
客户端配置:
{
  "log": {
    "loglevel": "warning",
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log"
  },
  "inbound": {
    "port": 1080,
    "protocol": "socks",
    "domainOverride": [
      "tls",
      "http"
    ],
    "settings": {
      "auth": "noauth",
      "udp": false
    }
  },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
      {
          "address": "aaaaaaa.top",
          "port": 443,
          "users": [
            {
              "id": "xxxxxxxxxxxxxxxxxxxxxx",
              "alterId": 32,
              "security": "auto"
            }
          ]
        },
      {
          "address": "bbbbbbb.top",
          "port": 443,
          "users": [
            {
              "id": "xxxxxxxxxxxxxxxxxxx",
              "alterId": 32,
              "security": "auto"
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "h2",
      "security": "tls",
      "httpSettings": {
        "path": "/get"
      }
    }
  },
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    }
  ],
  "dns": {
    "servers": [
      "101.6.6.6",
      "101.132.183.99",
      "193.112.15.186",
      "8.8.8.8"
    ]
  },
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPIfNonMatch",
      "rules": [
        {
         "type": "field",
         "port": 53,
         "network": "udp",
         "outboundTag": "direct"
        },
        {
          "type": "field",
          "ip": [
            "geoip:cn",
            "geoip:private",
            "172.168.0.0/16"
          ],
          "port": "0-10000",
          "network": "tcp,udp",
          "outboundTag": "direct"
        },
        {
          "type": "field",
          "domain": [
            "geosite:cn"
          ],
          "port": "0-10000",
          "network": "tcp,udp",
          "outboundTag": "direct"
        }
      ]
    }
  }
}

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

服务器端错误日志:

客户端错误日志:

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

2018/07/05 22:11:39 111.207.128.226:11925 accepted tcp:va.tawk.to:443 
2018/07/05 22:11:39 111.207.128.226:11925 accepted tcp:va.tawk.to:443 
2018/07/05 22:11:41 111.207.128.226:11925 accepted tcp:www.facebook.com:443 
2018/07/05 22:11:43 111.207.128.226:11925 accepted tcp:vs60.tawk.to:443 
2018/07/05 22:11:43 111.207.128.226:11925 accepted tcp:code.jquery.com:443 
2018/07/05 22:11:43 111.207.128.226:11925 accepted tcp:rum-static.pingdom.net:443 
2018/07/05 22:11:43 111.207.128.226:11925 accepted tcp:embed.tawk.to:443 
2018/07/05 22:11:51 111.207.128.226:11925 accepted tcp:rum-collector-2.pingdom.net:443 
2018/07/05 22:11:51 111.207.128.226:11925 accepted tcp:rum-collector-2.pingdom.net:443 
2018/07/05 22:12:24 111.207.128.226:11925 accepted tcp:vs60.tawk.to:443 
2018/07/05 22:12:26 111.207.128.226:11925 accepted tcp:www.googleapis.com:443 
2018/07/05 22:13:49 111.207.128.226:11925 accepted tcp:logo.clearbit.com:443 
2018/07/05 22:14:14 111.207.128.226:11925 accepted tcp:ping.gubo.org:443 
2018/07/05 22:14:23 111.207.128.226:11925 accepted tcp:w3.gubo.org:80 
2018/07/05 22:14:23 111.207.128.226:11925 accepted tcp:w3.gubo.org:80 
2018/07/05 22:14:23 111.207.128.226:11925 accepted tcp:w3.gubo.org:80 
2018/07/05 22:15:10 111.207.128.226:11925 accepted tcp:www.vpscang.com:443 
2018/07/05 22:15:10 111.207.128.226:11925 accepted tcp:www.vpscang.com:443 
2018/07/05 22:15:10 111.207.128.226:11925 accepted tcp:www.vpscang.com:443 
2018/07/05 22:15:11 111.207.128.226:11925 accepted tcp:www.vpscang.com:80 
2018/07/05 22:19:41 111.207.128.226:11925 accepted tcp:www.google.com:443 
2018/07/05 22:19:41 111.207.128.226:11925 accepted tcp:www.google.com:443 
2018/07/05 22:19:43 111.207.128.226:11925 accepted tcp:ping.pe:80 
2018/07/05 22:19:43 111.207.128.226:11925 accepted tcp:ping.pe:80 

服务器2

2018/07/05 22:11:40 111.207.128.226:23500 accepted tcp:rum-collector.pingdom.net:443 
2018/07/05 22:11:42 111.207.128.226:23500 accepted tcp:vs60.tawk.to:443 
2018/07/05 22:11:43 111.207.128.226:23500 accepted tcp:code.jquery.com:443 
2018/07/05 22:11:44 111.207.128.226:23500 accepted tcp:code.jquery.com:443 
2018/07/05 22:11:44 111.207.128.226:23500 accepted tcp:rum-collector-2.pingdom.net:443 
2018/07/05 22:11:47 111.207.128.226:23500 accepted tcp:connect.facebook.net:443 
2018/07/05 22:11:51 111.207.128.226:23500 accepted tcp:rum-collector-2.pingdom.net:443 
2018/07/05 22:12:21 111.207.128.226:23500 accepted tcp:vs60.tawk.to:443 
2018/07/05 22:12:25 111.207.128.226:23500 accepted tcp:va.tawk.to:443 
2018/07/05 22:13:12 111.207.128.226:23500 accepted tcp:logo.clearbit.com:443 
2018/07/05 22:14:10 111.207.128.226:23500 accepted tcp:www.gubo.org:443 
2018/07/05 22:14:23 111.207.128.226:23500 accepted tcp:w3.gubo.org:80 
2018/07/05 22:14:23 111.207.128.226:23500 accepted tcp:w3.gubo.org:80 
2018/07/05 22:14:23 111.207.128.226:23500 accepted tcp:w3.gubo.org:80 
2018/07/05 22:15:10 111.207.128.226:23500 accepted tcp:www.vpscang.com:443 
2018/07/05 22:15:11 111.207.128.226:23500 accepted tcp:www.vpscang.com:443 
2018/07/05 22:15:11 111.207.128.226:23500 accepted tcp:www.vpscang.com:80 
2018/07/05 22:15:11 111.207.128.226:23500 accepted tcp:www.vpscang.com:443 
2018/07/05 22:19:41 111.207.128.226:23500 accepted tcp:www.google.com:443 
2018/07/05 22:19:41 111.207.128.226:23500 accepted tcp:www.google.com:443 
2018/07/05 22:19:43 111.207.128.226:23500 accepted tcp:ping.pe:80 
2018/07/05 22:19:43 111.207.128.226:23500 accepted tcp:ping.pe:80 
2018/07/05 22:19:43 111.207.128.226:23500 accepted tcp:ping.pe:80 

本地访问记录

2018/07/06 10:25:08 tcp:127.0.0.1:37356 accepted tcp:149.154.175.50:80 
2018/07/06 10:25:08 tcp:127.0.0.1:37358 accepted tcp:91.108.56.120:443 
2018/07/06 10:25:08 tcp:127.0.0.1:37360 accepted tcp:91.108.56.120:80 
2018/07/06 10:25:09 tcp:127.0.0.1:37362 accepted tcp:149.154.175.50:443 
2018/07/06 10:25:09 tcp:127.0.0.1:37364 accepted tcp:149.154.175.50:80 
2018/07/06 10:25:11 tcp:127.0.0.1:37366 accepted tcp:149.154.175.50:443 
2018/07/06 10:25:11 tcp:127.0.0.1:37368 accepted tcp:149.154.175.50:80 
2018/07/06 10:25:14 tcp:127.0.0.1:37370 accepted tcp:bwh1.net:443 
2018/07/06 10:25:14 tcp:127.0.0.1:37372 accepted tcp:bwh1.net:443 
2018/07/06 10:25:14 tcp:127.0.0.1:37374 accepted tcp:bwh1.net:443 
2018/07/06 10:25:14 tcp:127.0.0.1:37376 accepted tcp:bwh1.net:443 
2018/07/06 10:25:14 tcp:127.0.0.1:37378 accepted tcp:bwh1.net:443 
2018/07/06 10:25:15 tcp:127.0.0.1:37380 accepted tcp:149.154.175.50:443 
2018/07/06 10:25:15 tcp:127.0.0.1:37382 accepted tcp:149.154.175.50:80 
2018/07/06 10:25:16 tcp:127.0.0.1:37384 accepted tcp:149.154.167.51:443 
2018/07/06 10:25:16 tcp:127.0.0.1:37386 accepted tcp:91.108.56.120:443 
2018/07/06 10:25:16 tcp:127.0.0.1:37388 accepted tcp:149.154.167.51:80 
2018/07/06 10:25:16 tcp:127.0.0.1:37390 accepted tcp:91.108.56.120:80 
2018/07/06 10:25:17 tcp:127.0.0.1:37392 accepted tcp:149.154.167.51:443 
2018/07/06 10:25:17 tcp:127.0.0.1:37394 accepted tcp:149.154.167.51:80 

8)其他说明 首先请不要说这是服务器和本地时间不一样,我可以保证两台服务器和本地的时间误差在1秒以内,因为时区不同,整整相差了12小时。为什么服务端和客户端时间不一样,那是因为我在本地时间10点25执行了命令sudo tail -n30 /var/log/v2ray/access.log,所以当时两个服务器的时间应该是22点25,本地一直在接收访问,但是明显服务端在6分钟前就没有记录了,也就是客户端和服务端的链接已经断开,而且是两台服务器几乎同时断开了,这时候我分别ping了两台服务器

64 bytes from xxxxxxxxxx: icmp_seq=1 ttl=49 time=156 ms
64 bytes from xxxxxxxxxx: icmp_seq=2 ttl=49 time=155 ms
64 bytes from xxxxxxxxxx: icmp_seq=3 ttl=49 time=159 ms
64 bytes from xxxxxxxxxx: icmp_seq=5 ttl=49 time=164 ms
64 bytes from xxxxxxxxxx: icmp_seq=6 ttl=49 time=160 ms
64 bytes from xxxxxxxxxx: icmp_seq=7 ttl=49 time=158 ms
64 bytes from xxxxxxxxxx: icmp_seq=8 ttl=49 time=156 ms
64 bytes from xxxxxxxxxx: icmp_seq=9 ttl=49 time=165 ms
64 bytes from xxxxxxxxxx: icmp_seq=10 ttl=49 time=159 ms

---  ping statistics ---
10 packets transmitted, 9 received, 10% packet loss, time 13588ms
rtt min/avg/max/mdev = 155.076/159.617/165.458/3.397 ms
64 bytes from xxxxxxxxxx: icmp_seq=1 ttl=50 time=166 ms
64 bytes from xxxxxxxxxx: icmp_seq=2 ttl=50 time=168 ms
64 bytes from xxxxxxxxxx: icmp_seq=3 ttl=50 time=158 ms
64 bytes from xxxxxxxxxx: icmp_seq=4 ttl=50 time=157 ms
64 bytes from xxxxxxxxxx: icmp_seq=5 ttl=50 time=157 ms
64 bytes from xxxxxxxxxx: icmp_seq=6 ttl=50 time=160 ms
64 bytes from xxxxxxxxxx: icmp_seq=7 ttl=50 time=157 ms
64 bytes from xxxxxxxxxx: icmp_seq=8 ttl=50 time=161 ms
64 bytes from xxxxxxxxxx: icmp_seq=9 ttl=50 time=164 ms
64 bytes from xxxxxxxxxx: icmp_seq=10 ttl=50 time=158 ms

---  ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9010ms
rtt min/avg/max/mdev = 157.290/161.047/168.962/3.956 ms

以上就是我遇到的问题,总结一下就是本地和服务端都用的最新版,排除了本地网络错误和服务器网络错误,本地服务一直在工作,但是并没有把代理请求发送给服务端。

ak47for commented 6 years ago

这个软件就是各种断流,官方貌似也没有办法解决。。。

princelai commented 6 years ago

@dragonzhi 好吧,那既然都断那就这样吧。

hueyless commented 6 years ago

"dns": { "servers": [ "localhost" ] },

ak47for commented 6 years ago

@hweidz 没明白您什么意思,是配置不对吗?

testcaoy7 commented 6 years ago

最新版本TCP也断流,H2也断流,我现在改用WS,暂时没发现问题。望修复。

ak47for commented 6 years ago

这个断流问题发现很久了,一直没有修复,估计够呛了。

ak47for commented 6 years ago

这个断流问题发现很久了,一直没有修复,估计够呛了。

princelai commented 6 years ago

@hweidz 意思是DNS的问题导致断流么。我去试一下。我的DNS靠前的都是国内的,理论上不存在解析或访问不了的

testcaoy7 commented 6 years ago

@princelai 服务器和客户端日志错误日志你没记录,不太好debug

princelai commented 6 years ago

@testcaoy7 不是我没记录,是没有我就没贴出来

testcaoy7 commented 6 years ago

@princelai 把log level设置为info就会有大量输出了

princelai commented 6 years ago

最近改了配置,已经没有断流而了,把h2换成tcp,已经连续使用3天,非常正常,怀疑是不是h2的原因,或者是服务器上没加caddy导致的。

lolisTop commented 6 years ago

V2RAY_RAY_BUFFER_SIZE 设置成 1 具体就gg下 针对小内存