Xray-examples icon indicating copy to clipboard operation
Xray-examples copied to clipboard

`tcpMptcp` Configuration

Open hawshemi opened this issue 3 months ago • 2 comments

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

hawshemi avatar Apr 02 '24 19:04 hawshemi

参考: 客户端 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及以上版本内核,

chika0801 avatar Apr 02 '24 21:04 chika0801

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

hawshemi avatar Apr 02 '24 21:04 hawshemi

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

hawshemi avatar Apr 04 '24 14:04 hawshemi

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.

chika0801 avatar Apr 10 '24 04:04 chika0801