v2ray / v2ray-core

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

启用 KCP 后上传“超速”的问题 #460

Closed hyxxsfwy closed 6 years ago

hyxxsfwy commented 7 years ago

提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。

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

2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。

3) 你看到的不正常的现象是什么?

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

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

Server Configuration File(服务器端配置文件):
{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },

  "inbound": {
    "port": 8787,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "***",
          "level": 1,
          "alterId": 64,
          "email": "***"
        },
        {
          "id": "***",
          "level": 0,
          "alterId": 32,
          "email": "test001@example.com"
        }
      ]
    },
    "streamSettings": {
      "network": "kcp"
    }
  },

  "outbound": {
    "protocol": "freedom",
    "settings": {}
  },

  "inboundDetour": [
    {
      "port": 18787,
      "protocol": "vmess",
      "tag": "dynamic_port",
      "settings": {
        "clients": [
          {
            "id": "***",
            "level": 1,
            "alterId": 64,
            "email": "***"
          },
          {
            "id": "***",
            "level": 0,
            "alterId": 32,
            "email": "test001@example.com"
          }
        ],
        "detour": {
          "to": "tcp_bbr"
        }
      },
      "streamSettings": {
        "network": "tcp"
      }
    },
    {
      "port": "30001-30100",
      "protocol": "vmess",
      "tag": "tcp_bbr",
      "settings": {},
      "allocate": {
        "strategy": "random",
        "concurrency": 2,
        "refresh": 5
      },
      "streamSettings": {
        "network": "tcp"
      }
    }
  ],

  "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"
        }
      ]
    }
  },

  "transport": {
    "tcpSettings": {
      "connectionReuse": true,
      "header": {
        "type": "none"
      }
    },
    "kcpSettings": {
      "mtu": 800,
      "tti": 50,
      "uplinkCapacity": 30,
      "downlinkCapacity": 50,
      "congestion": true,
      "readBufferSize": 1,
      "writeBufferSize": 1,
      "header": {
        "type": "wechat-video"
      }
    }
  }
}
Client Configuration File(客户端配置文件):
{
  "log": {
    "loglevel": "debug"
  },

  "inbound": {
    "protocol": "socks",
    "port": 10086,
    "listen": "127.0.0.1",
    "settings": {
      "auth": "noauth",
      "udp": true,
      "ip": "127.0.0.1",
      "timeout": 0
    }
  },

  "inboundDetour": [
    {
      "protocol": "http",
      "port": 10087,
      "listen": "127.0.0.1",
      "settings": {
        "timeout": 0
      }
    },
    {
      "protocol": "dokodemo-door",
      "port": 25353,
      "listen": "127.0.0.1",
      "settings": {
        "address": "8.8.8.8",
        "port": 53,
        "network": "tcp,udp",
        "timeout": 0
      }
    }
  ],

  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "***",
          "port": 8787,
          "users": [
            {
              "id": "***",
              "level": 1,
              "alterId": 64,
              "security": "aes-128-gcm",
              "email": "***"
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "kcp"
    },
    "mux": {
      "enabled": true,
      "concurrency": 8
    }
  },

  "outboundDetour": [
    {
      "protocol": "freedom",
      "tag": "direct",
      "settings": {}
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],

  "dns": {
    "servers": [
//    "114.114.114.114",
//    "223.5.5.5",
      "localhost"
    ]
  },

  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "AsIs",
      "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": "direct"
        }
      ]
    }
  },

  "transport": {
    "tcpSettings": {
      "connectionReuse": true,
      "header": {
        "type": "none"
      }
    },
    "kcpSettings": {
      "mtu": 800,
      "tti": 50,
      "uplinkCapacity": 5,
      "downlinkCapacity": 20,
      "congestion": true,
      "readBufferSize": 1,
      "writeBufferSize": 1,
      "header": {
        "type": "wechat-video"
      }
    }
  }
}

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

