mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-25 07:15:01 +03:00
feat(amneziawg): support persistent keepalive ranges (#6881)
AmneziaWG clients accept a randomised PersistentKeepalive range such as 15-25, which makes keepalive timing harder to fingerprint; the panel only stored a single number. A client's keepalive may now be a range, validated the way AmneziaWG parses it. The downloadable .conf and vpn:// profile carry the range, Clash/Mihomo output gets its lower bound, and plain WireGuard stays scalar-only. The range lives in an additive wg_keep_alive_range column, so the integer column and an older panel binary keep working after a rollback.
This commit is contained in:
@@ -70,8 +70,8 @@ func TestUpdateCanClearKeepAliveOnAnExistingClient(t *testing.T) {
|
||||
if got := inboundKeepAlive(t, inboundSvc, ib.Id, "ka@x"); got != 0 {
|
||||
t.Fatalf("inbound keepAlive after an explicit 0 = %d, want 0", got)
|
||||
}
|
||||
if got := lookupClientRecord(t, "ka@x").KeepAlive; got != 0 {
|
||||
t.Fatalf("stored wg_keep_alive after an explicit 0 = %d, want 0", got)
|
||||
if got := lookupClientRecord(t, "ka@x").KeepAlive.String(); got != "0" {
|
||||
t.Fatalf("stored wg_keep_alive after an explicit 0 = %s, want 0", got)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ func TestUpdateWithoutKeepAlivePreservesTheStoredValue(t *testing.T) {
|
||||
if got := inboundKeepAlive(t, inboundSvc, ib.Id, "ka@x"); got != 25 {
|
||||
t.Fatalf("inbound keepAlive after an edit that omitted it = %d, want 25", got)
|
||||
}
|
||||
if got := lookupClientRecord(t, "ka@x").KeepAlive; got != 25 {
|
||||
t.Fatalf("stored wg_keep_alive after an edit that omitted it = %d, want 25", got)
|
||||
if got := lookupClientRecord(t, "ka@x").KeepAlive.String(); got != "25" {
|
||||
t.Fatalf("stored wg_keep_alive after an edit that omitted it = %s, want 25", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user