From 8043f9fec5044cac006c1d39f0c4f3588cd8847e Mon Sep 17 00:00:00 2001 From: qist <87984115@qq.com> Date: Mon, 16 Dec 2024 10:18:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20=20http=20=20=E8=B0=A8?= =?UTF-8?q?=E6=85=8E=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/version | 2 +- go.mod | 2 +- go.sum | 4 +- web/assets/js/model/xray.js | 68 ++----------------- web/html/xui/form/stream/stream_http.html | 12 ---- web/html/xui/form/stream/stream_settings.html | 6 -- web/html/xui/form/stream/stream_xhttp.html | 3 + 7 files changed, 13 insertions(+), 84 deletions(-) delete mode 100644 web/html/xui/form/stream/stream_http.html diff --git a/config/version b/config/version index 7bddcbb9..c15fb63b 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -24.12.10 \ No newline at end of file +24.12.16 \ No newline at end of file diff --git a/go.mod b/go.mod index cec5396e..bebfe03b 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 github.com/robfig/cron/v3 v3.0.1 github.com/shirou/gopsutil/v3 v3.24.5 - github.com/xtls/xray-core v1.8.25-0.20241207144338-9cb6816383dd + github.com/xtls/xray-core v1.8.25-0.20241215123619-7d0a80b501d4 go.uber.org/atomic v1.11.0 golang.org/x/crypto v0.31.0 golang.org/x/text v0.21.0 diff --git a/go.sum b/go.sum index 030bf0a0..1e56dcbd 100644 --- a/go.sum +++ b/go.sum @@ -170,8 +170,8 @@ github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1Y github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d h1:+B97uD9uHLgAAulhigmys4BVwZZypzK7gPN3WtpgRJg= github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d/go.mod h1:dm4y/1QwzjGaK17ofi0Vs6NpKAHegZky8qk6J2JJZAE= -github.com/xtls/xray-core v1.8.25-0.20241207144338-9cb6816383dd h1:jcGpaTPQUgFqCeG2Ek5Yj1fwVsoI4LcIDJNXuC2qMaA= -github.com/xtls/xray-core v1.8.25-0.20241207144338-9cb6816383dd/go.mod h1:jTHrem03qe2KEk7RttKZbHk0VdJDf0CWQ9B+/2FXNI0= +github.com/xtls/xray-core v1.8.25-0.20241215123619-7d0a80b501d4 h1:zdd86FEjFZjAaRbWxiZQM2QPOzk/d6cig2DaE7c3MDQ= +github.com/xtls/xray-core v1.8.25-0.20241215123619-7d0a80b501d4/go.mod h1:lduNPDkXku+Avphl8g7W0yJrHhWyxdOnPo0XGYdF0Aw= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index a3ea2bf4..86f22ab1 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -415,39 +415,6 @@ class WsStreamSettings extends XrayCommonClass { } } -class HttpStreamSettings extends XrayCommonClass { - constructor(path = '/', host = ['']) { - super(); - this.path = path; - this.host = host.length === 0 ? [''] : host; - } - - addHost(host) { - this.host.push(host); - } - - removeHost(index) { - this.host.splice(index, 1); - } - - static fromJson(json = {}) { - return new HttpStreamSettings(json.path, json.host); - } - - toJson() { - let host = []; - for (let i = 0; i < this.host.length; ++i) { - if (!ObjectUtil.isEmpty(this.host[i])) { - host.push(this.host[i]); - } - } - return { - path: this.path, - host: host, - } - } -} - class GrpcStreamSettings extends XrayCommonClass { constructor( serviceName = "", @@ -540,6 +507,7 @@ class xHTTPStreamSettings extends XrayCommonClass { }, mode = MODE_OPTION.AUTO, noGRPCHeader = false, + keepAlivePeriod = 45, ) { super(); this.path = path; @@ -553,6 +521,7 @@ class xHTTPStreamSettings extends XrayCommonClass { this.xmux = xmux; this.mode = mode; this.noGRPCHeader = noGRPCHeader; + this.keepAlivePeriod = keepAlivePeriod; } addHeader(name, value) { @@ -582,7 +551,8 @@ class xHTTPStreamSettings extends XrayCommonClass { json.xPaddingBytes, json.xmux, json.mode, - json.noGRPCHeader, + json.noGRPCHeader, + json.keepAlivePeriod, ); } @@ -608,6 +578,7 @@ class xHTTPStreamSettings extends XrayCommonClass { xmux: xmuxData, mode: this.mode, noGRPCHeader: this.noGRPCHeader, + keepAlivePeriod: this.keepAlivePeriod, }; } } @@ -906,7 +877,6 @@ class StreamSettings extends XrayCommonClass { rawSettings = new TcpStreamSettings(), kcpSettings = new KcpStreamSettings(), wsSettings = new WsStreamSettings(), - httpSettings = new HttpStreamSettings(), grpcSettings = new GrpcStreamSettings(), httpupgradeSettings = new HttpUpgradeStreamSettings(), xhttpSettings = new xHTTPStreamSettings(), @@ -921,7 +891,6 @@ class StreamSettings extends XrayCommonClass { this.raw = rawSettings; this.kcp = kcpSettings; this.ws = wsSettings; - this.http = httpSettings; this.grpc = grpcSettings; this.httpupgrade = httpupgradeSettings; this.xhttp = xhttpSettings; @@ -970,7 +939,6 @@ class StreamSettings extends XrayCommonClass { TcpStreamSettings.fromJson(json.rawSettings), KcpStreamSettings.fromJson(json.kcpSettings), WsStreamSettings.fromJson(json.wsSettings), - HttpStreamSettings.fromJson(json.httpSettings), GrpcStreamSettings.fromJson(json.grpcSettings), HttpUpgradeStreamSettings.fromJson(json.httpupgradeSettings), xHTTPStreamSettings.fromJson(json.xhttpSettings), @@ -989,7 +957,6 @@ class StreamSettings extends XrayCommonClass { rawSettings: network === 'raw' ? this.raw.toJson() : undefined, kcpSettings: network === 'kcp' ? this.kcp.toJson() : undefined, wsSettings: network === 'ws' ? this.ws.toJson() : undefined, - httpSettings: network === 'http' ? this.http.toJson() : undefined, grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined, httpupgradeSettings: network === 'httpupgrade' ? this.httpupgrade.toJson() : undefined, xhttpSettings: network === 'xhttp' ? this.xhttp.toJson() : undefined, @@ -1104,9 +1071,6 @@ class Inbound extends XrayCommonClass { return this.network === "grpc"; } - get isH2() { - return this.network === "http"; - } get isHttpupgrade() { return this.network === "httpupgrade"; } @@ -1241,7 +1205,6 @@ class Inbound extends XrayCommonClass { case "tcp": case "raw": case "ws": - case "http": case "grpc": case "httpupgrade": case "xhttp": @@ -1263,7 +1226,7 @@ class Inbound extends XrayCommonClass { default: return false; } - return ['tcp', 'raw', 'http', 'grpc', 'httpupgrade', 'xhttp'].indexOf(this.network) !== -1; + return ['tcp', 'raw', 'grpc', 'httpupgrade', 'xhttp'].indexOf(this.network) !== -1; //return this.network === "tcp"; } @@ -1359,10 +1322,6 @@ class Inbound extends XrayCommonClass { if (index >= 0) { host = ws.headers[index].value; } - } else if (network === 'http') { - network = 'h2'; - path = this.stream.http.path; - host = this.stream.http.host.join(','); } else if (network === 'grpc') { path = this.stream.grpc.serviceName; authority = this.stream.grpc.authority; @@ -1467,11 +1426,6 @@ class Inbound extends XrayCommonClass { params.set("host", host); } break; - case "http": - const http = this.stream.http; - params.set("path", http.path); - params.set("host", http.host); - break; case "grpc": const grpc = this.stream.grpc; params.set("serviceName", grpc.serviceName); @@ -1605,11 +1559,6 @@ class Inbound extends XrayCommonClass { params.set("host", host); } break; - case "http": - const http = this.stream.http; - params.set("path", http.path); - params.set("host", http.host); - break; case "grpc": const grpc = this.stream.grpc; params.set("serviceName", grpc.serviceName); @@ -1728,11 +1677,6 @@ class Inbound extends XrayCommonClass { params.set("host", host); } break; - case "http": - const http = this.stream.http; - params.set("path", http.path); - params.set("host", http.host); - break; case "grpc": const grpc = this.stream.grpc; params.set("serviceName", grpc.serviceName); diff --git a/web/html/xui/form/stream/stream_http.html b/web/html/xui/form/stream/stream_http.html deleted file mode 100644 index d2a4bf95..00000000 --- a/web/html/xui/form/stream/stream_http.html +++ /dev/null @@ -1,12 +0,0 @@ -{{define "form/streamHTTP"}} - - - - - - - - - - -{{end}} \ No newline at end of file diff --git a/web/html/xui/form/stream/stream_settings.html b/web/html/xui/form/stream/stream_settings.html index ef02a393..bd0020f3 100644 --- a/web/html/xui/form/stream/stream_settings.html +++ b/web/html/xui/form/stream/stream_settings.html @@ -7,7 +7,6 @@ raw kcp ws - http grpc HTTPUpgrade xHTTP @@ -35,11 +34,6 @@ {{template "form/streamWS"}} - - -