Server Log File(服务器端日志):
2017/06/01 20:11:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30088: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:11:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30041: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:16:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30017: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:16:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30025: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:21:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30050: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:21:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30069: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:26:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30071: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:26:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30053: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:31:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30072: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:31:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30022: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:36:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30067: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:36:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30085: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:41:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30088: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:41:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30100: use of closed network connection] > Retry: all retry attempts failed
Client Log File(客户端日志):
V2Ray v2.31 (One for all) 20170530
An unified platform for anti-censorship.
2017/06/01 20:09:04 [Debug]App|Proxyman|Inbound: creating tcp worker on 127.0.0.1:10086
2017/06/01 20:09:04 [Debug]App|Proxyman|Inbound: creating tcp worker on 127.0.0.1:10087
2017/06/01 20:09:04 [Debug]App|Proxyman|Inbound: creating tcp worker on 127.0.0.1:25353
2017/06/01 20:09:04 [Info]Transport|Internet|TCP: listening TCP on 127.0.0.1:10086
2017/06/01 20:09:04 [Info]Transport|Internet|UDP: listening UDP on 127.0.0.1:10086
2017/06/01 20:09:04 [Info]Transport|Internet|TCP: listening TCP on 127.0.0.1:10087
2017/06/01 20:09:04 [Info]Transport|Internet|TCP: listening TCP on 127.0.0.1:25353
2017/06/01 20:09:04 [Info]Transport|Internet|UDP: listening UDP on 127.0.0.1:25353
2017/06/01 20:09:04 [Warning]Core: V2Ray started
2017/06/01 20:09:34 [Info]Proxy|Socks: TCP Connect request to tcp:bolt.dropbox.com:443
2017/06/01 20:09:34 [Info]App|Dispatcher|Default: default route for tcp:bolt.dropbox.com:443
2017/06/01 20:09:34 [Info]App|Proxyman|Mux: dispatching request to tcp:bolt.dropbox.com:443
2017/06/01 20:09:34 [Info]Transport|Internet|mKCP: dialing mKCP to udp:Server_IP:8787
2017/06/01 20:09:34 [Info]Transport|Internet|mKCP: creating connection 21733
2017/06/01 20:09:34 [Info]Proxy|VMess|Outbound: tunneling request to tcp:v1.mux.cool:9527 via tcp:Server_IP:8787
2017/06/01 20:09:39 [Info]Proxy|Socks: TCP Connect request to tcp:bolt.dropbox.com:443
2017/06/01 20:09:39 [Info]App|Dispatcher|Default: default route for tcp:bolt.dropbox.com:443
2017/06/01 20:09:39 [Info]App|Proxyman|Mux: dispatching request to tcp:bolt.dropbox.com:443
2017/06/01 20:09:51 [Info]Proxy|Socks: TCP Connect request to tcp:client-cf.dropbox.com:443
2017/06/01 20:09:51 [Info]App|Dispatcher|Default: default route for tcp:client-cf.dropbox.com:443
2017/06/01 20:09:51 [Info]App|Proxyman|Mux: dispatching request to tcp:client-cf.dropbox.com:443
2017/06/01 20:09:58 [Info]Proxy|Socks: TCP Connect request to tcp:client-cf.dropbox.com:443
2017/06/01 20:09:58 [Info]App|Dispatcher|Default: default route for tcp:client-cf.dropbox.com:443
2017/06/01 20:09:58 [Info]App|Proxyman|Mux: dispatching request to tcp:client-cf.dropbox.com:443
2017/06/01 20:10:19 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:11:33 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:11:33 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:11:33 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:12:44 [Info]Proxy|Socks: TCP Connect request to tcp:bolt.dropbox.com:443
2017/06/01 20:12:44 [Info]App|Dispatcher|Default: default route for tcp:bolt.dropbox.com:443
2017/06/01 20:12:44 [Info]App|Proxyman|Mux: dispatching request to tcp:bolt.dropbox.com:443
2017/06/01 20:12:57 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:12:57 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:12:57 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:13:18 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:13:18 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:13:18 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:13:29 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > Proxy|Socks: failed to transport all TCP request > read tcp 127.0.0.1:10086->127.0.0.1:1966: wsarecv: An existing connection was forcibly closed by the remote host.
2017/06/01 20:13:51 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > context canceled
2017/06/01 20:13:58 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > context canceled
2017/06/01 20:14:00 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:14:00 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:14:00 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:14:24 [Info]Proxy|Socks: TCP Connect request to tcp:bolt.dropbox.com:443
2017/06/01 20:14:24 [Info]App|Dispatcher|Default: default route for tcp:bolt.dropbox.com:443
2017/06/01 20:14:24 [Info]App|Proxyman|Mux: dispatching request to tcp:bolt.dropbox.com:443
2017/06/01 20:14:29 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > Proxy|Socks: failed to transport all TCP request > read tcp 127.0.0.1:10086->127.0.0.1:1968: wsarecv: An existing connection was forcibly closed by the remote host.
2017/06/01 20:15:21 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > context canceled
qingfengshi commented 7 years ago

我也发现这个问题,从使用kcp的第一天就有了,今天看完你的问题才知道是怎么回事

ToutyRater commented 7 years ago

所谓的超速是因为v2ray按某个速率往外发送包,但电信对带宽的限制是电信的事,v2ray可突破不了,所以你看到上传速度很快,其实压根不是这么一回事。至于你说的文件上传不了的结果,我猜测是因为发送包太疯狂,电信把你的网给掐了,这个问题你可以试试开拥塞控制(我感觉没什么用)。耗流量是众所周知的

lutasa43210 commented 6 years ago

我也遇到了相同的问题,临时解决方案在dropbox的首选项中限制上传的速度。

nicholascw commented 6 years ago

如果说是只有dropbox客户端有这个问题,那个人觉得很可能是因为,你本地监测到的是发包的速率,但是上层网关到底给你drop多少你是无从得知的,如果Dropbox自己又有了自适应的发包策略应该会被本地错误的过大的发包量欺骗。。然后结果就是正向自激打环开始把发包量往高了推。。。然后就是运营商口中听不懂的话,什么QoS啊,黑洞路由啊……所以正解应该是再把dropbox的上传速率固定一下。至于网页版看到的数倍,同理,是kcp的正常工况

DarienRaymond commented 6 years ago

mKCP 的带宽设定只是一个估算值,你可以尝试减少带宽设定以达到你需要的限额。