From 275370e32cddff5905cdf09ab9a60aa6799486e3 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Wed, 22 May 2024 18:35:46 +0200 Subject: [PATCH] new - (Sockopt) tcpMptcp , tcpNoDelay https://xtls.github.io/en/config/transport.html#sockoptobject --- sub/subJsonService.go | 2 +- web/assets/js/model/outbound.js | 5 ++++- web/assets/js/model/xray.js | 8 +++++++- web/html/xui/form/outbound.html | 3 +++ web/html/xui/form/stream/stream_httpupgrade.html | 2 +- web/html/xui/form/stream/stream_sockopt.html | 14 ++++++++++---- web/html/xui/form/stream/stream_tcp.html | 2 +- web/html/xui/form/stream/stream_ws.html | 2 +- web/html/xui/settings.html | 1 + 9 files changed, 29 insertions(+), 10 deletions(-) diff --git a/sub/subJsonService.go b/sub/subJsonService.go index 057c1e81..76d0b126 100644 --- a/sub/subJsonService.go +++ b/sub/subJsonService.go @@ -211,7 +211,7 @@ func (s *SubJsonService) streamData(stream string) map[string]interface{} { delete(streamSettings, "sockopt") if s.fragment != "" { - streamSettings["sockopt"] = json_util.RawMessage(`{"dialerProxy": "fragment", "tcpKeepAliveIdle": 100, "tcpNoDelay": true}`) + streamSettings["sockopt"] = json_util.RawMessage(`{"dialerProxy": "fragment", "tcpKeepAliveIdle": 100, "tcpMptcp": true, "tcpNoDelay": true}`) } // remove proxy protocol diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index 1cb1df21..e8f846b4 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -361,11 +361,12 @@ class RealityStreamSettings extends CommonClass { } }; class SockoptStreamSettings extends CommonClass { - constructor(dialerProxy = "", tcpFastOpen = false, tcpKeepAliveInterval = 0, tcpNoDelay = false) { + constructor(dialerProxy = "", tcpFastOpen = false, tcpKeepAliveInterval = 0, tcpMptcp = false, tcpNoDelay = false) { super(); this.dialerProxy = dialerProxy; this.tcpFastOpen = tcpFastOpen; this.tcpKeepAliveInterval = tcpKeepAliveInterval; + this.tcpMptcp = tcpMptcp; this.tcpNoDelay = tcpNoDelay; } @@ -375,6 +376,7 @@ class SockoptStreamSettings extends CommonClass { json.dialerProxy, json.tcpFastOpen, json.tcpKeepAliveInterval, + json.tcpMptcp, json.tcpNoDelay, ); } @@ -384,6 +386,7 @@ class SockoptStreamSettings extends CommonClass { dialerProxy: this.dialerProxy, tcpFastOpen: this.tcpFastOpen, tcpKeepAliveInterval: this.tcpKeepAliveInterval, + tcpMptcp: this.tcpMptcp, tcpNoDelay: this.tcpNoDelay, }; } diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index b8e85ff6..e43f7e10 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -881,12 +881,14 @@ RealityStreamSettings.Settings = class extends XrayCommonClass { }; class SockoptStreamSettings extends XrayCommonClass { - constructor(acceptProxyProtocol = false, tcpFastOpen = false, mark = 0, tproxy="off") { + constructor(acceptProxyProtocol = false, tcpFastOpen = false, mark = 0, tproxy="off", tcpMptcp = false, tcpNoDelay = false) { super(); this.acceptProxyProtocol = acceptProxyProtocol; this.tcpFastOpen = tcpFastOpen; this.mark = mark; this.tproxy = tproxy; + this.tcpMptcp = tcpMptcp; + this.tcpNoDelay = tcpNoDelay; } static fromJson(json = {}) { @@ -896,6 +898,8 @@ class SockoptStreamSettings extends XrayCommonClass { json.tcpFastOpen, json.mark, json.tproxy, + json.tcpMptcp, + json.tcpNoDelay, ); } @@ -905,6 +909,8 @@ class SockoptStreamSettings extends XrayCommonClass { tcpFastOpen: this.tcpFastOpen, mark: this.mark, tproxy: this.tproxy, + tcpMptcp: this.tcpMptcp, + tcpNoDelay: this.tcpNoDelay, }; } } diff --git a/web/html/xui/form/outbound.html b/web/html/xui/form/outbound.html index af432fdf..0718d4ed 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -403,6 +403,9 @@ + + + diff --git a/web/html/xui/form/stream/stream_httpupgrade.html b/web/html/xui/form/stream/stream_httpupgrade.html index d1cd2e02..a98291cb 100644 --- a/web/html/xui/form/stream/stream_httpupgrade.html +++ b/web/html/xui/form/stream/stream_httpupgrade.html @@ -1,6 +1,6 @@ {{define "form/streamHTTPUpgrade"}} - + diff --git a/web/html/xui/form/stream/stream_sockopt.html b/web/html/xui/form/stream/stream_sockopt.html index dd60a7e1..0a50a89e 100644 --- a/web/html/xui/form/stream/stream_sockopt.html +++ b/web/html/xui/form/stream/stream_sockopt.html @@ -1,11 +1,11 @@ {{define "form/streamSockopt"}} - + {{end}} diff --git a/web/html/xui/form/stream/stream_tcp.html b/web/html/xui/form/stream/stream_tcp.html index cf1a03ca..31d2f9e8 100644 --- a/web/html/xui/form/stream/stream_tcp.html +++ b/web/html/xui/form/stream/stream_tcp.html @@ -1,7 +1,7 @@ {{define "form/streamTCP"}} - + diff --git a/web/html/xui/form/stream/stream_ws.html b/web/html/xui/form/stream/stream_ws.html index 9b71070c..80f44c50 100644 --- a/web/html/xui/form/stream/stream_ws.html +++ b/web/html/xui/form/stream/stream_ws.html @@ -1,6 +1,6 @@ {{define "form/streamWS"}} - + diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html index 8bcb0258..96293daf 100644 --- a/web/html/xui/settings.html +++ b/web/html/xui/settings.html @@ -407,6 +407,7 @@ streamSettings: { sockopt: { tcpKeepAliveIdle: 100, + tcpMptcp: true, tcpNoDelay: true } }