From adbd9677c8df800c01a595e8d73765b8bd65d5c6 Mon Sep 17 00:00:00 2001 From: Daniyar Ennanov <21172041+limeflash@users.noreply.github.com> Date: Tue, 1 Dec 2026 03:35:00 +0300 Subject: [PATCH] VLESS: tests that the ios and edge fingerprints reach the Xray config as given Co-Authored-By: Claude Fable 5.2 --- core/internal/profile/vless_test.go | 15 +++++++++++++++ core/internal/xray/config_test.go | 21 +++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/core/internal/profile/vless_test.go b/core/internal/profile/vless_test.go index 2df0f15..81a8755 100644 --- a/core/internal/profile/vless_test.go +++ b/core/internal/profile/vless_test.go @@ -194,3 +194,18 @@ func TestPickWithVLESS(t *testing.T) { t.Fatalf("Others in a vless round = %#v", others) } } + +// The subscription names "ios" and "edge" among the hellos; both pass through as given, for REALITY and for TLS. +func TestParseVLESSKeepsIOSAndEdgeFingerprints(t *testing.T) { + for _, fp := range []string{"ios", "edge"} { + for name, base := range map[string]map[string]any{"reality": realityVision(), "tls": tlsWS()} { + p, err := ParseVLESS(vlessSettings(t, base, map[string]any{"fingerprint": fp})) + if err != nil { + t.Fatalf("%s %s: %v", name, fp, err) + } + if p.Fingerprint != fp { + t.Errorf("%s %s = %q", name, fp, p.Fingerprint) + } + } + } +} diff --git a/core/internal/xray/config_test.go b/core/internal/xray/config_test.go index bbb5846..ce95f6d 100644 --- a/core/internal/xray/config_test.go +++ b/core/internal/xray/config_test.go @@ -224,3 +224,24 @@ func TestStreamConfigXMux(t *testing.T) { t.Errorf("concurrency and connections 0 = %v", x) } } + +// "ios" and "edge" reach Xray's config unchanged for REALITY and for TLS, and Xray knows both as uTLS presets. +func TestStreamConfigKeepsIOSAndEdgeFingerprints(t *testing.T) { + for _, fp := range []string{"ios", "edge"} { + if tls.GetFingerprint(fp) == nil { + t.Fatalf("Xray has no preset %q", fp) + } + p := sample("reality", "raw") + p.Fingerprint = fp + security, _ := streamOf(t, p).SecuritySettings[0].GetInstance() + if got := security.(*reality.Config).Fingerprint; got != fp { + t.Errorf("reality %s = %q", fp, got) + } + p = sample("tls", "ws") + p.Fingerprint = fp + security, _ = streamOf(t, p).SecuritySettings[0].GetInstance() + if got := security.(*tls.Config).Fingerprint; got != fp { + t.Errorf("tls %s = %q", fp, got) + } + } +}