mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-03 17:07:15 +00: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
|
||||
|
||||
@@ -80,3 +80,31 @@ Authentication: X25519, not Post-Quantum
|
||||
t.Fatalf("encryption = %q, want client", auths[0]["encryption"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeriveVlessEncModes(t *testing.T) {
|
||||
base := []map[string]string{
|
||||
{
|
||||
"id": "x25519",
|
||||
"label": "X25519, not Post-Quantum",
|
||||
"decryption": "mlkem768x25519plus.native.600s.server-key",
|
||||
"encryption": "mlkem768x25519plus.native.0rtt.client-key",
|
||||
},
|
||||
}
|
||||
|
||||
derived := deriveVlessEncModes(base)
|
||||
if len(derived) != 2 {
|
||||
t.Fatalf("expected 2 derived blocks, got %d", len(derived))
|
||||
}
|
||||
if derived[0]["id"] != "x25519_xorpub" {
|
||||
t.Errorf("id = %q, want x25519_xorpub", derived[0]["id"])
|
||||
}
|
||||
if derived[0]["decryption"] != "mlkem768x25519plus.xorpub.600s.server-key" {
|
||||
t.Errorf("decryption = %q", derived[0]["decryption"])
|
||||
}
|
||||
if derived[0]["encryption"] != "mlkem768x25519plus.xorpub.0rtt.client-key" {
|
||||
t.Errorf("encryption = %q", derived[0]["encryption"])
|
||||
}
|
||||
if derived[1]["id"] != "x25519_random" {
|
||||
t.Errorf("id = %q, want x25519_random", derived[1]["id"])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "النطاقات المستثناة",
|
||||
"decryption": "فك التشفير",
|
||||
"encryption": "التشفير",
|
||||
"vlessAuthX25519": "مصادقة X25519",
|
||||
"vlessAuthMlkem768": "مصادقة ML-KEM-768",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "مخصص",
|
||||
"vlessAuthSelected": "المحدد: {auth}",
|
||||
"vlessAuthGenerate": "إنشاء المفاتيح",
|
||||
"vlessAuthGenerateButton": "إنشاء",
|
||||
"advanced": {
|
||||
"title": "أقسام JSON للاتصال الوارد",
|
||||
"subtitle": "JSON الكامل للاتصال الوارد ومحررات مخصصة لـ settings و sniffing و streamSettings.",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "غير متصل",
|
||||
"statusUp": "متصل"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "Domains excluded",
|
||||
"decryption": "Decryption",
|
||||
"encryption": "Encryption",
|
||||
"vlessAuthX25519": "X25519 auth",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 auth",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "Custom",
|
||||
"vlessAuthSelected": "Selected: {auth}",
|
||||
"vlessAuthGenerate": "Generate keys",
|
||||
"vlessAuthGenerateButton": "Generate",
|
||||
"advanced": {
|
||||
"title": "Inbound JSON sections",
|
||||
"subtitle": "Full inbound JSON and focused editors for settings, sniffing, and streamSettings.",
|
||||
@@ -2074,4 +2080,4 @@
|
||||
"statusDown": "DOWN",
|
||||
"statusUp": "UP"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "Dominios excluidos",
|
||||
"decryption": "Descifrado",
|
||||
"encryption": "Cifrado",
|
||||
"vlessAuthX25519": "Autenticación X25519",
|
||||
"vlessAuthMlkem768": "Autenticación ML-KEM-768",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "Personalizado",
|
||||
"vlessAuthSelected": "Seleccionado: {auth}",
|
||||
"vlessAuthGenerate": "Generar claves",
|
||||
"vlessAuthGenerateButton": "Generar",
|
||||
"advanced": {
|
||||
"title": "Secciones JSON del inbound",
|
||||
"subtitle": "JSON completo del inbound y editores específicos para settings, sniffing y streamSettings.",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "CAÍDO",
|
||||
"statusUp": "ACTIVO"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "دامنههای مستثنا",
|
||||
"decryption": "رمزگشایی",
|
||||
"encryption": "رمزنگاری",
|
||||
"vlessAuthX25519": "احراز X25519",
|
||||
"vlessAuthMlkem768": "احراز ML-KEM-768",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "سفارشی",
|
||||
"vlessAuthSelected": "انتخابشده: {auth}",
|
||||
"vlessAuthGenerate": "تولید کلیدها",
|
||||
"vlessAuthGenerateButton": "تولید",
|
||||
"advanced": {
|
||||
"title": "بخشهای JSON اینباند",
|
||||
"subtitle": "JSON کامل اینباند و ویرایشگرهای جداگانه برای settings، sniffing و streamSettings.",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "قطع",
|
||||
"statusUp": "وصل"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "Domain yang dikecualikan",
|
||||
"decryption": "Dekripsi",
|
||||
"encryption": "Enkripsi",
|
||||
"vlessAuthX25519": "Auth X25519",
|
||||
"vlessAuthMlkem768": "Auth ML-KEM-768",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "Khusus",
|
||||
"vlessAuthSelected": "Dipilih: {auth}",
|
||||
"vlessAuthGenerate": "Buat kunci",
|
||||
"vlessAuthGenerateButton": "Buat",
|
||||
"advanced": {
|
||||
"title": "Bagian JSON inbound",
|
||||
"subtitle": "JSON inbound lengkap dan editor fokus untuk settings, sniffing, dan streamSettings.",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "MATI",
|
||||
"statusUp": "AKTIF"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "除外するドメイン",
|
||||
"decryption": "復号",
|
||||
"encryption": "暗号化",
|
||||
"vlessAuthX25519": "X25519 認証",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 認証",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "カスタム",
|
||||
"vlessAuthSelected": "選択中: {auth}",
|
||||
"vlessAuthGenerate": "鍵を生成",
|
||||
"vlessAuthGenerateButton": "生成",
|
||||
"advanced": {
|
||||
"title": "インバウンド JSON セクション",
|
||||
"subtitle": "インバウンド全体の JSON と、settings、sniffing、streamSettings 用の専用エディター。",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "ダウン",
|
||||
"statusUp": "アップ"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "Domínios excluídos",
|
||||
"decryption": "Descriptografia",
|
||||
"encryption": "Criptografia",
|
||||
"vlessAuthX25519": "Autenticação X25519",
|
||||
"vlessAuthMlkem768": "Autenticação ML-KEM-768",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "Personalizado",
|
||||
"vlessAuthSelected": "Selecionado: {auth}",
|
||||
"vlessAuthGenerate": "Gerar chaves",
|
||||
"vlessAuthGenerateButton": "Gerar",
|
||||
"advanced": {
|
||||
"title": "Seções JSON do inbound",
|
||||
"subtitle": "JSON completo do inbound e editores específicos para settings, sniffing e streamSettings.",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "INATIVO",
|
||||
"statusUp": "ATIVO"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "Исключённые домены",
|
||||
"decryption": "Расшифрование",
|
||||
"encryption": "Шифрование",
|
||||
"vlessAuthX25519": "Аутентификация X25519",
|
||||
"vlessAuthMlkem768": "Аутентификация ML-KEM-768",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "Свой",
|
||||
"vlessAuthSelected": "Выбрано: {auth}",
|
||||
"vlessAuthGenerate": "Генерация ключей",
|
||||
"vlessAuthGenerateButton": "Сгенерировать",
|
||||
"advanced": {
|
||||
"title": "Разделы JSON входящего",
|
||||
"subtitle": "Полный JSON входящего и отдельные редакторы для settings, sniffing и streamSettings.",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "НЕДОСТУПЕН",
|
||||
"statusUp": "РАБОТАЕТ"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "Hariç tutulan alan adları",
|
||||
"decryption": "Şifre Çözme",
|
||||
"encryption": "Şifreleme",
|
||||
"vlessAuthX25519": "X25519 Kimlik Doğrulama",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 Kimlik Doğrulama",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "Özel",
|
||||
"vlessAuthSelected": "Seçili: {auth}",
|
||||
"vlessAuthGenerate": "Anahtar oluştur",
|
||||
"vlessAuthGenerateButton": "Oluştur",
|
||||
"advanced": {
|
||||
"title": "Gelen Bağlantı JSON Bölümleri",
|
||||
"subtitle": "Tam gelen bağlantı JSON'u ve settings, sniffing, streamSettings için odaklanmış düzenleyiciler.",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "ÇEVRİMDIŞI",
|
||||
"statusUp": "ÇEVRİMİÇİ"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "Виключені домени",
|
||||
"decryption": "Розшифрування",
|
||||
"encryption": "Шифрування",
|
||||
"vlessAuthX25519": "Автентифікація X25519",
|
||||
"vlessAuthMlkem768": "Автентифікація ML-KEM-768",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "Користувацький",
|
||||
"vlessAuthSelected": "Вибрано: {auth}",
|
||||
"vlessAuthGenerate": "Генерація ключів",
|
||||
"vlessAuthGenerateButton": "Згенерувати",
|
||||
"advanced": {
|
||||
"title": "Розділи JSON вхідного",
|
||||
"subtitle": "Повний JSON вхідного та окремі редактори для settings, sniffing і streamSettings.",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "НЕДОСТУПНО",
|
||||
"statusUp": "ДОСТУПНО"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "Tên miền bị loại trừ",
|
||||
"decryption": "Giải mã",
|
||||
"encryption": "Mã hóa",
|
||||
"vlessAuthX25519": "Xác thực X25519",
|
||||
"vlessAuthMlkem768": "Xác thực ML-KEM-768",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "Tùy chỉnh",
|
||||
"vlessAuthSelected": "Đã chọn: {auth}",
|
||||
"vlessAuthGenerate": "Tạo khóa",
|
||||
"vlessAuthGenerateButton": "Tạo",
|
||||
"advanced": {
|
||||
"title": "Các phần JSON của inbound",
|
||||
"subtitle": "JSON inbound đầy đủ và các trình chỉnh sửa riêng cho settings, sniffing và streamSettings.",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "NGỪNG HOẠT ĐỘNG",
|
||||
"statusUp": "HOẠT ĐỘNG"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "排除的域名",
|
||||
"decryption": "解密",
|
||||
"encryption": "加密",
|
||||
"vlessAuthX25519": "X25519 认证",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 认证",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "自定义",
|
||||
"vlessAuthSelected": "已选择:{auth}",
|
||||
"vlessAuthGenerate": "生成密钥",
|
||||
"vlessAuthGenerateButton": "生成",
|
||||
"advanced": {
|
||||
"title": "入站 JSON 部分",
|
||||
"subtitle": "完整入站 JSON 以及针对 settings、sniffing 和 streamSettings 的专用编辑器。",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "断开",
|
||||
"statusUp": "恢复"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +407,16 @@
|
||||
"sniffingDomainsExcluded": "排除的網域",
|
||||
"decryption": "解密",
|
||||
"encryption": "加密",
|
||||
"vlessAuthX25519": "X25519 認證",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 認證",
|
||||
"vlessAuthX25519": "X25519 (native)",
|
||||
"vlessAuthMlkem768": "ML-KEM-768 (native)",
|
||||
"vlessAuthX25519Xorpub": "X25519 (xorpub)",
|
||||
"vlessAuthX25519Random": "X25519 (random)",
|
||||
"vlessAuthMlkem768Xorpub": "ML-KEM-768 (xorpub)",
|
||||
"vlessAuthMlkem768Random": "ML-KEM-768 (random)",
|
||||
"vlessAuthCustom": "自訂",
|
||||
"vlessAuthSelected": "已選擇:{auth}",
|
||||
"vlessAuthGenerate": "生成密鑰",
|
||||
"vlessAuthGenerateButton": "生成",
|
||||
"advanced": {
|
||||
"title": "入站 JSON 部分",
|
||||
"subtitle": "完整入站 JSON 以及針對 settings、sniffing 和 streamSettings 的專用編輯器。",
|
||||
@@ -2071,4 +2077,4 @@
|
||||
"statusDown": "中斷",
|
||||
"statusUp": "恢復"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user