mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-14 05:23:09 +00:00
@@ -824,23 +824,34 @@ Outbound.Settings = class extends CommonClass {
|
||||
}
|
||||
};
|
||||
Outbound.FreedomSettings = class extends CommonClass {
|
||||
constructor(domainStrategy='', fragment={}) {
|
||||
constructor(
|
||||
domainStrategy = '',
|
||||
redirect = '',
|
||||
fragment = {},
|
||||
noise = {}
|
||||
) {
|
||||
super();
|
||||
this.domainStrategy = domainStrategy;
|
||||
this.redirect = redirect;
|
||||
this.fragment = fragment;
|
||||
this.noise = noise;
|
||||
}
|
||||
|
||||
static fromJson(json={}) {
|
||||
static fromJson(json = {}) {
|
||||
return new Outbound.FreedomSettings(
|
||||
json.domainStrategy,
|
||||
json.redirect,
|
||||
json.fragment ? Outbound.FreedomSettings.Fragment.fromJson(json.fragment) : undefined,
|
||||
json.noise ? Outbound.FreedomSettings.Noise.fromJson(json.noise) : undefined,
|
||||
);
|
||||
}
|
||||
|
||||
toJson() {
|
||||
return {
|
||||
domainStrategy: ObjectUtil.isEmpty(this.domainStrategy) ? undefined : this.domainStrategy,
|
||||
redirect: this.redirect,
|
||||
fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment,
|
||||
noise: Object.keys(this.noise).length === 0 ? undefined : this.noise,
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -860,6 +871,20 @@ Outbound.FreedomSettings.Fragment = class extends CommonClass {
|
||||
);
|
||||
}
|
||||
};
|
||||
Outbound.FreedomSettings.Noise = class extends CommonClass {
|
||||
constructor(packets = '', delay = '') {
|
||||
super();
|
||||
this.packets = packets;
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
static fromJson(json = {}) {
|
||||
return new Outbound.FreedomSettings.Noise(
|
||||
json.packets,
|
||||
json.delay,
|
||||
);
|
||||
}
|
||||
};
|
||||
Outbound.BlackholeSettings = class extends CommonClass {
|
||||
constructor(type) {
|
||||
super();
|
||||
|
||||
@@ -34,6 +34,7 @@ class AllSetting {
|
||||
this.subURI = "";
|
||||
this.subJsonURI = "";
|
||||
this.subJsonFragment = "";
|
||||
this.subJsonNoise = "";
|
||||
this.subJsonMux = "";
|
||||
this.subJsonRules = "";
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ type AllSetting struct {
|
||||
SubJsonPath string `json:"subJsonPath" form:"subJsonPath"`
|
||||
SubJsonURI string `json:"subJsonURI" form:"subJsonURI"`
|
||||
SubJsonFragment string `json:"subJsonFragment" form:"subJsonFragment"`
|
||||
SubJsonNoise string `json:"subJsonNoise" form:"subJsonNoise"`
|
||||
SubJsonMux string `json:"subJsonMux" form:"subJsonMux"`
|
||||
SubJsonRules string `json:"subJsonRules" form:"subJsonRules"`
|
||||
}
|
||||
|
||||
@@ -45,6 +45,20 @@
|
||||
<a-input v-model.trim="outbound.settings.fragment.interval"></a-input>
|
||||
</a-form-item>
|
||||
</template>
|
||||
<a-form-item label='Noise'>
|
||||
<a-switch
|
||||
:checked="Object.keys(outbound.settings.noise).length >0"
|
||||
@change="checked => outbound.settings.noise = checked ? new Outbound.FreedomSettings.Noise() : {}">
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
<template v-if="Object.keys(outbound.settings.noise).length >0">
|
||||
<a-form-item label='Packets'>
|
||||
<a-input v-model.trim="outbound.settings.noise.packets"></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label='Delay'>
|
||||
<a-input v-model.trim="outbound.settings.noise.delay"></a-input>
|
||||
</a-form-item>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<!-- blackhole settings -->
|
||||
|
||||
@@ -209,6 +209,7 @@
|
||||
<setting-list-item type="text" title='{{ i18n "pages.settings.subPath"}}' desc='{{ i18n "pages.settings.subPathDesc"}}' v-model="allSetting.subJsonPath"></setting-list-item>
|
||||
<setting-list-item type="text" title='{{ i18n "pages.settings.subURI"}}' desc='{{ i18n "pages.settings.subURIDesc"}}' v-model="allSetting.subJsonURI" placeholder="(http|https)://domain[:port]/path/"></setting-list-item>
|
||||
<setting-list-item type="switch" title='{{ i18n "pages.settings.fragment"}}' desc='{{ i18n "pages.settings.fragmentDesc"}}' v-model="fragment"></setting-list-item>
|
||||
<setting-list-item type="switch" title='Noise' v-model="enableNoise"></setting-list-item>
|
||||
<setting-list-item type="switch" title='Mux' v-model="enableMux"></setting-list-item>
|
||||
<setting-list-item type="switch" title='{{ i18n "pages.xray.directCountryConfigs"}}' desc='{{ i18n "pages.xray.directCountryConfigsDesc"}}' v-model="enableDirect"></setting-list-item>
|
||||
</a-list>
|
||||
@@ -218,6 +219,10 @@
|
||||
<setting-list-item type="text" title='Length' v-model="fragmentLength" placeholder="100-200"></setting-list-item>
|
||||
<setting-list-item type="text" title='Interval' v-model="fragmentInterval" placeholder="10-20"></setting-list-item>
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel header='Noise' v-if="enableNoise">
|
||||
<setting-list-item type="text" title='Packets' v-model="noisePackets" placeholder="rand:5-10"></setting-list-item>
|
||||
<setting-list-item type="text" title='Delay' v-model="noiseDelay" placeholder="5-10"></setting-list-item>
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel header='Mux' v-if="enableMux">
|
||||
<setting-list-item type="number" title='Concurrency' v-model="muxConcurrency" :min="-1" :max="1024"></setting-list-item>
|
||||
<setting-list-item type="number" title='xudp Concurrency' v-model="muxXudpConcurrency" :min="-1" :max="1024"></setting-list-item>
|
||||
@@ -296,6 +301,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
defaultNoise: {
|
||||
tag: "noise",
|
||||
protocol: "freedom",
|
||||
settings: {
|
||||
domainStrategy: "AsIs",
|
||||
noise: {
|
||||
packets: "rand:5-10",
|
||||
delay: "5-10",
|
||||
}
|
||||
},
|
||||
},
|
||||
defaultMux: {
|
||||
enabled: true,
|
||||
concurrency: 8,
|
||||
@@ -447,6 +463,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
enableNoise: {
|
||||
get: function () { return this.allSetting?.subJsonNoise != ""; },
|
||||
set: function (v) {
|
||||
this.allSetting.subJsonNoise = v ? JSON.stringify(this.defaultNoise) : "";
|
||||
}
|
||||
},
|
||||
noisePackets: {
|
||||
get: function () { return this.enableNoise ? JSON.parse(this.allSetting.subJsonNoise).settings.noise.packets : ""; },
|
||||
set: function (v) {
|
||||
if (v != "") {
|
||||
newNoise = JSON.parse(this.allSetting.subJsonNoise);
|
||||
newNoise.settings.noise.packets = v;
|
||||
this.allSetting.subJsonNoise = JSON.stringify(newNoise);
|
||||
}
|
||||
}
|
||||
},
|
||||
noiseDelay: {
|
||||
get: function () { return this.enableNoise ? JSON.parse(this.allSetting.subJsonNoise).settings.noise.delay : ""; },
|
||||
set: function (v) {
|
||||
if (v != "") {
|
||||
newNoise = JSON.parse(this.allSetting.subJsonNoise);
|
||||
newNoise.settings.noise.delay = v;
|
||||
this.allSetting.subJsonNoise = JSON.stringify(newNoise);
|
||||
}
|
||||
}
|
||||
},
|
||||
enableMux: {
|
||||
get: function() { return this.allSetting?.subJsonMux != ""; },
|
||||
set: function (v) {
|
||||
|
||||
@@ -59,6 +59,7 @@ var defaultValueMap = map[string]string{
|
||||
"subJsonPath": "/json/",
|
||||
"subJsonURI": "",
|
||||
"subJsonFragment": "",
|
||||
"subJsonNoise": "",
|
||||
"subJsonMux": "",
|
||||
"subJsonRules": "",
|
||||
"warp": "",
|
||||
@@ -405,6 +406,10 @@ func (s *SettingService) GetSubJsonFragment() (string, error) {
|
||||
return s.getString("subJsonFragment")
|
||||
}
|
||||
|
||||
func (s *SettingService) GetSubJsonNoise() (string, error) {
|
||||
return s.getString("subJsonNoise")
|
||||
}
|
||||
|
||||
func (s *SettingService) GetSubJsonMux() (string, error) {
|
||||
return s.getString("subJsonMux")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user