Add site contacts/FAQ and accept AWG 2.0 / naive pastes in Add config.
ImportSubscription no longer requires only http(s): paste awg://, AWG .conf/JSON, or naive links; subscription parser also reads hosted AWG and Clash wireguard/naive. Site lists support emails and FAQ; Store listing texts/tools updated. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -87,3 +87,60 @@ func TestSaveProfileKeepsNaiveLink(t *testing.T) {
|
||||
t.Fatalf("naive profile broken: %+v", p)
|
||||
}
|
||||
}
|
||||
|
||||
// «Добавить конфигурацию» must accept pasted AWG 2.0 .conf / naive links,
|
||||
// not only http(s) subscription URLs (regression: "нужен http(s) URL").
|
||||
func TestImportSubscriptionDirectAWGAndNaive(t *testing.T) {
|
||||
m := newTestManager(t)
|
||||
awgBody := `[Interface]
|
||||
PrivateKey = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
Address = 10.8.0.2/32
|
||||
Jc = 4
|
||||
Jmin = 40
|
||||
Jmax = 70
|
||||
H1 = 1
|
||||
H2 = 2
|
||||
H3 = 3
|
||||
H4 = 4
|
||||
|
||||
[Peer]
|
||||
PublicKey = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEE=
|
||||
Endpoint = 203.0.113.10:51820
|
||||
AllowedIPs = 0.0.0.0/0
|
||||
`
|
||||
r, err := m.ImportSubscription(awgBody)
|
||||
if err != nil {
|
||||
t.Fatalf("AWG paste: %v", err)
|
||||
}
|
||||
if r.Imported < 1 {
|
||||
t.Fatalf("AWG imported=%d", r.Imported)
|
||||
}
|
||||
foundAWG := false
|
||||
for _, p := range m.Profiles() {
|
||||
if config.Protocol(p.Protocol) == config.ProtocolAWG && strings.Contains(p.Proxy, "203.0.113.10:51820") {
|
||||
foundAWG = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !foundAWG {
|
||||
t.Fatal("AWG profile missing")
|
||||
}
|
||||
|
||||
r2, err := m.ImportSubscription("https://user:secret@naive.example.com:443#NV")
|
||||
if err != nil {
|
||||
t.Fatalf("naive paste: %v", err)
|
||||
}
|
||||
if r2.Imported < 1 {
|
||||
t.Fatalf("naive imported=%d", r2.Imported)
|
||||
}
|
||||
foundNaive := false
|
||||
for _, p := range m.Profiles() {
|
||||
if config.Protocol(p.Protocol) == config.ProtocolNaive && strings.Contains(p.Proxy, "naive.example.com") {
|
||||
foundNaive = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !foundNaive {
|
||||
t.Fatal("naive profile missing")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user