diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2026-04-27 03:29:13 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2026-04-27 04:06:41 +0300 |
| commit | 6d05702d005aeab043d71f9dc0fe51f50d10ccf7 (patch) | |
| tree | f032da32a17c5ed3b024271f0ea1dfb67c38fc81 /web | |
| parent | 9791b05a4efd2e22621927b9e80d288386e510df (diff) | |
TCP Masks
Diffstat (limited to 'web')
| -rw-r--r-- | web/assets/js/model/inbound.js | 206 | ||||
| -rw-r--r-- | web/assets/js/model/outbound.js | 165 | ||||
| -rw-r--r-- | web/html/form/outbound.html | 371 | ||||
| -rw-r--r-- | web/html/form/stream/stream_finalmask.html | 388 |
4 files changed, 936 insertions, 194 deletions
diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index b5971a68..e002ac91 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -1094,14 +1094,6 @@ class UdpMask extends XrayCommonClass { reset: settings.reset ?? 0, noise: Array.isArray(settings.noise) ? settings.noise : [], }; - case 'sudoku': - return { - ascii: settings.ascii || '', - customTable: settings.customTable || '', - customTables: settings.customTables ?? [], - paddingMin: settings.paddingMin ?? 0, - paddingMax: settings.paddingMax ?? 0, - }; default: return settings; } @@ -1120,7 +1112,8 @@ class UdpMask extends XrayCommonClass { if (out.type === 'array') { delete out.packet; } else { - out.rand = 0; + delete out.rand; + delete out.randRange; } return out; }; @@ -1143,23 +1136,193 @@ class UdpMask extends XrayCommonClass { } } -class FinalMaskStreamSettings extends XrayCommonClass { - constructor(udp = []) { +class TcpMask extends XrayCommonClass { + constructor(type = 'fragment', settings = {}) { super(); - this.udp = Array.isArray(udp) ? udp.map(u => new UdpMask(u.type, u.settings)) : [new UdpMask(udp.type, udp.settings)]; + this.type = type; + this.settings = this._getDefaultSettings(type, settings); + } + + _getDefaultSettings(type, settings = {}) { + switch (type) { + case 'fragment': + return { + packets: settings.packets ?? 'tlshello', + length: settings.length ?? '', + delay: settings.delay ?? '', + maxSplit: settings.maxSplit ?? '', + }; + case 'sudoku': + return { + password: settings.password ?? '', + ascii: settings.ascii ?? '', + customTable: settings.customTable ?? '', + customTables: Array.isArray(settings.customTables) ? settings.customTables : [], + paddingMin: settings.paddingMin ?? 0, + paddingMax: settings.paddingMax ?? 0, + }; + case 'header-custom': + return { + clients: Array.isArray(settings.clients) ? settings.clients : [], + servers: Array.isArray(settings.servers) ? settings.servers : [], + }; + default: + return settings; + } } static fromJson(json = {}) { - return new FinalMaskStreamSettings(json.udp || []); + return new TcpMask( + json.type || 'fragment', + json.settings || {} + ); } toJson() { + const cleanItem = item => { + const out = { ...item }; + if (out.type === 'array') { + delete out.packet; + } else { + delete out.rand; + delete out.randRange; + } + return out; + }; + + let settings = this.settings; + if (this.type === 'header-custom' && settings) { + const cleanGroup = group => Array.isArray(group) ? group.map(cleanItem) : group; + settings = { + ...settings, + clients: Array.isArray(settings.clients) ? settings.clients.map(cleanGroup) : settings.clients, + servers: Array.isArray(settings.servers) ? settings.servers.map(cleanGroup) : settings.servers, + }; + } + return { - udp: this.udp.map(udp => udp.toJson()) + type: this.type, + settings: (settings && Object.keys(settings).length > 0) ? settings : undefined }; } } +class QuicParams extends XrayCommonClass { + constructor( + congestion = 'bbr', + debug = false, + brutalUp = '', + brutalDown = '', + udpHop = undefined, + initStreamReceiveWindow = 8388608, + maxStreamReceiveWindow = 8388608, + initConnectionReceiveWindow = 20971520, + maxConnectionReceiveWindow = 20971520, + maxIdleTimeout = 30, + keepAlivePeriod = 0, + disablePathMTUDiscovery = false, + maxIncomingStreams = 1024, + ) { + super(); + this.congestion = congestion; + this.debug = debug; + this.brutalUp = brutalUp; + this.brutalDown = brutalDown; + this.udpHop = udpHop; + this.initStreamReceiveWindow = initStreamReceiveWindow; + this.maxStreamReceiveWindow = maxStreamReceiveWindow; + this.initConnectionReceiveWindow = initConnectionReceiveWindow; + this.maxConnectionReceiveWindow = maxConnectionReceiveWindow; + this.maxIdleTimeout = maxIdleTimeout; + this.keepAlivePeriod = keepAlivePeriod; + this.disablePathMTUDiscovery = disablePathMTUDiscovery; + this.maxIncomingStreams = maxIncomingStreams; + } + + get hasUdpHop() { + return this.udpHop != null; + } + + set hasUdpHop(value) { + this.udpHop = value ? (this.udpHop || { ports: '20000-50000', interval: '5-10' }) : undefined; + } + + static fromJson(json = {}) { + if (!json || Object.keys(json).length === 0) return undefined; + return new QuicParams( + json.congestion, + json.debug, + json.brutalUp, + json.brutalDown, + json.udpHop ? { ports: json.udpHop.ports, interval: json.udpHop.interval } : undefined, + json.initStreamReceiveWindow, + json.maxStreamReceiveWindow, + json.initConnectionReceiveWindow, + json.maxConnectionReceiveWindow, + json.maxIdleTimeout, + json.keepAlivePeriod, + json.disablePathMTUDiscovery, + json.maxIncomingStreams, + ); + } + + toJson() { + const result = { congestion: this.congestion }; + if (this.debug) result.debug = this.debug; + if (this.brutalUp) result.brutalUp = this.brutalUp; + if (this.brutalDown) result.brutalDown = this.brutalDown; + if (this.udpHop) result.udpHop = { ports: this.udpHop.ports, interval: this.udpHop.interval }; + if (this.initStreamReceiveWindow > 0) result.initStreamReceiveWindow = this.initStreamReceiveWindow; + if (this.maxStreamReceiveWindow > 0) result.maxStreamReceiveWindow = this.maxStreamReceiveWindow; + if (this.initConnectionReceiveWindow > 0) result.initConnectionReceiveWindow = this.initConnectionReceiveWindow; + if (this.maxConnectionReceiveWindow > 0) result.maxConnectionReceiveWindow = this.maxConnectionReceiveWindow; + if (this.maxIdleTimeout !== 30 && this.maxIdleTimeout > 0) result.maxIdleTimeout = this.maxIdleTimeout; + if (this.keepAlivePeriod > 0) result.keepAlivePeriod = this.keepAlivePeriod; + if (this.disablePathMTUDiscovery) result.disablePathMTUDiscovery = this.disablePathMTUDiscovery; + if (this.maxIncomingStreams > 0) result.maxIncomingStreams = this.maxIncomingStreams; + return result; + } +} + +class FinalMaskStreamSettings extends XrayCommonClass { + constructor(tcp = [], udp = [], quicParams = undefined) { + super(); + this.tcp = Array.isArray(tcp) ? tcp.map(t => t instanceof TcpMask ? t : new TcpMask(t.type, t.settings)) : []; + this.udp = Array.isArray(udp) ? udp.map(u => new UdpMask(u.type, u.settings)) : [new UdpMask(udp.type, udp.settings)]; + this.quicParams = quicParams instanceof QuicParams ? quicParams : (quicParams ? QuicParams.fromJson(quicParams) : undefined); + } + + get enableQuicParams() { + return this.quicParams != null; + } + + set enableQuicParams(value) { + this.quicParams = value ? (this.quicParams || new QuicParams()) : undefined; + } + + static fromJson(json = {}) { + return new FinalMaskStreamSettings( + json.tcp || [], + json.udp || [], + json.quicParams ? QuicParams.fromJson(json.quicParams) : undefined, + ); + } + + toJson() { + const result = {}; + if (this.tcp && this.tcp.length > 0) { + result.tcp = this.tcp.map(t => t.toJson()); + } + if (this.udp && this.udp.length > 0) { + result.udp = this.udp.map(udp => udp.toJson()); + } + if (this.quicParams) { + result.quicParams = this.quicParams.toJson(); + } + return result; + } +} + class StreamSettings extends XrayCommonClass { constructor(network = 'tcp', security = 'none', @@ -1193,6 +1356,16 @@ class StreamSettings extends XrayCommonClass { this.sockopt = sockopt; } + addTcpMask(type = 'fragment') { + this.finalmask.tcp.push(new TcpMask(type)); + } + + delTcpMask(index) { + if (this.finalmask.tcp) { + this.finalmask.tcp.splice(index, 1); + } + } + addUdpMask(type = 'salamander') { this.finalmask.udp.push(new UdpMask(type)); } @@ -1204,7 +1377,10 @@ class StreamSettings extends XrayCommonClass { } get hasFinalMask() { - return this.finalmask.udp && this.finalmask.udp.length > 0; + const hasTcp = this.finalmask.tcp && this.finalmask.tcp.length > 0; + const hasUdp = this.finalmask.udp && this.finalmask.udp.length > 0; + const hasQuicParams = this.finalmask.quicParams != null; + return hasTcp || hasUdp || hasQuicParams; } get isTls() { diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index aa90d20d..6be2ec1b 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -690,7 +690,8 @@ class UdpMask extends CommonClass { if (out.type === 'array') { delete out.packet; } else { - out.rand = 0; + delete out.rand; + delete out.randRange; } return out; }; @@ -713,21 +714,158 @@ class UdpMask extends CommonClass { } } -class FinalMaskStreamSettings extends CommonClass { - constructor(udp = []) { +class TcpMask extends CommonClass { + constructor(type = 'fragment', settings = {}) { super(); - this.udp = Array.isArray(udp) ? udp.map(u => new UdpMask(u.type, u.settings)) : [new UdpMask(udp.type, udp.settings)]; + this.type = type; + this.settings = this._getDefaultSettings(type, settings); + } + + _getDefaultSettings(type, settings = {}) { + switch (type) { + case 'fragment': + return { + packets: settings.packets ?? 'tlshello', + length: settings.length ?? '', + delay: settings.delay ?? '', + maxSplit: settings.maxSplit ?? '', + }; + case 'sudoku': + return { + password: settings.password ?? '', + ascii: settings.ascii ?? '', + customTable: settings.customTable ?? '', + customTables: Array.isArray(settings.customTables) ? settings.customTables : [], + paddingMin: settings.paddingMin ?? 0, + paddingMax: settings.paddingMax ?? 0, + }; + case 'header-custom': + return { + clients: Array.isArray(settings.clients) ? settings.clients : [], + servers: Array.isArray(settings.servers) ? settings.servers : [], + }; + default: + return settings; + } } static fromJson(json = {}) { - return new FinalMaskStreamSettings(json.udp || []); + return new TcpMask( + json.type || 'fragment', + json.settings || {} + ); } toJson() { + const cleanItem = item => { + const out = { ...item }; + if (out.type === 'array') { + delete out.packet; + } else { + delete out.rand; + delete out.randRange; + } + return out; + }; + + let settings = this.settings; + if (this.type === 'header-custom' && settings) { + const cleanGroup = group => Array.isArray(group) ? group.map(cleanItem) : group; + settings = { + ...settings, + clients: Array.isArray(settings.clients) ? settings.clients.map(cleanGroup) : settings.clients, + servers: Array.isArray(settings.servers) ? settings.servers.map(cleanGroup) : settings.servers, + }; + } + return { - udp: this.udp.map(udp => udp.toJson()) + type: this.type, + settings: (settings && Object.keys(settings).length > 0) ? settings : undefined }; + } +} +class QuicParams extends CommonClass { + constructor( + congestion = 'bbr', + debug = false, + brutalUp = '', + brutalDown = '', + udpHop = undefined, + ) { + super(); + this.congestion = congestion; + this.debug = debug; + this.brutalUp = brutalUp; + this.brutalDown = brutalDown; + this.udpHop = udpHop; + } + + get hasUdpHop() { + return this.udpHop != null; + } + + set hasUdpHop(value) { + this.udpHop = value ? (this.udpHop || { ports: '20000-50000', interval: '5-10' }) : undefined; + } + + static fromJson(json = {}) { + if (!json || Object.keys(json).length === 0) return undefined; + return new QuicParams( + json.congestion, + json.debug, + json.brutalUp, + json.brutalDown, + json.udpHop ? { ports: json.udpHop.ports, interval: json.udpHop.interval } : undefined, + ); + } + + toJson() { + const result = { congestion: this.congestion }; + if (this.debug) result.debug = this.debug; + if (this.brutalUp) result.brutalUp = this.brutalUp; + if (this.brutalDown) result.brutalDown = this.brutalDown; + if (this.udpHop) result.udpHop = { ports: this.udpHop.ports, interval: this.udpHop.interval }; + return result; + } +} + +class FinalMaskStreamSettings extends CommonClass { + constructor(tcp = [], udp = [], quicParams = undefined) { + super(); + this.tcp = Array.isArray(tcp) ? tcp.map(t => t instanceof TcpMask ? t : new TcpMask(t.type, t.settings)) : []; + this.udp = Array.isArray(udp) ? udp.map(u => new UdpMask(u.type, u.settings)) : [new UdpMask(udp.type, udp.settings)]; + this.quicParams = quicParams instanceof QuicParams ? quicParams : (quicParams ? QuicParams.fromJson(quicParams) : undefined); + } + + get enableQuicParams() { + return this.quicParams != null; + } + + set enableQuicParams(value) { + this.quicParams = value ? (this.quicParams || new QuicParams()) : undefined; + } + + static fromJson(json = {}) { + return new FinalMaskStreamSettings( + json.tcp || [], + json.udp || [], + json.quicParams ? QuicParams.fromJson(json.quicParams) : undefined, + ); + } + + toJson() { + const result = {}; + if (this.tcp && this.tcp.length > 0) { + result.tcp = this.tcp.map(t => t.toJson()); + } + if (this.udp && this.udp.length > 0) { + result.udp = this.udp.map(udp => udp.toJson()); + } + if (this.quicParams) { + result.quicParams = this.quicParams.toJson(); + } + return result; } } @@ -763,6 +901,16 @@ class StreamSettings extends CommonClass { this.sockopt = sockopt; } + addTcpMask(type = 'fragment') { + this.finalmask.tcp.push(new TcpMask(type)); + } + + delTcpMask(index) { + if (this.finalmask.tcp) { + this.finalmask.tcp.splice(index, 1); + } + } + addUdpMask(type = 'salamander') { this.finalmask.udp.push(new UdpMask(type)); } @@ -774,7 +922,10 @@ class StreamSettings extends CommonClass { } get hasFinalMask() { - return this.finalmask.udp && this.finalmask.udp.length > 0; + const hasTcp = this.finalmask.tcp && this.finalmask.tcp.length > 0; + const hasUdp = this.finalmask.udp && this.finalmask.udp.length > 0; + const hasQuicParams = this.finalmask.quicParams != null; + return hasTcp || hasUdp || hasQuicParams; } get isTls() { diff --git a/web/html/form/outbound.html b/web/html/form/outbound.html index 81b488c7..4f584d5e 100644 --- a/web/html/form/outbound.html +++ b/web/html/form/outbound.html @@ -842,7 +842,7 @@ :max="60" ></a-input-number> </a-form-item> - <a-form-item label="Disable Path MTU"> + <a-form-item label="Disable Path MTU Dis"> <a-switch v-model="outbound.stream.hysteria.disablePathMTUDiscovery" ></a-switch> @@ -852,6 +852,176 @@ <!-- finalmask settings --> <template v-if="outbound.canEnableStream()"> + <!-- TCP Masks – for raw/tcp/httpupgrade/ws/grpc/xhttp --> + <a-form-item + label="TCP Masks" + v-if="['raw', 'tcp', 'httpupgrade', 'ws', 'grpc', 'xhttp'].includes(outbound.stream.network)" + > + <a-button + icon="plus" + type="primary" + size="small" + @click="outbound.stream.addTcpMask('fragment')" + ></a-button> + </a-form-item> + <template v-if="outbound.stream.finalmask.tcp && outbound.stream.finalmask.tcp.length > 0"> + <a-form + v-for="(mask, index) in outbound.stream.finalmask.tcp" + :key="index" + :colon="false" + :label-col="{ md: {span:8} }" + :wrapper-col="{ md: {span:14} }" + > + <a-divider :style="{ margin: '0' }"> + TCP Mask [[ index + 1 ]] + <a-icon + type="delete" + @click="() => outbound.stream.delTcpMask(index)" + :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }" + ></a-icon> + </a-divider> + <a-form-item label="Type"> + <a-select + v-model="mask.type" + @change="(type) => { mask.settings = mask._getDefaultSettings(type, {}); }" + :dropdown-class-name="themeSwitcher.currentTheme" + > + <a-select-option value="fragment">Fragment</a-select-option> + <a-select-option value="header-custom">Header Custom</a-select-option> + <a-select-option value="sudoku">Sudoku</a-select-option> + </a-select> + </a-form-item> + + <!-- Fragment --> + <template v-if="mask.type === 'fragment'"> + <a-form-item label="Packets"> + <a-select v-model="mask.settings.packets" :dropdown-class-name="themeSwitcher.currentTheme"> + <a-select-option value="tlshello">tlshello</a-select-option> + <a-select-option value="1-3">1-3</a-select-option> + <a-select-option value="1-5">1-5</a-select-option> + </a-select> + </a-form-item> + <a-form-item label="Length"> + <a-input v-model.trim="mask.settings.length" placeholder="e.g. 100-200" /> + </a-form-item> + <a-form-item label="Delay"> + <a-input v-model.trim="mask.settings.delay" placeholder="e.g. 10-20" /> + </a-form-item> + <a-form-item label="Max Split"> + <a-input v-model.trim="mask.settings.maxSplit" placeholder="e.g. 3-6" /> + </a-form-item> + </template> + + <!-- Sudoku (TCP) --> + <template v-if="mask.type === 'sudoku'"> + <a-form-item label="Password"> + <a-input v-model.trim="mask.settings.password" placeholder="Obfuscation password" /> + </a-form-item> + <a-form-item label="ASCII"> + <a-input v-model.trim="mask.settings.ascii" placeholder="ASCII" /> + </a-form-item> + <a-form-item label="Custom Table"> + <a-input v-model.trim="mask.settings.customTable" placeholder="Custom Table" /> + </a-form-item> + <a-form-item label="Custom Tables"> + <a-input v-model.trim="mask.settings.customTables" placeholder="Custom Tables" /> + </a-form-item> + <a-form-item label="Padding Min"> + <a-input-number v-model.number="mask.settings.paddingMin" :min="0" /> + </a-form-item> + <a-form-item label="Padding Max"> + <a-input-number v-model.number="mask.settings.paddingMax" :min="0" /> + </a-form-item> + </template> + + <!-- Header Custom (TCP) – clients/servers are 2D arrays of groups --> + <template v-if="mask.type === 'header-custom'"> + <!-- Clients --> + <a-form-item label="Clients"> + <a-icon type="plus" @click="mask.settings.clients.push([{delay: 0, rand: 0, randRange: '0-255', type: 'array', packet: []}])" /> + </a-form-item> + <template v-for="(group, gi) in mask.settings.clients" :key="'cg'+gi"> + <a-divider :style="{ margin: '0' }"> + Clients Group [[ gi + 1 ]] + <a-icon type="delete" @click="mask.settings.clients.splice(gi, 1)" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }" /> + <a-icon type="plus" @click="group.push({delay: 0, rand: 0, randRange: '0-255', type: 'array', packet: []})" :style="{ marginLeft: '8px' }" /> + </a-divider> + <template v-for="(item, ii) in group" :key="'ci'+ii"> + <a-divider :style="{ margin: '0', fontSize: '12px' }"> + Item [[ ii + 1 ]] + <a-icon type="delete" @click="() => { group.splice(ii, 1); if(group.length === 0) mask.settings.clients.splice(gi, 1); }" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }" /> + </a-divider> + <a-form-item label='{{ i18n "pages.xray.outbound.type" }}'> + <a-select v-model="item.type" :dropdown-class-name="themeSwitcher.currentTheme" + @change="t => { if(t === 'array') { item.rand = 0; item.packet = []; } else { item.packet = ''; } }"> + <a-select-option value="array">Array</a-select-option> + <a-select-option value="str">String</a-select-option> + <a-select-option value="hex">Hex</a-select-option> + <a-select-option value="base64">Base64</a-select-option> + </a-select> + </a-form-item> + <a-form-item label="Delay (ms)"> + <a-input-number v-model.number="item.delay" :min="0" /> + </a-form-item> + <template v-if="item.type === 'array'"> + <a-form-item label="Rand"> + <a-input-number v-model.number="item.rand" :min="0" /> + </a-form-item> + <a-form-item label="Rand Range"> + <a-input v-model.trim="item.randRange" placeholder="0-255" /> + </a-form-item> + </template> + <a-form-item v-else label="Packet"> + <a-input v-model.trim="item.packet" placeholder="binary data" /> + </a-form-item> + </template> + </template> + + <!-- Servers --> + <a-form-item label="Servers"> + <a-icon type="plus" @click="mask.settings.servers.push([{delay: 0, rand: 0, randRange: '0-255', type: 'array', packet: []}])" /> + </a-form-item> + <template v-for="(group, gi) in mask.settings.servers" :key="'sg'+gi"> + <a-divider :style="{ margin: '0' }"> + Servers Group [[ gi + 1 ]] + <a-icon type="delete" @click="mask.settings.servers.splice(gi, 1)" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }" /> + <a-icon type="plus" @click="group.push({delay: 0, rand: 0, randRange: '0-255', type: 'array', packet: []})" :style="{ marginLeft: '8px' }" /> + </a-divider> + <template v-for="(item, ii) in group" :key="'si'+ii"> + <a-divider :style="{ margin: '0', fontSize: '12px' }"> + Item [[ ii + 1 ]] + <a-icon type="delete" @click="() => { group.splice(ii, 1); if(group.length === 0) mask.settings.servers.splice(gi, 1); }" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }" /> + </a-divider> + <a-form-item label='{{ i18n "pages.xray.outbound.type" }}'> + <a-select v-model="item.type" :dropdown-class-name="themeSwitcher.currentTheme" + @change="t => { if(t === 'array') { item.rand = 0; item.packet = []; } else { item.packet = ''; } }"> + <a-select-option value="array">Array</a-select-option> + <a-select-option value="str">String</a-select-option> + <a-select-option value="hex">Hex</a-select-option> + <a-select-option value="base64">Base64</a-select-option> + </a-select> + </a-form-item> + <a-form-item label="Delay (ms)"> + <a-input-number v-model.number="item.delay" :min="0" /> + </a-form-item> + <template v-if="item.type === 'array'"> + <a-form-item label="Rand"> + <a-input-number v-model.number="item.rand" :min="0" /> + </a-form-item> + <a-form-item label="Rand Range"> + <a-input v-model.trim="item.randRange" placeholder="0-255" /> + </a-form-item> + </template> + <a-form-item label="Packet" v-else> + <a-input v-model.trim="item.packet" placeholder="binary data" /> + </a-form-item> + </template> + </template> + </template> + + </a-form> + </template> + <a-form-item label="UDP Masks" v-if="outbound.stream.network === 'kcp' || outbound.protocol === Protocols.Hysteria" @@ -920,17 +1090,14 @@ > <a-select-option value="xdns">xDNS</a-select-option> <a-select-option value="xicmp">xICMP</a-select-option> - <a-select-option value="header-custom" - >Header Custom</a-select-option - > + <a-select-option value="header-custom">Header Custom</a-select-option> <a-select-option value="noise">Noise</a-select-option> - <a-select-option value="sudoku">Sudoku</a-select-option> </template> </a-select> </a-form-item> <a-form-item label="Password" - v-if="['salamander', 'mkcp-aes128gcm', 'sudoku'].includes(mask.type)" + v-if="['salamander', 'mkcp-aes128gcm'].includes(mask.type)" > <a-input v-model.trim="mask.settings.password" @@ -954,29 +1121,32 @@ ></a-select> </a-form-item> </template> - <template v-if="mask.type === 'header-custom'"> - <a-form-item label="Client"> + <template v-if="mask.type === 'noise'"> + <a-form-item label="Reset"> + <a-input-number v-model.number="mask.settings.reset" :min="0" /> + </a-form-item> + <a-form-item label="Noise"> <a-icon type="plus" type="primary" size="small" - @click="mask.settings.client.push({rand: 0, randRange: '0-255', type: 'array', packet: []})" + @click="mask.settings.noise.push({rand: 0, randRange: '0-255', type: 'array', packet: [], delay: ''})" /> </a-form-item> - <template v-for="(c, index) in mask.settings.client" :key="index"> + <template v-for="(n, index) in mask.settings.noise" :key="index"> <a-divider :style="{ margin: '0' }"> - Client [[ index + 1 ]] + Noise [[ index + 1 ]] <a-icon type="delete" - @click="() => mask.settings.client.splice(index, 1)" + @click="() => mask.settings.noise.splice(index, 1)" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }" ></a-icon> </a-divider> <a-form-item label="Type"> <a-select - v-model="c.type" + v-model="n.type" :dropdown-class-name="themeSwitcher.currentTheme" - @change="t => { if(t === 'array') c.packet = []; else c.packet = ''; }" + @change="t => { if(t === 'array') n.packet = []; else n.packet = ''; }" > <a-select-option value="array">Array</a-select-option> <a-select-option value="str">String</a-select-option> @@ -984,47 +1154,47 @@ <a-select-option value="base64">Base64</a-select-option> </a-select> </a-form-item> - <template v-if="c.type === 'array'"> + <template v-if="n.type === 'array'"> <a-form-item label="Rand"> - <a-input-number - v-model.number="c.rand" - :min="0" - ></a-input-number> + <a-input v-model.trim="n.rand" placeholder="0 or 1-8192" /> </a-form-item> <a-form-item label="Rand Range"> <a-input - v-model.trim="c.randRange" + v-model.trim="n.randRange" placeholder="0-255" ></a-input> </a-form-item> </template> <a-form-item label="Packet" v-else> - <a-input v-model.trim="c.packet" placeholder="binary data" /> + <a-input v-model.trim="n.packet" placeholder="binary data" /> + </a-form-item> + <a-form-item label="Delay"> + <a-input v-model.trim="n.delay" placeholder="10-20" /> </a-form-item> </template> - <a-divider :style="{ margin: '0' }"></a-divider> - <a-form-item label="Server"> + </template> + <template v-if="mask.type === 'header-custom'"> + <a-form-item label="Client"> <a-icon type="plus" - type="primary" size="small" - @click="mask.settings.server.push({rand: 0, randRange: '0-255', type: 'array', packet: []})" + @click="mask.settings.client.push({rand: 0, randRange: '0-255', type: 'array', packet: []})" /> </a-form-item> - <template v-for="(s, index) in mask.settings.server" :key="index"> + <template v-for="(c, index) in mask.settings.client" :key="index"> <a-divider :style="{ margin: '0' }"> - Server [[ index + 1 ]] + Client [[ index + 1 ]] <a-icon type="delete" - @click="() => mask.settings.server.splice(index, 1)" + @click="mask.settings.client.splice(index, 1)" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }" ></a-icon> </a-divider> <a-form-item label="Type"> <a-select - v-model="s.type" + v-model="c.type" :dropdown-class-name="themeSwitcher.currentTheme" - @change="t => { if(t === 'array') s.packet = []; else s.packet = ''; }" + @change="t => { if(t === 'array') c.packet = []; else c.packet = ''; }" > <a-select-option value="array">Array</a-select-option> <a-select-option value="str">String</a-select-option> @@ -1032,77 +1202,40 @@ <a-select-option value="base64">Base64</a-select-option> </a-select> </a-form-item> - <template v-if="s.type === 'array'"> + <template v-if="c.type === 'array'"> <a-form-item label="Rand"> - <a-input-number - v-model.number="s.rand" - :min="0" - ></a-input-number> + <a-input-number v-model.number="c.rand" :min="0"></a-input-number> </a-form-item> <a-form-item label="Rand Range"> - <a-input - v-model.trim="s.randRange" - placeholder="0-255" - ></a-input> + <a-input v-model.trim="c.randRange" placeholder="0-255"></a-input> </a-form-item> </template> <a-form-item label="Packet" v-else> - <a-input v-model.trim="s.packet" placeholder="binary data" /> + <a-input v-model.trim="c.packet" placeholder="binary data" /> </a-form-item> </template> - </template> - <template v-if="mask.type === 'sudoku'"> - <a-form-item label="ASCII"> - <a-input - v-model.trim="mask.settings.ascii" - placeholder="ASCII" - ></a-input> - </a-form-item> - <a-form-item label="Custom Table"> - <a-input - v-model.trim="mask.settings.customTable" - placeholder="Custom Table" - ></a-input> - </a-form-item> - <a-form-item label="Custom Tables"> - <a-input - v-model.trim="mask.settings.customTables" - placeholder="Custom Tables" - ></a-input> - </a-form-item> - <a-form-item label="Padding Min"> - <a-input-number - v-model.number="mask.settings.paddingMin" - :min="0" - ></a-input-number> - </a-form-item> - </template> - <template v-if="mask.type === 'noise'"> - <a-form-item label="Reset"> - <a-input-number v-model.number="mask.settings.reset" :min="0" /> - </a-form-item> - <a-form-item label="Noise"> + <a-divider :style="{ margin: '0' }"></a-divider> + <a-form-item label="Server"> <a-icon type="plus" - type="primary" size="small" - @click="mask.settings.noise.push({rand: 0, randRange: '0-255', type: 'array', packet: [], delay: ''})" + @click="mask.sett
|
