mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-25 15:25: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:
@@ -206,7 +206,7 @@ func TestGetSubs_PreservesPerInboundWireGuardIdentity(t *testing.T) {
|
||||
rec := &model.ClientRecord{
|
||||
Email: email, SubID: subID, Enable: true,
|
||||
PrivateKey: mergedPriv, AllowedIPs: mergedAddr,
|
||||
PreSharedKey: "sharedpsk", KeepAlive: 25,
|
||||
PreSharedKey: "sharedpsk", KeepAlive: model.KeepAliveValue("25"),
|
||||
}
|
||||
if err := db.Create(rec).Error; err != nil {
|
||||
t.Fatalf("create client: %v", err)
|
||||
@@ -298,7 +298,7 @@ func TestGetSubs_WireGuardUnavailableSettingsEmitNoSharedConfig(t *testing.T) {
|
||||
rec := &model.ClientRecord{
|
||||
Email: email, SubID: subID, Enable: true,
|
||||
PrivateKey: mergedPriv, AllowedIPs: mergedAddr,
|
||||
PreSharedKey: "sharedpsk", KeepAlive: 25,
|
||||
PreSharedKey: "sharedpsk", KeepAlive: model.KeepAliveValue("25"),
|
||||
}
|
||||
if err := db.Create(rec).Error; err != nil {
|
||||
t.Fatalf("create client: %v", err)
|
||||
@@ -358,7 +358,7 @@ func TestGetSubs_WireGuardEmptyOptionalTunnelFieldsDoNotInheritShared(t *testing
|
||||
rec := &model.ClientRecord{
|
||||
Email: email, SubID: subID, Enable: true,
|
||||
PrivateKey: mergedPriv, AllowedIPs: "10.9.9.9/32,fd00:9::9/128",
|
||||
PreSharedKey: "sharedpsk", KeepAlive: 25,
|
||||
PreSharedKey: "sharedpsk", KeepAlive: model.KeepAliveValue("25"),
|
||||
}
|
||||
if err := db.Create(rec).Error; err != nil {
|
||||
t.Fatalf("create client: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user