v2ray / v2ray-core

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

2.33版本无法建立kcp或者tcp连接 #514

Closed cuiwolf closed 7 years ago

cuiwolf commented 7 years ago

提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。 Please read the instruction and answer the following questions before submitting your issue. Thank you.

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) What version of V2Ray are you using (If you deploy different version on server and client, please explicitly point out)? 服务器使用2.33版本,客户端使用2.33版本和1.11版的V2rayN

2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 What's your scenario of using V2Ray? E.g., Watching YouTube videos in Chrome via Socks/VMess proxy. 使用Firefox通过Socks/VMess 代理连接网络

3) 你看到的不正常的现象是什么? What did you see? 网页总是处于正在进行TLS握手状态

4) 你期待看到的正确表现是怎样的? What's your expectation? 能够正常连接网络

5) 请附上你的配置文件(提交 Issue 前请隐藏服务器端IP地址)。 Please attach your configuration file (Mask IP addresses before submit this issue).

Server Configuration File(服务器端配置文件):

使用的是来自https://www.v2ray.com/chapter_05/00_config/10_multi_mode.html的提供的模板。

    // 在这里附上服务器端配置文件
    // Please attach your server configuration file here.
{
"log": {
  "access": "/var/log/v2ray/access.log",
  "error": "/var/log/v2ray/error.log",
  "loglevel": "info"
},

"inbound": {
  "port": 27000,
  "protocol": "vmess",
  "settings": {
    "clients": [
      {
        "id": "7d7b124f-3fdb-4465-99ca-5c0a1f4718ed",
        "level": 1,
        "alterId": 100
      }
    ]
  },
  "streamSettings": {
    "network": "kcp"
  }
},

"inboundDetour": [ 
  {
    "port": 28000,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "3e93c132-0c46-462d-821b-cd212e4451f2",
          "level": 1,
          "alterId": 100
        }
      ]
    }
  },
  {
    "port": 27001,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "4ad0f120-97e6-4fe8-83d6-05a66fde180e",
          "level": 1,
          "alterId": 100
        }
      ],
      "detour": {
        "to": "detour-kcp"
      }
    },
    "streamSettings": {
      "network": "kcp"
    }
  },
  {
    "port": 28001,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "acf4d82e-0f08-487b-bc4c-045e4c0d6ef8",
          "level": 1,
          "alterId": 100
        }
      ],
      "detour": {
        "to": "detour-tcp"
      }
    }
  },
  {
    "protocol": "vmess",
    "port": "50001-50100", 
    "tag": "detour-kcp",
    "settings": {},
    "allocate": {
      "strategy": "random",
      "concurrency": 2,
      "refresh": 5
    },
    "streamSettings": {
      "network": "kcp"
    }
  },
  {
    "protocol": "vmess",
    "port": "51001-51100", 
    "tag": "detour-tcp",
    "settings": {},
    "allocate": {
      "strategy": "random",
      "concurrency": 2,
      "refresh": 5
    }
  }
],

"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",
          "::1/128",
          "fc00::/7",
          "fe80::/10"
        ],
        "outboundTag": "blocked"
      }
    ]
  }
},

"transport": {
  "tcpSettings": {
    "connectionReuse": true
  },
  "kcpSettings": {
    "mtu": 1350,
    "tti": 20,
    "uplinkCapacity": 12,
    "downlinkCapacity": 100,
    "congestion": false,
    "readBufferSize": 1,
    "writeBufferSize": 1,
    "header": {
      "type": "none"
    }
  }
}
Client Configuration File(客户端配置文件):
    // 在这里附上客户端配置文件
    // Please attach your client configuration file here.
//tcp的配置文件
{
  "log": {
    "access": "",
    "error": "",
    "loglevel": ""
  },
  "inbound": {
    "port": 1080,
    "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": "1.2.3.4",
          "port": 28000,
          "users": [
            {
              "id": "7d7b124f-3fdb-4465-99ca-5c0a1f4718ed",
              "alterId": 100,
              "security": "aes-128-gcm"
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "tcp",
      "security": "",
      "tcpSettings": {
        "connectionReuse": true,
        "header": {
          "type": "http",
          "request": {
            "version": "1.1",
            "method": "GET",
            "path": [
              "/"
            ],
            "headers": {
              "Host": [
                ""
              ],
              "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
                "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
              ],
              "Accept-Encoding": [
                "gzip, deflate"
              ],
              "Connection": [
                "keep-alive"
              ],
              "Pragma": "no-cache"
            }
          },
          "response": {
            "version": "1.1",
            "status": "200",
            "reason": "OK",
            "headers": {
              "Content-Type": [
                "application/octet-stream",
                "application/x-msdownload",
                "text/html",
                "application/x-shockwave-flash"
              ],
              "Transfer-Encoding": [
                "chunked"
              ],
              "Connection": [
                "keep-alive"
              ],
              "Pragma": "no-cache"
            }
          }
        }
      },
      "kcpSettings": null,
      "wsSettings": 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
        }
      ]
    }
  }
}
//kcp配置文件
{
  "log": {
    "access": "",
    "error": "",
    "loglevel": ""
  },
  "inbound": {
    "port": 1080,
    "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": "1.2.3.4",
          "port": 27000,
          "users": [
            {
              "id": "7d7b124f-3fdb-4465-99ca-5c0a1f4718ed",
              "alterId": 100,
              "security": "aes-128-gcm"
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "kcp",
      "security": "",
      "tcpSettings": null,
      "kcpSettings": {
        "mtu": 1350,
        "tti": 50,
        "uplinkCapacity": 12,
        "downlinkCapacity": 100,
        "congestion": false,
        "readBufferSize": 2,
        "writeBufferSize": 2,
        "header": {
          "type": "srtp",
          "request": null,
          "response": null
        }
      },
      "wsSettings": 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
        }
      ]
    }
  }
}

