chika0801 / Xray-examples

Xray 配置示例
https://github.com/XTLS/Xray-core
447 stars 87 forks source link

`tcpMptcp` Configuration #29

Closed hawshemi closed 3 months ago

hawshemi commented 3 months ago

Hello I want to enable TCP multipath. In the docs it says it should be used in sockopt. Is my Server.json and Client.json configurations correct?

SERVER:

{
    "log": {
        "loglevel": "warning"
    },
    "routing": {
        "domainStrategy": "IpIfNonMatch",
        "rules": [
            {
                "type": "field",
                "ip": [
                    "geoip:private"
                ],
                "outboundTag": "block"
            }
        ]
    },
    "inbounds": [
        {
            "listen": "0.0.0.0",
            "port": XXX,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "XXX",
                        "flow": ""
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "sockopt": {
             "tcpMptcp": true,
             "tcpNoDelay": true
            },
                "network": "tcp",
                "security": "none",
                "tcpSettings": {
                    XXX
                      }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls",
                    "quic"
                ]
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "tag": "block"
        }
    ]
}

CLIENT:

{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "tag": "socks",
      "port": 10808,
      "listen": "127.0.0.1",
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http","tls","quic"],
        "routeOnly": false
      },
      "settings": {
        "auth": "noauth",
        "udp": true,
        "allowTransparent": false
      }
    },
    {
      "tag": "http",
      "port": 10809,
      "listen": "127.0.0.1",
      "protocol": "http",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http","tls","quic"],
        "routeOnly": false
      },
      "settings": {
        "auth": "noauth",
        "udp": true,
        "allowTransparent": false
      }
    }
  ],
  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "XXX",
            "port": XXX,
            "users": [
              {
                "id": "XXX",
                "security": "auto",
                "encryption": "none"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "sockopt": {
          "tcpMptcp": true,
          "tcpNoDelay": true
        },
        "network": "tcp",
        "tcpSettings": {
            XXX
        }
      }
    },
    {
      "tag": "direct",
      "protocol": "freedom"

    }
  ],
  "routing": {
    "domainStrategy": "IpIfNonMatch",
    "rules": [
      {
        "type": "field",
        "outboundTag": "direct",
        "ip": [
          "geoip:private"
        ]
      }
    ]
  }
}
chika0801 commented 3 months ago

参考: 客户端 https://github.com/chika0801/Xray-examples/blob/main/self-use/xray_server_vps1.json#L128

服务端 https://github.com/chika0801/Xray-examples/blob/main/self-use/xray_server_vps2.json#L21

两端系统要求是需要linux 5.6及以上版本内核,

hawshemi commented 3 months ago

Thanks. So my configs are correct and working as expected ?

hawshemi commented 3 months ago

And only for Linux? It's not for windows?

chika0801 commented 3 months ago

Thanks. So my configs are correct and working as expected ?

Looking at your configuration, a couple of the MPTCP parameters are in the right place.

And only for Linux? It's not for windows?

When WIN is the client, MPTCP is not supported, and MPTCP can only be effective if both ends support it, so when the client is WIN, it is not effective.