diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-06-18 13:49:20 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-06-18 13:49:20 +0300 |
| commit | 7f2c11220f2d27ac1ad3fdc343b06dd77edd28f1 (patch) | |
| tree | e7e6b555f6edea2b4848f05e7aa936cb21735b24 /web/assets/js/model/outbound.js | |
| parent | 52b02fdef9a499efe99b2d32c78a7936fe34d4d6 (diff) | |
new - splithttp transport
splithttp inbound
splithttp outbound
change priority host for ws - httpupgrade (host>>headers)
Diffstat (limited to 'web/assets/js/model/outbound.js')
| -rw-r--r-- | web/assets/js/model/outbound.js | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index 2f2a5ea2..ee954fc1 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -194,7 +194,7 @@ class WsStreamSettings extends CommonClass { static fromJson(json={}) { return new WsStreamSettings( json.path, - json.host + json.host, ); } @@ -202,7 +202,6 @@ class WsStreamSettings extends CommonClass { return { path: this.path, host: this.host, - headers: ObjectUtil.isEmpty(this.host) ? undefined : {Host: this.host}, }; } } @@ -288,7 +287,29 @@ class HttpUpgradeStreamSettings extends CommonClass { static fromJson(json={}) { return new HttpUpgradeStreamSettings( json.path, - json.host + json.host, + ); + } + + toJson() { + return { + path: this.path, + host: this.host, + }; + } +} + +class SplitHTTPStreamSettings extends CommonClass { + constructor(path='/', host='') { + super(); + this.path = path; + this.host = host; + } + + static fromJson(json={}) { + return new SplitHTTPStreamSettings( + json.path, + json.host, ); } @@ -296,7 +317,6 @@ class HttpUpgradeStreamSettings extends CommonClass { return { path: this.path, host: this.host, - headers: ObjectUtil.isEmpty(this.host) ? undefined : {Host: this.host}, }; } } @@ -404,6 +424,7 @@ class StreamSettings extends CommonClass { quicSettings=new QuicStreamSettings(), grpcSettings=new GrpcStreamSettings(), httpupgradeSettings=new HttpUpgradeStreamSettings(), + splithttpSettings=new SplitHTTPStreamSettings(), sockopt = undefined, ) { super(); @@ -418,6 +439,7 @@ class StreamSettings extends CommonClass { this.quic = quicSettings; this.grpc = grpcSettings; this.httpupgrade = httpupgradeSettings; + this.splithttp = splithttpSettings; this.sockopt = sockopt; } @@ -450,6 +472,7 @@ class StreamSettings extends CommonClass { QuicStreamSettings.fromJson(json.quicSettings), GrpcStreamSettings.fromJson(json.grpcSettings), HttpUpgradeStreamSettings.fromJson(json.httpupgradeSettings), + SplitHTTPStreamSettings.fromJson(json.splithttpSettings), SockoptStreamSettings.fromJson(json.sockopt), ); } @@ -468,6 +491,7 @@ class StreamSettings extends CommonClass { quicSettings: network === 'quic' ? this.quic.toJson() : undefined, grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined, httpupgradeSettings: network === 'httpupgrade' ? this.httpupgrade.toJson() : undefined, + splithttpSettings: network === 'splithttp' ? this.splithttp.toJson() : undefined, sockopt: this.sockopt != undefined ? this.sockopt.toJson() : undefined, }; } @@ -532,7 +556,7 @@ class Outbound extends CommonClass { canEnableTls() { if (![Protocols.VMess, Protocols.VLESS, Protocols.Trojan, Protocols.Shadowsocks].includes(this.protocol)) return false; - return ["tcp", "ws", "http", "quic", "grpc", "httpupgrade"].includes(this.stream.network); + return ["tcp", "ws", "http", "quic", "grpc", "httpupgrade" , "splithttp"].includes(this.stream.network); } //this is used for xtls-rprx-vision @@ -653,6 +677,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); } if(json.tls && json.tls == 'tls'){ @@ -700,6 +726,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); } if(security == 'tls'){ |