6) 请附上出错时软件输出的日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。 Please attach the log file, especially the bottom lines if the file is large. Log file is usually /var/log/v2ray/error.log on Linux.

Server Log File(服务器端日志):
    // 在这里附上服务器端日志
    // Please attach your server log here.
//kcp连接时error.log文件产生无限多的下列错误,access.log文件无内容
2017/07/31 00:28:40 [Warning]Core: V2Ray started
2017/07/31 00:38:26 [Warning]Core: V2Ray started
2017/07/31 00:38:26 [Info]Transport|Internet|mKCP: discarding invalid payload from udp:171.35.121.12:55372
2017/07/31 00:38:26 [Info]Transport|Internet|mKCP: discarding invalid payload from udp:171.35.121.12:55372
2017/07/31 00:38:26 [Info]Transport|Internet|mKCP: discarding invalid payload from udp:171.35.121.12:55372
2017/07/31 00:38:26 [Info]Transport|Internet|mKCP: discarding invalid payload from udp:171.35.121.12:55372
2017/07/31 00:38:26 [Info]Transport|Internet|mKCP: discarding invalid payload from udp:171.35.121.12:55372
2017/07/31 00:38:26 [Info]Transport|Internet|mKCP: discarding invalid payload from udp:171.35.121.12:55372
2017/07/31 00:38:26 [Info]Transport|Internet|mKCP: discarding invalid payload from udp:171.35.121.12:55372
2017/07/31 00:38:26 [Info]Transport|Internet|mKCP: discarding invalid payload from udp:171.35.121.12:55372
//tcp连接时error.log文件重复产生下列错误
2017/07/31 00:39:37 [Info]Proxy|VMess|Inbound: invalid request from 171.35.121.12:50400: Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:37 [Info]App|Proxyman|Inbound: connection ends > Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:38 [Info]Proxy|VMess|Inbound: invalid request from 171.35.121.12:50402: Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:38 [Info]App|Proxyman|Inbound: connection ends > Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:39 [Info]Proxy|VMess|Inbound: invalid request from 171.35.121.12:50403: Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:39 [Info]App|Proxyman|Inbound: connection ends > Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:45 [Info]Proxy|VMess|Inbound: invalid request from 171.35.121.12:50404: Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:45 [Info]App|Proxyman|Inbound: connection ends > Proxy|VMess|Encoding: invalid user
//access.log如下内容
2017/07/31 00:39:31 171.35.121.12:50398 rejected  Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:32 171.35.121.12:50399 rejected  Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:37 171.35.121.12:50400 rejected  Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:38 171.35.121.12:50402 rejected  Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:39 171.35.121.12:50403 rejected  Proxy|VMess|Encoding: invalid user
2017/07/31 00:39:45 171.35.121.12:50404 rejected  Proxy|VMess|Encoding: invalid user
Client Log File(客户端日志):
    // 在这里附上客户端日志
    // Please attach your client log here.
cuiwolf commented 7 years ago

测试出来了必须要把tcp或者kcp的设置写在每一个inbound里才行,像这样: "inbound": { "port": 26000, "listen": null, "protocol": "vmess", "settings": { "auth": null, "udp": false, "ip": null, "clients": [ { "id": "326536c4-1d51-90d3-e8b0-702fe4de5e72", "alterId": 100, "security": null } ] }, "streamSettings": { "network": "tcp", "security": "", "tcpSettings": { "connectionReuse": true, "header": { "type": "http", "request": { "version": "1.1", "method": "GET", "path": [ "/" ], "headers": { "Host": [ "" ], "User-Agent": [ "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46" ], "Accept-Encoding": [ "gzip, deflate" ], "Connection": [ "keep-alive" ], "Pragma": "no-cache" } }, "response": { "version": "1.1", "status": "200", "reason": "OK", "headers": { "Content-Type": [ "application/octet-stream", "application/x-msdownload", "text/html", "application/x-shockwave-flash" ], "Transfer-Encoding": [ "chunked" ], "Connection": [ "keep-alive" ], "Pragma": "no-cache" } } } }, "kcpSettings": null, "wsSettings": null } }, "outbound": { "tag": null, "protocol": "freedom", "settings": null, "streamSettings": null, "mux": null },

"inboundDetour": [
{ "port": 25000, "listen": null, "protocol": "vmess", "settings": { "auth": null, "udp": false, "ip": null, "clients": [ { "id": "326536c4-1d51-90d3-e8b0-702fe4de5e72", "alterId": 100, "security": null } ] }, "streamSettings": { "network": "kcp", "security": "", "tcpSettings": null, "kcpSettings": { "mtu": 1350, "tti": 50, "uplinkCapacity": 100, "downlinkCapacity": 100, "congestion": false, "readBufferSize": 2, "writeBufferSize": 2, "header": { "type": "wechat-video", "request": null, "response": null } }, "wsSettings": null } }