mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-17 18:45:03 +03:00
feat(web): vless encryption new modes (#5517)
* feat(web): add vless encryption new modes * feat(web): add translations for vless encryption modes * feat(translation): bring "vlessAuthX25519" and "vlessAuthMlkem768" to general form
This commit is contained in:
@@ -2064,11 +2064,34 @@ func (s *ServerService) GetNewVlessEnc() (any, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
auths := parseVlessEncAuths(out.String())
|
||||
auths = append(auths, deriveVlessEncModes(auths)...)
|
||||
|
||||
return map[string]any{
|
||||
"auths": parseVlessEncAuths(out.String()),
|
||||
"auths": auths,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func deriveVlessEncModes(auths []map[string]string) []map[string]string {
|
||||
var extra []map[string]string
|
||||
for _, a := range auths {
|
||||
for _, mode := range []string{"xorpub", "random"} {
|
||||
dec := strings.Replace(a["decryption"], ".native.", "."+mode+".", 1)
|
||||
enc := strings.Replace(a["encryption"], ".native.", "."+mode+".", 1)
|
||||
if dec == a["decryption"] && enc == a["encryption"] {
|
||||
continue
|
||||
}
|
||||
extra = append(extra, map[string]string{
|
||||
"id": a["id"] + "_" + mode,
|
||||
"label": a["label"] + " (" + mode + ")",
|
||||
"decryption": dec,
|
||||
"encryption": enc,
|
||||
})
|
||||
}
|
||||
}
|
||||
return extra
|
||||
}
|
||||
|
||||
func parseVlessEncAuths(output string) []map[string]string {
|
||||
lines := strings.Split(output, "\n")
|
||||
var auths []map[string]string
|
||||
|
||||
Reference in New Issue
Block a user