diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-08-26 15:09:18 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-08-26 15:09:18 +0300 |
| commit | fe22cbd0e5a87da4c99a2bd075d6858f74da98cc (patch) | |
| tree | 4046a61ab160fed2269850a0463496d02a2e899b /web/assets/js | |
| parent | 1277285d0835fdf2f2184f067140e2390fa083bb (diff) | |
Transparent Proxy with sockopt Stream Setting
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/assets/js')
| -rw-r--r-- | web/assets/js/model/xray.js | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index fff71e8b..8ab2969d 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -803,22 +803,27 @@ RealityStreamSettings.Settings = class extends XrayCommonClass { }; class SockoptStreamSettings extends XrayCommonClass { - constructor( - acceptProxyProtocol = false, - ) { + constructor(acceptProxyProtocol = false, tcpFastOpen = false, mark = 0, tproxy="off") { super(); this.acceptProxyProtocol = acceptProxyProtocol; + this.tcpFastOpen = tcpFastOpen; + this.mark = mark; + this.tproxy = tproxy; } - static fromJson(json = {}) { return new SockoptStreamSettings( json.acceptProxyProtocol, + json.tcpFastOpen, + json.mark, + json.tproxy, ); } - toJson() { return { acceptProxyProtocol: this.acceptProxyProtocol, + tcpFastOpen: this.tcpFastOpen, + mark: this.mark, + tproxy: this.tproxy, }; } } @@ -835,7 +840,7 @@ class StreamSettings extends XrayCommonClass { httpSettings=new HttpStreamSettings(), quicSettings=new QuicStreamSettings(), grpcSettings=new GrpcStreamSettings(), - sockopt = new SockoptStreamSettings(), + sockopt = undefined, ) { super(); this.network = network; @@ -889,14 +894,12 @@ class StreamSettings extends XrayCommonClass { } } - get isSockopt() { - return ['http', 'grpc'].indexOf(this.network) !== -1; + get sockoptSwitch() { + return this.sockopt != undefined; } - set isSockopt(isSockopt) { - if (isSockopt) { - return ['http', 'grpc'].indexOf(this.network) !== -1; - } + set sockoptSwitch(value) { + this.sockopt = value ? new SockoptStreamSettings() : undefined; } static fromJson(json={}) { @@ -931,7 +934,7 @@ class StreamSettings extends XrayCommonClass { httpSettings: network === 'http' ? this.http.toJson() : undefined, quicSettings: network === 'quic' ? this.quic.toJson() : undefined, grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined, - sockopt: this.isSockopt ? this.sockopt.toJson() : undefined, + sockopt: this.sockopt != undefined ? this.sockopt.toJson() : undefined, }; } } |
