From a15c8f8bfe9627995b24418f500a8c0c8ba35054 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Sat, 6 Sep 2025 21:00:24 +0200 Subject: [PATCH] VlessEnc --- web/assets/js/model/inbound.js | 41 ++++++++++++++++++------ web/controller/server.go | 6 ++-- web/html/form/protocol/vless.html | 20 ++++++++++++ web/html/modals/inbound_modal.html | 48 ++++++++++++++++++---------- web/service/server.go | 51 ++++++++++++++++++++++-------- 5 files changed, 123 insertions(+), 43 deletions(-) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index c91dbd11..11ecb68e 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -1301,6 +1301,7 @@ class Inbound extends XrayCommonClass { const security = forceTls == 'same' ? this.stream.security : forceTls; const params = new Map(); params.set("type", this.stream.network); + params.set("encryption", this.settings.encryption); switch (type) { case "tcp": const tcp = this.stream.tcp; @@ -1859,13 +1860,15 @@ Inbound.VLESSSettings = class extends Inbound.Settings { constructor( protocol, vlesses = [new Inbound.VLESSSettings.VLESS()], - decryption = 'none', + decryption = "none", fallbacks = [] ) { super(protocol); this.vlesses = vlesses; this.decryption = decryption; this.fallbacks = fallbacks; + this.selectedAuth = "X25519, not Post-Quantum"; + this.encryption = ""; } addFallback() { @@ -1876,22 +1879,42 @@ Inbound.VLESSSettings = class extends Inbound.Settings { this.fallbacks.splice(index, 1); } - // decryption should be set to static value static fromJson(json = {}) { - return new Inbound.VLESSSettings( + const obj = new Inbound.VLESSSettings( Protocols.VLESS, - json.clients.map(client => Inbound.VLESSSettings.VLESS.fromJson(client)), - json.decryption || 'none', - Inbound.VLESSSettings.Fallback.fromJson(json.fallbacks),); + (json.clients || []).map(client => Inbound.VLESSSettings.VLESS.fromJson(client)), + json.decryption || "none", + Inbound.VLESSSettings.Fallback.fromJson(json.fallbacks || []) + ); + + obj.encryption = json.encryption || ""; + obj.selectedAuth = json.selectedAuth || "X25519, not Post-Quantum"; + + return obj; } + toJson() { - return { + const json = { clients: Inbound.VLESSSettings.toJsonArray(this.vlesses), - decryption: this.decryption, - fallbacks: Inbound.VLESSSettings.toJsonArray(this.fallbacks), }; + + if (this.decryption) { + json.decryption = this.decryption; + } + + if (this.encryption) { + json.encryption = this.encryption; + } + + if (this.fallbacks && this.fallbacks.length > 0) { + json.fallbacks = Inbound.VLESSSettings.toJsonArray(this.fallbacks); + } + + return json; } + + }; Inbound.VLESSSettings.VLESS = class extends XrayCommonClass { diff --git a/web/controller/server.go b/web/controller/server.go index f03c9ef2..08ecae1f 100644 --- a/web/controller/server.go +++ b/web/controller/server.go @@ -55,7 +55,7 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) { g.POST("/getNewX25519Cert", a.getNewX25519Cert) g.POST("/getNewmldsa65", a.getNewmldsa65) g.POST("/getNewEchCert", a.getNewEchCert) - g.POST("/getNewmlkem768", a.getNewmlkem768) + g.POST("/getNewVlessEnc", a.getNewVlessEnc) } func (a *ServerController) refreshStatus() { @@ -268,8 +268,8 @@ func (a *ServerController) getNewEchCert(c *gin.Context) { jsonObj(c, cert, nil) } -func (a *ServerController) getNewmlkem768(c *gin.Context) { - out, err := a.serverService.GetNewmlkem768() +func (a *ServerController) getNewVlessEnc(c *gin.Context) { + out, err := a.serverService.GetNewVlessEnc() if err != nil { jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.getNewmlkem768Error"), err) return diff --git a/web/html/form/protocol/vless.html b/web/html/form/protocol/vless.html index 3cebda6e..a0efa533 100644 --- a/web/html/form/protocol/vless.html +++ b/web/html/form/protocol/vless.html @@ -18,6 +18,26 @@ +