diff --git a/sub/sub.go b/sub/sub.go index a8a20868..db582e8d 100644 --- a/sub/sub.go +++ b/sub/sub.go @@ -92,9 +92,9 @@ func (s *Server) initRouter() (*gin.Engine, error) { SubJsonFragment = "" } - SubJsonNoise, err := s.settingService.GetSubJsonNoise() + SubJsonNoises, err := s.settingService.GetSubJsonNoises() if err != nil { - SubJsonNoise = "" + SubJsonNoises = "" } SubJsonMux, err := s.settingService.GetSubJsonMux() @@ -111,7 +111,7 @@ func (s *Server) initRouter() (*gin.Engine, error) { s.sub = NewSUBController( g, LinksPath, JsonPath, Encrypt, ShowInfo, RemarkModel, SubUpdates, - SubJsonFragment, SubJsonNoise, SubJsonMux, SubJsonRules) + SubJsonFragment, SubJsonNoises, SubJsonMux, SubJsonRules) return engine, nil } diff --git a/sub/subJsonService.go b/sub/subJsonService.go index cbda594a..680a078d 100644 --- a/sub/subJsonService.go +++ b/sub/subJsonService.go @@ -21,14 +21,14 @@ type SubJsonService struct { configJson map[string]interface{} defaultOutbounds []json_util.RawMessage fragment string - noise string + noises string mux string inboundService service.InboundService SubService *SubService } -func NewSubJsonService(fragment string, noise string, mux string, rules string, subService *SubService) *SubJsonService { +func NewSubJsonService(fragment string, noises string, mux string, rules string, subService *SubService) *SubJsonService { var configJson map[string]interface{} var defaultOutbounds []json_util.RawMessage json.Unmarshal([]byte(defaultJson), &configJson) @@ -53,15 +53,15 @@ func NewSubJsonService(fragment string, noise string, mux string, rules string, defaultOutbounds = append(defaultOutbounds, json_util.RawMessage(fragment)) } - if noise != "" { - defaultOutbounds = append(defaultOutbounds, json_util.RawMessage(noise)) + if noises != "" { + defaultOutbounds = append(defaultOutbounds, json_util.RawMessage(noises)) } return &SubJsonService{ configJson: configJson, defaultOutbounds: defaultOutbounds, fragment: fragment, - noise: noise, + noises: noises, mux: mux, SubService: subService, } diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index 53497548..bc4ad735 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -854,14 +854,14 @@ Outbound.FreedomSettings = class extends CommonClass { timeout = 10, redirect = '', fragment = {}, - noise = {} + noises = {} ) { super(); this.domainStrategy = domainStrategy; this.timeout = timeout; this.redirect = redirect; this.fragment = fragment; - this.noise = noise; + this.noises = noises; } static fromJson(json = {}) { @@ -870,7 +870,7 @@ Outbound.FreedomSettings = class extends CommonClass { json.timeout, json.redirect, json.fragment ? Outbound.FreedomSettings.Fragment.fromJson(json.fragment) : undefined, - json.noise ? Outbound.FreedomSettings.Noise.fromJson(json.noise) : undefined, + json.noises ? Outbound.FreedomSettings.Noises.fromJson(json.noises) : undefined, ); } @@ -880,7 +880,7 @@ Outbound.FreedomSettings = class extends CommonClass { timeout: this.timeout, redirect: this.redirect, fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment, - noise: Object.keys(this.noise).length === 0 ? undefined : this.noise, + noises: Object.keys(this.noises).length === 0 ? undefined : this.noises, }; } }; @@ -900,15 +900,21 @@ Outbound.FreedomSettings.Fragment = class extends CommonClass { ); } }; -Outbound.FreedomSettings.Noise = class extends CommonClass { - constructor(packet = 'rand:100-200', delay = '10-20') { +Outbound.FreedomSettings.Noises = class extends CommonClass { + constructor( + type = 'rand', + packet = '10-20', + delay = '10-16' + ) { super(); + this.type = type; this.packet = packet; this.delay = delay; } static fromJson(json = {}) { - return new Outbound.FreedomSettings.Noise( + return new Outbound.FreedomSettings.Noises( + json.type, json.packet, json.delay, ); diff --git a/web/assets/js/model/setting.js b/web/assets/js/model/setting.js index 75424bd3..b73d6008 100644 --- a/web/assets/js/model/setting.js +++ b/web/assets/js/model/setting.js @@ -38,7 +38,7 @@ class AllSetting { this.subURI = ""; this.subJsonURI = ""; this.subJsonFragment = ""; - this.subJsonNoise = ""; + this.subJsonNoises = ""; this.subJsonMux = ""; this.subJsonRules = ""; diff --git a/web/entity/entity.go b/web/entity/entity.go index ae11d614..7e00fbf3 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -52,7 +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"` + SubJsonNoises string `json:"subJsonNoises" form:"subJsonNoises"` 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 abc96bb4..21fedd88 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -46,15 +46,20 @@ - - + + - diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html index 3433a648..b95ce0a5 100644 --- a/web/html/xui/settings.html +++ b/web/html/xui/settings.html @@ -305,18 +305,30 @@ - - + + - + - - - - + + + + + + + + + + [[ p ]] + + + + + + @@ -419,14 +431,15 @@ } } }, - defaultNoise: { - tag: "noise", + defaultNoises: { + tag: "noises", protocol: "freedom", settings: { domainStrategy: "AsIs", - noise: { - packet: "rand:5-10", - delay: "10-20", + noises: { + type: "rand", + packet: "10-20", + delay: "10-16", } }, }, @@ -629,29 +642,39 @@ } } }, - noise: { - get: function () { return this.allSetting?.subJsonNoise != ""; }, + noises: { + get: function () { return this.allSetting?.subJsonNoises != ""; }, set: function (v) { - this.allSetting.subJsonNoise = v ? JSON.stringify(this.defaultNoise) : ""; + this.allSetting.subJsonNoises = v ? JSON.stringify(this.defaultNoises) : ""; } }, - noisePacket: { - get: function () { return this.noise ? JSON.parse(this.allSetting.subJsonNoise).settings.noise.packet : ""; }, + noisesType: { + get: function () { return this.noises ? JSON.parse(this.allSetting.subJsonNoises).settings.noises.type : ""; }, set: function (v) { if (v != "") { - newNoise = JSON.parse(this.allSetting.subJsonNoise); - newNoise.settings.noise.packet = v; - this.allSetting.subJsonNoise = JSON.stringify(newNoise); + newNoises = JSON.parse(this.allSetting.subJsonNoises); + newNoises.settings.noises.type = v; + this.allSetting.subJsonNoises = JSON.stringify(newNoises); } } }, - noiseDelay: { - get: function () { return this.noise ? JSON.parse(this.allSetting.subJsonNoise).settings.noise.delay : ""; }, + noisesPacket: { + get: function () { return this.noises ? JSON.parse(this.allSetting.subJsonNoises).settings.noises.packet : ""; }, set: function (v) { if (v != "") { - newNoise = JSON.parse(this.allSetting.subJsonNoise); - newNoise.settings.noise.delay = v; - this.allSetting.subJsonNoise = JSON.stringify(newNoise); + newNoises = JSON.parse(this.allSetting.subJsonNoises); + newNoises.settings.noises.packet = v; + this.allSetting.subJsonNoises = JSON.stringify(newNoises); + } + } + }, + noisesDelay: { + get: function () { return this.noises ? JSON.parse(this.allSetting.subJsonNoises).settings.noises.delay : ""; }, + set: function (v) { + if (v != "") { + newNoises = JSON.parse(this.allSetting.subJsonNoises); + newNoises.settings.noises.delay = v; + this.allSetting.subJsonNoises = JSON.stringify(newNoises); } } }, diff --git a/web/service/setting.go b/web/service/setting.go index ba620e8f..90bf8fc4 100644 --- a/web/service/setting.go +++ b/web/service/setting.go @@ -62,7 +62,7 @@ var defaultValueMap = map[string]string{ "subJsonPath": "/json/", "subJsonURI": "", "subJsonFragment": "", - "subJsonNoise": "", + "subJsonNoises": "", "subJsonMux": "", "subJsonRules": "", "datepicker": "gregorian", @@ -459,8 +459,8 @@ func (s *SettingService) GetSubJsonFragment() (string, error) { return s.getString("subJsonFragment") } -func (s *SettingService) GetSubJsonNoise() (string, error) { - return s.getString("subJsonNoise") +func (s *SettingService) GetSubJsonNoises() (string, error) { + return s.getString("subJsonNoises") } func (s *SettingService) GetSubJsonMux() (string, error) { diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index b1207dc0..f92f46ed 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -309,8 +309,8 @@ "fragment" = "Fragmentation" "fragmentDesc" = "Enable fragmentation for TLS hello packet." "fragmentSett" = "Fragmentation Settings" -"noiseDesc" = "Enable Noise." -"noiseSett" = "Noise Settings" +"noisesDesc" = "Enable Noises." +"noisesSett" = "Noises 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 1791cf20..462e534e 100644 --- a/web/translation/translate.es_ES.toml +++ b/web/translation/translate.es_ES.toml @@ -309,8 +309,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" +"noisesDesc" = "Activar Noises." +"noisesSett" = "Configuración de Noises" "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 c208bfd4..0b4e7854 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -309,8 +309,8 @@ "fragment" = "فرگمنت" "fragmentDesc" = "فعال کردن فرگمنت برای بسته‌ی نخست تی‌ال‌اس" "fragmentSett" = "تنظیمات فرگمنت" -"noiseDesc" = "فعال کردن Noise." -"noiseSett" = "تنظیمات Noise" +"noisesDesc" = "فعال کردن Noises." +"noisesSett" = "تنظیمات Noises" "mux" = "ماکس" "muxDesc" = "چندین جریان داده مستقل را در یک جریان داده ثابت منتقل می کند" "muxSett" = "تنظیمات ماکس" diff --git a/web/translation/translate.id_ID.toml b/web/translation/translate.id_ID.toml index d913b4a3..b59c5fc7 100644 --- a/web/translation/translate.id_ID.toml +++ b/web/translation/translate.id_ID.toml @@ -309,8 +309,8 @@ "fragment" = "Fragmentasi" "fragmentDesc" = "Aktifkan fragmentasi untuk paket hello TLS" "fragmentSett" = "Pengaturan Fragmentasi" -"noiseDesc" = "Aktifkan Noise." -"noiseSett" = "Pengaturan Noise" +"noisesDesc" = "Aktifkan Noises." +"noisesSett" = "Pengaturan Noises" "mux" = "Mux" "muxDesc" = "Mengirimkan beberapa aliran data independen dalam aliran data yang sudah ada." "muxSett" = "Pengaturan Mux" diff --git a/web/translation/translate.pt_BR.toml b/web/translation/translate.pt_BR.toml index c25c6df0..4da6d8f9 100644 --- a/web/translation/translate.pt_BR.toml +++ b/web/translation/translate.pt_BR.toml @@ -309,8 +309,8 @@ "fragment" = "Fragmentação" "fragmentDesc" = "Ativa a fragmentação para o pacote TLS hello." "fragmentSett" = "Configurações de Fragmentação" -"noiseDesc" = "Ativar Noise." -"noiseSett" = "Configurações de Noise" +"noisesDesc" = "Ativar Noises." +"noisesSett" = "Configurações de Noises" "mux" = "Mux" "muxDesc" = "Transmitir múltiplos fluxos de dados independentes dentro de um fluxo de dados estabelecido." "muxSett" = "Configurações de Mux" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index 88db2ab2..59196c00 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -309,8 +309,8 @@ "fragment" = "Фрагментация" "fragmentDesc" = "Включить фрагментацию для пакета приветствия TLS" "fragmentSett" = "Настройки фрагментации" -"noiseDesc" = "Включить Noise." -"noiseSett" = "Настройки Noise" +"noisesDesc" = "Включить Noises." +"noisesSett" = "Настройки Noises" "mux" = "Mux" "muxDesc" = "Передача нескольких независимых потоков данных в рамках установленного потока данных." "muxSett" = "Mux Настройки" diff --git a/web/translation/translate.tr_TR.toml b/web/translation/translate.tr_TR.toml index af22826c..1274941f 100644 --- a/web/translation/translate.tr_TR.toml +++ b/web/translation/translate.tr_TR.toml @@ -309,8 +309,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ı" +"noisesDesc" = "Noises'i Etkinleştir." +"noisesSett" = "Noises 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 de115d7a..221c34d5 100644 --- a/web/translation/translate.uk_UA.toml +++ b/web/translation/translate.uk_UA.toml @@ -309,8 +309,8 @@ "fragment" = "Фрагментація" "fragmentDesc" = "Увімкнути фрагментацію для пакету привітання TLS" "fragmentSett" = "Параметри фрагментації" -"noiseDesc" = "Увімкнути Noise." -"noiseSett" = "Налаштування Noise" +"noisesDesc" = "Увімкнути Noises." +"noisesSett" = "Налаштування Noises" "mux" = "Mux" "muxDesc" = "Передавати кілька незалежних потоків даних у межах встановленого потоку даних." "muxSett" = "Налаштування Mux" diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index 2447607c..e45c664b 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -309,8 +309,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" +"noisesDesc" = "Bật Noises." +"noisesSett" = "Cài đặt Noises" "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 2d2cf715..0314b0ab 100644 --- a/web/translation/translate.zh_CN.toml +++ b/web/translation/translate.zh_CN.toml @@ -309,8 +309,8 @@ "fragment" = "分片" "fragmentDesc" = "启用 TLS hello 数据包分片" "fragmentSett" = "设置" -"noiseDesc" = "启用 Noise." -"noiseSett" = "Noise 设置" +"noisesDesc" = "启用 Noises." +"noisesSett" = "Noises 设置" "mux" = "多路复用器" "muxDesc" = "在已建立的数据流内传输多个独立的数据流" "muxSett" = "复用器设置"