From 9c065aed4eb48bb35165f60339a9c47bbbfd1514 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Thu, 31 Oct 2024 14:43:30 +0100 Subject: [PATCH 01/49] Access URL - after you get SSL --- x-ui.sh | 82 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/x-ui.sh b/x-ui.sh index e6d262f4..0daf0a3c 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -931,6 +931,8 @@ ssl_cert_issue_main() { } ssl_cert_issue() { + local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}') + local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}') # check for acme.sh first if ! command -v ~/.acme.sh/acme.sh &>/dev/null; then echo "acme.sh could not be found. we will install it" @@ -1049,6 +1051,7 @@ ssl_cert_issue() { LOGI "Panel paths set for domain: $domain" LOGI " - Certificate File: $webCertFile" LOGI " - Private Key File: $webKeyFile" + echo -e "${green}Access URL: https://${domain}:${existing_port}${existing_webBasePath}${plain}" restart else LOGE "Error: Certificate or private key file not found for domain: $domain." @@ -1453,12 +1456,12 @@ SSH_port_forwarding() { echo -e "${green}Panel is secure with SSL.${plain}" return 0 fi - if [[ -z "$existing_cert" && -z "$existing_key" && -z "$existing_listenIP" ]]; then - echo -e "\n${red}Warning: No Cert and Key found! The panel is not secure.${plain}" - echo "Please obtain a certificate or set up SSH port forwarding." + if [[ -z "$existing_cert" && -z "$existing_key" && (-z "$existing_listenIP" || "$existing_listenIP" == "0.0.0.0") ]]; then + echo -e "\n${red}Warning: No Cert and Key found! The panel is not secure.${plain}" + echo "Please obtain a certificate or set up SSH port forwarding." fi - if [[ -n "$existing_listenIP" && (-z "$existing_cert" && -z "$existing_key") ]]; then + if [[ -n "$existing_listenIP" && "$existing_listenIP" != "0.0.0.0" && (-z "$existing_cert" && -z "$existing_key") ]]; then echo -e "\n${green}Current SSH Port Forwarding Configuration:${plain}" echo -e "Standard SSH command:" echo -e "${yellow}ssh -L 2222:${existing_listenIP}:${existing_port} root@${server_ip}${plain}" @@ -1467,7 +1470,7 @@ SSH_port_forwarding() { echo -e "\nAfter connecting, access the panel at:" echo -e "${yellow}http://localhost:2222${existing_webBasePath}${plain}" fi - + echo -e "\nChoose an option:" echo -e "${green}1.${plain} Set listen IP" echo -e "${green}2.${plain} Clear listen IP" @@ -1475,45 +1478,42 @@ SSH_port_forwarding() { read -p "Choose an option: " num case "$num" in - 1) - if [[ -z "$existing_listenIP" ]]; then - echo -e "\nNo listenIP configured. Choose an option:" - echo -e "1. Use default IP (127.0.0.1)" - echo -e "2. Set a custom IP" - read -p "Select an option (1 or 2): " listen_choice + 1) + if [[ -z "$existing_listenIP" || "$existing_listenIP" == "0.0.0.0" ]]; then + echo -e "\nNo listenIP configured. Choose an option:" + echo -e "1. Use default IP (127.0.0.1)" + echo -e "2. Set a custom IP" + read -p "Select an option (1 or 2): " listen_choice - config_listenIP="127.0.0.1" - [[ "$listen_choice" == "2" ]] && read -p "Enter custom IP to listen on: " config_listenIP + config_listenIP="127.0.0.1" + [[ "$listen_choice" == "2" ]] && read -p "Enter custom IP to listen on: " config_listenIP - /usr/local/x-ui/x-ui setting -listenIP "${config_listenIP}" >/dev/null 2>&1 - echo -e "${green}listen IP has been set to ${config_listenIP}.${plain}" - restart - else - config_listenIP="${existing_listenIP}" - echo -e "${green}Current listen IP is already set to ${config_listenIP}.${plain}" - fi - - if [[ -n "${config_listenIP}" ]]; then - echo -e "\n${green}SSH Port Forwarding Configuration:${plain}" - echo -e "Standard SSH command:" - echo -e "${yellow}ssh -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" - echo -e "\nIf using SSH key:" - echo -e "${yellow}ssh -i -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" - echo -e "\nAfter connecting, access the panel at:" - echo -e "${yellow}http://localhost:2222${existing_webBasePath}${plain}" - fi - ;; - 2) - /usr/local/x-ui/x-ui setting -listenIP ' ' >/dev/null 2>&1 - echo -e "${green}Listen IP has been cleared.${plain}" + /usr/local/x-ui/x-ui setting -listenIP "${config_listenIP}" >/dev/null 2>&1 + echo -e "${green}listen IP has been set to ${config_listenIP}.${plain}" + echo -e "\n${green}SSH Port Forwarding Configuration:${plain}" + echo -e "Standard SSH command:" + echo -e "${yellow}ssh -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" + echo -e "\nIf using SSH key:" + echo -e "${yellow}ssh -i -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" + echo -e "\nAfter connecting, access the panel at:" + echo -e "${yellow}http://localhost:2222${existing_webBasePath}${plain}" restart - ;; - 0) - echo "Operation aborted." - ;; - *) - echo "Invalid option. Exiting." - ;; + else + config_listenIP="${existing_listenIP}" + echo -e "${green}Current listen IP is already set to ${config_listenIP}.${plain}" + fi + ;; + 2) + /usr/local/x-ui/x-ui setting -listenIP 0.0.0.0 >/dev/null 2>&1 + echo -e "${green}Listen IP has been cleared.${plain}" + restart + ;; + 0) + echo "Operation aborted." + ;; + *) + echo "Invalid option. Exiting." + ;; esac } From e3576e8a856b5edd2fe8ffac06ab255f6a1df342 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 17:40:14 +0100 Subject: [PATCH 02/49] Bump github.com/shirou/gopsutil/v4 from 4.24.9 to 4.24.10 (#2593) Bumps [github.com/shirou/gopsutil/v4](https://github.com/shirou/gopsutil) from 4.24.9 to 4.24.10. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v4.24.9...v4.24.10) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1a5c32ba..3943989d 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 github.com/pelletier/go-toml/v2 v2.2.3 github.com/robfig/cron/v3 v3.0.1 - github.com/shirou/gopsutil/v4 v4.24.9 + github.com/shirou/gopsutil/v4 v4.24.10 github.com/valyala/fasthttp v1.57.0 github.com/xtls/xray-core v1.8.25-0.20241031075831-4ec5c78c3453 go.uber.org/atomic v1.11.0 diff --git a/go.sum b/go.sum index ea99f6dd..03b50bf1 100644 --- a/go.sum +++ b/go.sum @@ -147,8 +147,8 @@ github.com/savsgio/gotils v0.0.0-20240704082632-aef3928b8a38 h1:D0vL7YNisV2yqE55 github.com/savsgio/gotils v0.0.0-20240704082632-aef3928b8a38/go.mod h1:sM7Mt7uEoCeFSCBM+qBrqvEo+/9vdmj19wzp3yzUhmg= github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 h1:emzAzMZ1L9iaKCTxdy3Em8Wv4ChIAGnfiz18Cda70g4= github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg= -github.com/shirou/gopsutil/v4 v4.24.9 h1:KIV+/HaHD5ka5f570RZq+2SaeFsb/pq+fp2DGNWYoOI= -github.com/shirou/gopsutil/v4 v4.24.9/go.mod h1:3fkaHNeYsUFCGZ8+9vZVWtbyM1k2eRnlL+bWO8Bxa/Q= +github.com/shirou/gopsutil/v4 v4.24.10 h1:7VOzPtfw/5YDU+jLEoBwXwxJbQetULywoSV4RYY7HkM= +github.com/shirou/gopsutil/v4 v4.24.10/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= From adb08a60cfb7aa30f10410f78a82daf203df28c6 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Sun, 3 Nov 2024 10:51:53 +0100 Subject: [PATCH 03/49] rename - splithttp to xhttp --- web/assets/js/model/outbound.js | 2 +- web/html/xui/form/outbound.html | 6 +++--- web/html/xui/form/stream/stream_settings.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index d7338645..78078dd6 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -960,7 +960,7 @@ Outbound.BlackholeSettings = class extends CommonClass { Outbound.DNSSettings = class extends CommonClass { constructor( network = 'udp', - address = '1.1.1.1', + address = '', port = 53, nonIPQuery = 'drop', blockTypes = [] diff --git a/web/html/xui/form/outbound.html b/web/html/xui/form/outbound.html index 07b8f275..2f5d8207 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -267,13 +267,13 @@ diff --git a/web/html/xui/form/stream/stream_splithttp.html b/web/html/xui/form/stream/stream_splithttp.html index 957720e9..12cd3cac 100644 --- a/web/html/xui/form/stream/stream_splithttp.html +++ b/web/html/xui/form/stream/stream_splithttp.html @@ -22,6 +22,12 @@ + + + [[ key ]] + + diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index 36f165c6..0e0a18fc 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -58,6 +58,14 @@ + diff --git a/web/html/xui/form/stream/stream_ws.html b/web/html/xui/form/stream/stream_ws.html index 80f44c50..16a423ca 100644 --- a/web/html/xui/form/stream/stream_ws.html +++ b/web/html/xui/form/stream/stream_ws.html @@ -9,6 +9,9 @@ + + + From b859327b8ad84dd2b44b9bd3a336a63646833701 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Tue, 3 Dec 2024 22:24:34 +0100 Subject: [PATCH 32/49] splithttp to xhttp --- sub/subService.go | 48 ++++++------- web/assets/js/model/inbound.js | 68 +++++++++---------- web/assets/js/model/outbound.js | 24 +++---- web/html/xui/form/outbound.html | 12 ++-- web/html/xui/form/stream/stream_settings.html | 8 +-- ...tream_splithttp.html => stream_xhttp.html} | 38 +++++------ web/html/xui/inbound_info_modal.html | 6 +- 7 files changed, 102 insertions(+), 102 deletions(-) rename web/html/xui/form/stream/{stream_splithttp.html => stream_xhttp.html} (55%) diff --git a/sub/subService.go b/sub/subService.go index 1659b98b..84846241 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -229,16 +229,16 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string { headers, _ := httpupgrade["headers"].(map[string]interface{}) obj["host"] = searchHost(headers) } - case "splithttp": - splithttp, _ := stream["splithttpSettings"].(map[string]interface{}) - obj["path"] = splithttp["path"].(string) - if host, ok := splithttp["host"].(string); ok && len(host) > 0 { + case "xhttp": + xhttp, _ := stream["xhttpSettings"].(map[string]interface{}) + obj["path"] = xhttp["path"].(string) + if host, ok := xhttp["host"].(string); ok && len(host) > 0 { obj["host"] = host } else { - headers, _ := splithttp["headers"].(map[string]interface{}) + headers, _ := xhttp["headers"].(map[string]interface{}) obj["host"] = searchHost(headers) } - obj["mode"] = splithttp["mode"].(string) + obj["mode"] = xhttp["mode"].(string) } security, _ := stream["security"].(string) obj["tls"] = security @@ -381,16 +381,16 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string { headers, _ := httpupgrade["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - case "splithttp": - splithttp, _ := stream["splithttpSettings"].(map[string]interface{}) - params["path"] = splithttp["path"].(string) - if host, ok := splithttp["host"].(string); ok && len(host) > 0 { + case "xhttp": + xhttp, _ := stream["xhttpSettings"].(map[string]interface{}) + params["path"] = xhttp["path"].(string) + if host, ok := xhttp["host"].(string); ok && len(host) > 0 { params["host"] = host } else { - headers, _ := splithttp["headers"].(map[string]interface{}) + headers, _ := xhttp["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - params["mode"] = splithttp["mode"].(string) + params["mode"] = xhttp["mode"].(string) } security, _ := stream["security"].(string) if security == "tls" { @@ -579,16 +579,16 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string headers, _ := httpupgrade["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - case "splithttp": - splithttp, _ := stream["splithttpSettings"].(map[string]interface{}) - params["path"] = splithttp["path"].(string) - if host, ok := splithttp["host"].(string); ok && len(host) > 0 { + case "xhttp": + xhttp, _ := stream["xhttpSettings"].(map[string]interface{}) + params["path"] = xhttp["path"].(string) + if host, ok := xhttp["host"].(string); ok && len(host) > 0 { params["host"] = host } else { - headers, _ := splithttp["headers"].(map[string]interface{}) + headers, _ := xhttp["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - params["mode"] = splithttp["mode"].(string) + params["mode"] = xhttp["mode"].(string) } security, _ := stream["security"].(string) if security == "tls" { @@ -777,16 +777,16 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st headers, _ := httpupgrade["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - case "splithttp": - splithttp, _ := stream["splithttpSettings"].(map[string]interface{}) - params["path"] = splithttp["path"].(string) - if host, ok := splithttp["host"].(string); ok && len(host) > 0 { + case "xhttp": + xhttp, _ := stream["xhttpSettings"].(map[string]interface{}) + params["path"] = xhttp["path"].(string) + if host, ok := xhttp["host"].(string); ok && len(host) > 0 { params["host"] = host } else { - headers, _ := splithttp["headers"].(map[string]interface{}) + headers, _ := xhttp["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - params["mode"] = splithttp["mode"].(string) + params["mode"] = xhttp["mode"].(string) } security, _ := stream["security"].(string) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index 35f9dc3a..e8c3ab5d 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -525,7 +525,7 @@ class HTTPUpgradeStreamSettings extends XrayCommonClass { } } -class SplitHTTPStreamSettings extends XrayCommonClass { +class xHTTPStreamSettings extends XrayCommonClass { constructor( path = '/', host = '', @@ -567,7 +567,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass { } static fromJson(json = {}) { - return new SplitHTTPStreamSettings( + return new xHTTPStreamSettings( json.path, json.host, XrayCommonClass.toHeaders(json.headers), @@ -961,7 +961,7 @@ class StreamSettings extends XrayCommonClass { httpSettings = new HttpStreamSettings(), grpcSettings = new GrpcStreamSettings(), httpupgradeSettings = new HTTPUpgradeStreamSettings(), - splithttpSettings = new SplitHTTPStreamSettings(), + xhttpSettings = new xHTTPStreamSettings(), sockopt = undefined, ) { super(); @@ -976,7 +976,7 @@ class StreamSettings extends XrayCommonClass { this.http = httpSettings; this.grpc = grpcSettings; this.httpupgrade = httpupgradeSettings; - this.splithttp = splithttpSettings; + this.xhttp = xhttpSettings; this.sockopt = sockopt; } @@ -1026,7 +1026,7 @@ class StreamSettings extends XrayCommonClass { HttpStreamSettings.fromJson(json.httpSettings), GrpcStreamSettings.fromJson(json.grpcSettings), HTTPUpgradeStreamSettings.fromJson(json.httpupgradeSettings), - SplitHTTPStreamSettings.fromJson(json.splithttpSettings), + xHTTPStreamSettings.fromJson(json.xhttpSettings), SockoptStreamSettings.fromJson(json.sockopt), ); } @@ -1045,7 +1045,7 @@ class StreamSettings extends XrayCommonClass { httpSettings: network === 'http' ? this.http.toJson() : undefined, grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined, httpupgradeSettings: network === 'httpupgrade' ? this.httpupgrade.toJson() : undefined, - splithttpSettings: network === 'splithttp' ? this.splithttp.toJson() : undefined, + xhttpSettings: network === 'xhttp' ? this.xhttp.toJson() : undefined, sockopt: this.sockopt != undefined ? this.sockopt.toJson() : undefined, }; } @@ -1182,8 +1182,8 @@ class Inbound extends XrayCommonClass { return this.network === "httpupgrade"; } - get isSplithttp() { - return this.network === "splithttp"; + get isXHTTP() { + return this.network === "xhttp"; } // Shadowsocks @@ -1226,8 +1226,8 @@ class Inbound extends XrayCommonClass { return this.stream.http.host[0]; } else if (this.isHttpupgrade) { return this.stream.httpupgrade.host?.length > 0 ? this.stream.httpupgrade.host : this.getHeader(this.stream.httpupgrade, 'host'); - } else if (this.isSplithttp) { - return this.stream.splithttp.host?.length > 0 ? this.stream.splithttp.host : this.getHeader(this.stream.splithttp, 'host'); + } else if (this.isXHTTP) { + return this.stream.xhttp.host?.length > 0 ? this.stream.xhttp.host : this.getHeader(this.stream.xhttp, 'host'); } return null; } @@ -1241,8 +1241,8 @@ class Inbound extends XrayCommonClass { return this.stream.http.path; } else if (this.isHttpupgrade) { return this.stream.httpupgrade.path; - } else if (this.isSplithttp) { - return this.stream.splithttp.path; + } else if (this.isXHTTP) { + return this.stream.xhttp.path; } return null; } @@ -1266,7 +1266,7 @@ class Inbound extends XrayCommonClass { canEnableTls() { if (![Protocols.VMESS, Protocols.VLESS, Protocols.TROJAN, Protocols.SHADOWSOCKS].includes(this.protocol)) return false; - return ["tcp", "ws", "http", "grpc", "httpupgrade", "splithttp"].includes(this.network); + return ["tcp", "ws", "http", "grpc", "httpupgrade", "xhttp"].includes(this.network); } //this is used for xtls-rprx-vision @@ -1279,7 +1279,7 @@ class Inbound extends XrayCommonClass { canEnableReality() { if (![Protocols.VLESS, Protocols.TROJAN].includes(this.protocol)) return false; - return ["tcp", "http", "grpc", "splithttp"].includes(this.network); + return ["tcp", "http", "grpc", "xhttp"].includes(this.network); } canEnableStream() { @@ -1345,11 +1345,11 @@ class Inbound extends XrayCommonClass { const httpupgrade = this.stream.httpupgrade; obj.path = httpupgrade.path; obj.host = httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host'); - } else if (network === 'splithttp') { - const splithttp = this.stream.splithttp; - obj.path = splithttp.path; - obj.host = splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host'); - obj.mode = splithttp.mode; + } else if (network === 'xhttp') { + const xhttp = this.stream.xhttp; + obj.path = xhttp.path; + obj.host = xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host'); + obj.mode = xhttp.mode; } if (security === 'tls') { @@ -1418,11 +1418,11 @@ class Inbound extends XrayCommonClass { params.set("path", httpupgrade.path); params.set("host", httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host')); break; - case "splithttp": - const splithttp = this.stream.splithttp; - params.set("path", splithttp.path); - params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host')); - params.set("mode", splithttp.mode); + case "xhttp": + const xhttp = this.stream.xhttp; + params.set("path", xhttp.path); + params.set("host", xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host')); + params.set("mode", xhttp.mode); break; } @@ -1522,11 +1522,11 @@ class Inbound extends XrayCommonClass { params.set("path", httpupgrade.path); params.set("host", httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host')); break; - case "splithttp": - const splithttp = this.stream.splithttp; - params.set("path", splithttp.path); - params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host')); - params.set("mode", splithttp.mode); + case "xhttp": + const xhttp = this.stream.xhttp; + params.set("path", xhttp.path); + params.set("host", xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host')); + params.set("mode", xhttp.mode); break; } @@ -1605,11 +1605,11 @@ class Inbound extends XrayCommonClass { params.set("path", httpupgrade.path); params.set("host", httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host')); break; - case "splithttp": - const splithttp = this.stream.splithttp; - params.set("path", splithttp.path); - params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host')); - params.set("mode", splithttp.mode); + case "xhttp": + const xhttp = this.stream.xhttp; + params.set("path", xhttp.path); + params.set("host", xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host')); + params.set("mode", xhttp.mode); break; } diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index c9400efc..5a7722e3 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -335,7 +335,7 @@ class HttpUpgradeStreamSettings extends CommonClass { } } -class SplitHTTPStreamSettings extends CommonClass { +class xHTTPStreamSettings extends CommonClass { constructor( path = '/', host = '', @@ -348,7 +348,7 @@ class SplitHTTPStreamSettings extends CommonClass { } static fromJson(json = {}) { - return new SplitHTTPStreamSettings( + return new xHTTPStreamSettings( json.path, json.host, json.mode, @@ -482,7 +482,7 @@ class StreamSettings extends CommonClass { quicSettings = new QuicStreamSettings(), grpcSettings = new GrpcStreamSettings(), httpupgradeSettings = new HttpUpgradeStreamSettings(), - splithttpSettings = new SplitHTTPStreamSettings(), + xhttpSettings = new xHTTPStreamSettings(), sockopt = undefined, ) { super(); @@ -496,7 +496,7 @@ class StreamSettings extends CommonClass { this.http = httpSettings; this.grpc = grpcSettings; this.httpupgrade = httpupgradeSettings; - this.splithttp = splithttpSettings; + this.xhttp = xhttpSettings; this.sockopt = sockopt; } @@ -529,7 +529,7 @@ class StreamSettings extends CommonClass { QuicStreamSettings.fromJson(json.quicSettings), GrpcStreamSettings.fromJson(json.grpcSettings), HttpUpgradeStreamSettings.fromJson(json.httpupgradeSettings), - SplitHTTPStreamSettings.fromJson(json.splithttpSettings), + xHTTPStreamSettings.fromJson(json.xhttpSettings), SockoptStreamSettings.fromJson(json.sockopt), ); } @@ -547,7 +547,7 @@ class StreamSettings extends CommonClass { httpSettings: network === 'http' ? this.http.toJson() : undefined, grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined, httpupgradeSettings: network === 'httpupgrade' ? this.httpupgrade.toJson() : undefined, - splithttpSettings: network === 'splithttp' ? this.splithttp.toJson() : undefined, + xhttpSettings: network === 'xhttp' ? this.xhttp.toJson() : undefined, sockopt: this.sockopt != undefined ? this.sockopt.toJson() : undefined, }; } @@ -612,7 +612,7 @@ class Outbound extends CommonClass { canEnableTls() { if (![Protocols.VMess, Protocols.VLESS, Protocols.Trojan, Protocols.Shadowsocks].includes(this.protocol)) return false; - return ["tcp", "ws", "http", "grpc", "httpupgrade", "splithttp"].includes(this.stream.network); + return ["tcp", "ws", "http", "grpc", "httpupgrade", "xhttp"].includes(this.stream.network); } //this is used for xtls-rprx-vision @@ -625,7 +625,7 @@ class Outbound extends CommonClass { canEnableReality() { if (![Protocols.VLESS, Protocols.Trojan].includes(this.protocol)) return false; - return ["tcp", "http", "grpc", "splithttp"].includes(this.stream.network); + return ["tcp", "http", "grpc", "xhttp"].includes(this.stream.network); } canEnableStream() { @@ -732,8 +732,8 @@ class Outbound extends CommonClass { stream.grpc = new GrpcStreamSettings(json.path, json.authority, json.type == 'multi'); } else if (network === 'httpupgrade') { stream.httpupgrade = new HttpUpgradeStreamSettings(json.path, json.host); - } else if (network === 'splithttp') { - stream.splithttp = new SplitHTTPStreamSettings(json.path, json.host, json.mode); + } else if (network === 'xhttp') { + stream.xhttp = new xHTTPStreamSettings(json.path, json.host, json.mode); } if (json.tls && json.tls == 'tls') { @@ -776,8 +776,8 @@ class Outbound extends CommonClass { url.searchParams.get('mode') == 'multi'); } else if (type === 'httpupgrade') { stream.httpupgrade = new HttpUpgradeStreamSettings(path, host); - } else if (type === 'splithttp') { - stream.splithttp = new SplitHTTPStreamSettings(path, host, mode); + } else if (type === 'xhttp') { + stream.xhttp = new xHTTPStreamSettings(path, host, mode); } if (security == 'tls') { diff --git a/web/html/xui/form/outbound.html b/web/html/xui/form/outbound.html index a337ab28..e6d12ee4 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -273,7 +273,7 @@ HTTP gRPC HTTPUpgrade - SplitHTTP (XHTTP) + XHTTP - -