mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-18 05:04:40 +03:00
add or remove noise
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user