diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-08-29 12:27:43 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-08-29 12:27:43 +0300 |
| commit | fa43248e3043932a31bc93ff86a2d4a3f1314491 (patch) | |
| tree | ed9e83e4f352de96e50ebb1f98ec4b525d787307 /web | |
| parent | cb3da25bc82b818018476d53fe534aba3a55e1aa (diff) | |
New - Noise
freedom
Diffstat (limited to 'web')
| -rw-r--r-- | web/assets/js/model/outbound.js | 28 | ||||
| -rw-r--r-- | web/assets/js/model/setting.js | 1 | ||||
| -rw-r--r-- | web/entity/entity.go | 1 | ||||
| -rw-r--r-- | web/html/xui/form/outbound.html | 30 | ||||
| -rw-r--r-- | web/html/xui/settings.html | 55 | ||||
| -rw-r--r-- | web/service/setting.go | 5 | ||||
| -rw-r--r-- | web/translation/translate.en_US.toml | 2 | ||||
| -rw-r--r-- | web/translation/translate.es_ES.toml | 2 | ||||
| -rw-r--r-- | web/translation/translate.fa_IR.toml | 2 | ||||
| -rw-r--r-- | web/translation/translate.id_ID.toml | 2 | ||||
| -rw-r--r-- | web/translation/translate.ru_RU.toml | 2 | ||||
| -rw-r--r-- | web/translation/translate.tr_TR.toml | 2 | ||||
| -rw-r--r-- | web/translation/translate.uk_UA.toml | 2 | ||||
| -rw-r--r-- | web/translation/translate.vi_VN.toml | 2 | ||||
| -rw-r--r-- | web/translation/translate.zh_CN.toml | 2 |
15 files changed, 129 insertions, 9 deletions
diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index f1909552..59da542a 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -861,23 +861,34 @@ Outbound.Settings = class extends CommonClass { } }; Outbound.FreedomSettings = class extends CommonClass { - constructor(domainStrategy = '', fragment = {}) { + constructor( + domainStrategy = '', + timeout = '', + fragment = {}, + noise = {} + ) { super(); this.domainStrategy = domainStrategy; + this.timeout = timeout; this.fragment = fragment; + this.noise = noise; } static fromJson(json = {}) { return new Outbound.FreedomSettings( json.domainStrategy, + json.timeout, 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, + timeout: this.timeout, fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment, + noise: Object.keys(this.noise).length === 0 ? undefined : this.noise, }; } }; @@ -897,6 +908,21 @@ 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(); diff --git a/web/assets/js/model/setting.js b/web/assets/js/model/setting.js index 607fd069..2dea875b 100644 --- a/web/assets/js/model/setting.js +++ b/web/assets/js/model/setting.js @@ -38,6 +38,7 @@ class AllSetting { this.subURI = ""; this.subJsonURI = ""; this.subJsonFragment = ""; + this.subJsonNoise = ""; this.subJsonMux = ""; this.subJsonRules = ""; diff --git a/web/entity/entity.go b/web/entity/entity.go index 533fe973..ae11d614 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -52,6 +52,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"` Datepicker string `json:"datepicker" form:"datepicker"` diff --git a/web/html/xui/form/outbound.html b/web/html/xui/form/outbound.html index 61af06e0..a579b7a6 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -22,6 +22,9 @@ <a-select-option v-for="s in OutboundDomainStrategies" :value="s">[[ s ]]</a-select-option> </a-select> </a-form-item> + <a-form-item label='Timeout'> + <a-input-number v-model.number="outbound.settings.timeout" min="0" ></a-input-number> + </a-form-item> <a-form-item label='Fragment'> <a-switch :checked="Object.keys(outbound.settings.fragment).length >0" @change="checked => outbound.settings.fragment = checked ? new Outbound.FreedomSettings.Fragment() : {}"></a-switch> </a-form-item> @@ -38,6 +41,17 @@ <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 --> @@ -95,10 +109,10 @@ </a-select> </a-form-item> <a-form-item label='MTU'> - <a-input-number v-model.number="outbound.settings.mtu"></a-input-number> + <a-input-number v-model.number="outbound.settings.mtu" min="0"></a-input-number> </a-form-item> <a-form-item label='Workers'> - <a-input-number min="0" v-model.number="outbound.settings.workers"></a-input-number> + <a-input-number v-model.number="outbound.settings.workers" min="0"></a-input-number> </a-form-item> <a-form-item label='Kernel Mode'> <a-switch v-model="outbound.settings.kernelMode"></a-switch> @@ -257,25 +271,25 @@ <a-input v-model="outbound.stream.kcp.seed"></a-input> </a-form-item> <a-form-item label='MTU'> - <a-input-number v-model.number="outbound.stream.kcp.mtu"></a-input-number> + <a-input-number v-model.number="outbound.stream.kcp.mtu" min="0"></a-input-number> </a-form-item> <a-form-item label='TTI (ms)'> - <a-input-number v-model.number="outbound.stream.kcp.tti"></a-input-number> + <a-input-number v-model.number="outbound.stream.kcp.tti" min="0"></a-input-number> </a-form-item> <a-form-item label='Uplink (MB/s)'> - <a-input-number v-model.number="outbound.stream.kcp.upCap"></a-input-number> + <a-input-number v-model.number="outbound.stream.kcp.upCap" min="0"></a-input-number> </a-form-item> <a-form-item label='Downlink (MB/s)'> - <a-input-number v-model.number="outbound.stream.kcp.downCap"></a-input-number> + <a-input-number v-model.number="outbound.stream.kcp.downCap" min="0"></a-input-number> </a-form-item> <a-form-item label='Congestion'> <a-switch v-model="outbound.stream.kcp.congestion"></a-switch> </a-form-item> <a-form-item label='Read Buffer (MB)'> - <a-input-number v-model.number="outbound.stream.kcp.readBuffer"></a-input-number> + <a-input-number v-model.number="outbound.stream.kcp.readBuffer" min="0"></a-input-number> </a-form-item> <a-form-item label='Write Buffer (MB)'> - <a-input-number v-model.number="outbound.stream.kcp.writeBuffer"></a-input-number> + <a-input-number v-model.number="outbound.stream.kcp.writeBuffer" min="0"></a-input-number> </a-form-item> </template> diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html index f2379078..beab4df1 100644 --- a/web/html/xui/settings.html +++ b/web/html/xui/settings.html @@ -316,6 +316,24 @@ <a-list-item style="padding: 20px"> <a-row> <a-col :lg="24" :xl="12"> + <a-list-item-meta title='Noise'> + <template slot="description">{{ i18n "pages.settings.noiseDesc"}}</template> + </a-list-item-meta> + </a-col> + <a-col :lg="24" :xl="12"> + <a-switch v-model="noise"></a-switch> + </a-col> + </a-row> + <a-collapse v-if="noise" style="margin-top: 14px;"> + <a-collapse-panel header='{{ i18n "pages.settings.noiseSett"}}' v-if="noise"> + <setting-list-item style="padding: 10px 20px" type="text" title='Packets' v-model="noisePackets" placeholder="rand:5-10"></setting-list-item> + <setting-list-item style="padding: 10px 20px" type="text" title='Delay' v-model="noiseDelay" placeholder="5-10"></setting-list-item> + </a-collapse-panel> + </a-collapse> + </a-list-item> + <a-list-item style="padding: 20px"> + <a-row> + <a-col :lg="24" :xl="12"> <a-list-item-meta title='{{ i18n "pages.settings.mux"}}'> <template slot="description">{{ i18n "pages.settings.muxDesc"}}</template> </a-list-item-meta> @@ -412,6 +430,17 @@ } } }, + defaultNoise: { + tag: "noise", + protocol: "freedom", + settings: { + domainStrategy: "AsIs", + noise: { + packets: "rand:5-10", + delay: "5-10", + } + }, + }, defaultMux: { enabled: true, concurrency: 8, @@ -611,6 +640,32 @@ } } }, + noise: { + get: function () { return this.allSetting?.subJsonNoise != ""; }, + set: function (v) { + this.allSetting.subJsonNoise = v ? JSON.stringify(this.defaultNoise) : ""; + } + }, + noisePackets: { + get: function () { return this.noise ? 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.noise ? 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) { diff --git a/web/service/setting.go b/web/service/setting.go index ec69f9c8..bddcacce 100644 --- a/web/service/setting.go +++ b/web/service/setting.go @@ -62,6 +62,7 @@ var defaultValueMap = map[string]string{ "subJsonPath": "/json/", "subJsonURI": "", "subJsonFragment": "", + "subJsonNoise": "", "subJsonMux": "", "subJsonRules": "", "datepicker": "gregorian", @@ -458,6 +459,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") } diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index 6b232727..290feae4 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -312,6 +312,8 @@ "fragment" = "Fragmentation" "fragmentDesc" = "Enable fragmentation for TLS hello packet." "fragmentSett" = "Fragmentation Settings" +"noiseDesc" = "Enable Noise." +"noiseSett" = "Noise Settings" "mux" = "Mux" "muxDesc" = "Transmit multiple independent data streams within an established data stream." "muxSett" = "Mux Settings" diff --git a/web/translation/translate.es_ES.toml b/web/translation/translate.es_ES.toml index 8fef6dca..adb52271 100644 --- a/web/translation/translate.es_ES.toml +++ b/web/translation/translate.es_ES.toml @@ -312,6 +312,8 @@ "fragment" = "Fragmentación"
"fragmentDesc" = "Habilitar la fragmentación para el paquete de saludo de TLS"
"fragmentSett" = "Configuración de Fragmentación"
+"noiseDesc" = "Activar Noise."
+"noiseSett" = "Configuración de Noise"
"mux" = "Mux"
"muxDesc" = "Transmite múltiples flujos de datos independientes dentro de un flujo de datos establecido."
"muxSett" = "Configuración Mux"
diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index d967acf6..1258ba41 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -312,6 +312,8 @@ "fragment" = "فرگمنت" "fragmentDesc" = "فعال کردن فرگمنت برای بستهی نخست تیالاس" "fragmentSett" = "تنظیمات فرگمنت" +"noiseDesc" = "فعال کردن Noise." +"noiseSett" = "تنظیمات Noise" "mux" = "ماکس" "muxDesc" = "چندین جریان داده مستقل را در یک جریان داده ثابت منتقل می کند" "muxSett" = "تنظیمات ماکس" diff --git a/web/translation/translate.id_ID.toml b/web/translation/translate.id_ID.toml index 51b84edc..f88610c1 100644 --- a/web/translation/translate.id_ID.toml +++ b/web/translation/translate.id_ID.toml @@ -312,6 +312,8 @@ "fragment" = "Fragmentasi" "fragmentDesc" = "Aktifkan fragmentasi untuk paket hello TLS" "fragmentSett" = "Pengaturan Fragmentasi" +"noiseDesc" = "Aktifkan Noise." +"noiseSett" = "Pengaturan Noise" "mux" = "Mux" "muxDesc" = "Mengirimkan beberapa aliran data independen dalam aliran data yang sudah ada." "muxSett" = "Pengaturan Mux" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index c3606c4e..93d8b3fe 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -312,6 +312,8 @@ "fragment" = "Фрагментация" "fragmentDesc" = "Включить фрагментацию для пакета приветствия TLS" "fragmentSett" = "Настройки фрагментации" +"noiseDesc" = "Включить Noise." +"noiseSett" = "Настройки Noise" "mux" = "Mux" "muxDesc" = "Передача нескольких независимых потоков данных в рамках установленного потока данных." "muxSett" = "Mux Настройки" diff --git a/web/translation/translate.tr_TR.toml b/web/translation/translate.tr_TR.toml index 910714a3..7006462f 100644 --- a/web/translation/translate.tr_TR.toml +++ b/web/translation/translate.tr_TR.toml @@ -312,6 +312,8 @@ "fragment" = "Parçalama" "fragmentDesc" = "TLS merhaba paketinin parçalanmasını etkinleştir." "fragmentSett" = "Parçalama Ayarları" +"noiseDesc" = "Noise'i Etkinleştir." +"noiseSett" = "Noise Ayarları" "mux" = "Mux" "muxDesc" = "Kurulmuş bir veri akışında birden çok bağımsız veri akışını iletir." "muxSett" = "Mux Ayarları" diff --git a/web/translation/translate.uk_UA.toml b/web/translation/translate.uk_UA.toml index a346c099..f15a36bb 100644 --- a/web/translation/translate.uk_UA.toml +++ b/web/translation/translate.uk_UA.toml @@ -312,6 +312,8 @@ "fragment" = "Фрагментація" "fragmentDesc" = "Увімкнути фрагментацію для пакету привітання TLS" "fragmentSett" = "Параметри фрагментації" +"noiseDesc" = "Увімкнути Noise." +"noiseSett" = "Налаштування Noise" "mux" = "Mux" "muxDesc" = "Передавати кілька незалежних потоків даних у межах встановленого потоку даних." "muxSett" = "Налаштування Mux" diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index 19d90bba..6024fe2b 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -312,6 +312,8 @@ "fragment" = "Sự phân mảnh"
"fragmentDesc" = "Kích hoạt phân mảnh cho gói TLS hello"
"fragmentSett" = "Cài đặt phân mảnh"
+"noiseDesc" = "Bật Noise."
+"noiseSett" = "Cài đặt Noise"
"mux" = "Mux"
"muxDesc" = "Truyền nhiều luồng dữ liệu độc lập trong luồng dữ liệu đã thiết lập."
"muxSett" = "Mux Cài đặt"
diff --git a/web/translation/translate.zh_CN.toml b/web/translation/translate.zh_CN.toml index 7a28891f..480dec95 100644 --- a/web/translation/translate.zh_CN.toml +++ b/web/translation/translate.zh_CN.toml @@ -312,6 +312,8 @@ "fragment" = "分片" "fragmentDesc" = "启用 TLS hello 数据包分片" "fragmentSett" = "设置" +"noiseDesc" = "启用 Noise." +"noiseSett" = "Noise 设置" "mux" = "多路复用器" "muxDesc" = "在已建立的数据流内传输多个独立的数据流" "muxSett" = "复用器设置" |
