add or remove noise

This commit is contained in:
mhsanaei committed 2024-09-24 11:38:10 +02:00 Unverified
1 parent cf6a8bd463
commit 4fdef3cfde
6 files changed
+125 -68

No files matched your search

+27 -5
View File
@@ -854,7 +854,7 @@ Outbound.FreedomSettings = class extends CommonClass {
timeout = 10,
redirect = '',
fragment = {},
noises = {}
noises = []
) {
super();
this.domainStrategy = domainStrategy;
@@ -864,13 +864,21 @@ Outbound.FreedomSettings = class extends CommonClass {
this.noises = noises;
}
addNoise() {
this.noises.push(new Outbound.FreedomSettings.Noise());
}
delNoise(index) {
this.noises.splice(index, 1);
}
static fromJson(json = {}) {
return new Outbound.FreedomSettings(
json.domainStrategy,
json.timeout,
json.redirect,
json.fragment ? Outbound.FreedomSettings.Fragment.fromJson(json.fragment) : undefined,
json.noises ? Outbound.FreedomSettings.Noises.fromJson(json.noises) : undefined,
json.noises ? json.noises.map(noise => Outbound.FreedomSettings.Noise.fromJson(noise)) : [new Outbound.FreedomSettings.Noise()],
);
}
@@ -880,10 +888,11 @@ Outbound.FreedomSettings = class extends CommonClass {
timeout: this.timeout,
redirect: this.redirect,
fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment,
noises: Object.keys(this.noises).length === 0 ? undefined : this.noises,
noises: Outbound.FreedomSettings.Noise.toJsonArray(this.noises),
};
}
};
Outbound.FreedomSettings.Fragment = class extends CommonClass {
constructor(packets = '1-3', length = '', interval = '') {
super();
@@ -900,7 +909,8 @@ Outbound.FreedomSettings.Fragment = class extends CommonClass {
);
}
};
Outbound.FreedomSettings.Noises = class extends CommonClass {
Outbound.FreedomSettings.Noise = class extends CommonClass {
constructor(
type = 'rand',
packet = '10-20',
@@ -913,12 +923,24 @@ Outbound.FreedomSettings.Noises = class extends CommonClass {
}
static fromJson(json = {}) {
return new Outbound.FreedomSettings.Noises(
return new Outbound.FreedomSettings.Noise(
json.type,
json.packet,
json.delay,
);
}
toJson() {
return {
type: this.type,
packet: this.packet,
delay: this.delay,
};
}
static toJsonArray(noises) {
return noises.map(noise => noise.toJson());
}
};
Outbound.BlackholeSettings = class extends CommonClass {
+5 -5
View File
@@ -530,10 +530,10 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
noSSEHeader = false,
xPaddingBytes = "100-1000",
xmux = {
maxConnections: 0,
maxConcurrency: 0,
cMaxReuseTimes: 0,
cMaxLifetimeMs: 0
maxConcurrency: 0,
maxConnections: 0,
cMaxReuseTimes: 0,
cMaxLifetimeMs: 0
}
) {
super();
@@ -581,8 +581,8 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
noSSEHeader: this.noSSEHeader,
xPaddingBytes: this.xPaddingBytes,
xmux: {
maxConnections: this.xmux.maxConnections,
maxConcurrency: this.xmux.maxConcurrency,
maxConnections: this.xmux.maxConnections,
cMaxReuseTimes: this.xmux.cMaxReuseTimes,
cMaxLifetimeMs: this.xmux.cMaxLifetimeMs
}
+30 -12
View File
@@ -46,21 +46,39 @@
<a-input v-model.trim="outbound.settings.fragment.interval"></a-input>
</a-form-item>
</template>
<!-- Switch for Noises -->
<a-form-item label='Noises'>
<a-switch :checked="Object.keys(outbound.settings.noises).length >0" @change="checked => outbound.settings.noises = checked ? new Outbound.FreedomSettings.Noises() : {}"></a-switch>
<a-switch :checked="outbound.settings.noises.length > 0"
@change="checked => outbound.settings.noises = checked ? [new Outbound.FreedomSettings.Noise()] : []">
</a-switch>
</a-form-item>
<template v-if="Object.keys(outbound.settings.noises).length >0">
<a-form-item label='Type'>
<a-select v-model="outbound.settings.noises.type" :dropdown-class-name="themeSwitcher.currentTheme">
<a-select-option v-for="s in ['rand','base64','str']" :value="s">[[ s ]]</a-select-option>
</a-select>
</a-form-item>
<a-form-item label='Packet'>
<a-input v-model.trim="outbound.settings.noises.packet"></a-input>
</a-form-item>
<a-form-item label='Delay'>
<a-input v-model.trim="outbound.settings.noises.delay"></a-input>
<!-- Add Noise Button -->
<template v-if="outbound.settings.noises.length > 0">
<a-form-item label="Noises">
<a-button icon="plus" type="primary" size="small" @click="outbound.settings.addNoise()"></a-button>
</a-form-item>
<!-- Noise Configurations -->
<a-form v-for="(noise, index) in outbound.settings.noises" :key="index" :colon="false" :label-col="{ md: {span:8} }"
:wrapper-col="{ md: {span:14} }">
<a-divider style="margin:0;"> Noise [[ index + 1 ]]
<a-icon v-if="outbound.settings.noises.length > 1" type="delete" @click="() => outbound.settings.delNoise(index)"
style="color: rgb(255, 77, 79); cursor: pointer;"></a-icon>
</a-divider>
<a-form-item label='Type'>
<a-select v-model="noise.type" :dropdown-class-name="themeSwitcher.currentTheme">
<a-select-option v-for="s in ['rand','base64','str']" :value="s">[[ s ]]</a-select-option>
</a-select>
</a-form-item>
<a-form-item label='Packet'>
<a-input v-model.trim="noise.packet"></a-input>
</a-form-item>
<a-form-item label='Delay'>
<a-input v-model.trim="noise.delay"></a-input>
</a-form-item>
</a-form>
</template>
</template>
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff. Show more