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:
YoungReckless4
2026-10-24 07:36:49 +03:00
committed by GitHub
parent 207c705300
commit 35e09191de
59 changed files with 1871 additions and 146 deletions
+1 -1
View File
@@ -424,7 +424,7 @@ export const EXAMPLES: Record<string, unknown> = {
"forwardedPorts": "",
"group": "",
"id": "",
"keepAlive": null,
"keepAlive": 0,
"limitIp": 0,
"password": "",
"preSharedKey": "",
+18 -4
View File
@@ -1733,9 +1733,15 @@ export const SCHEMAS: Record<string, unknown> = {
"type": "string"
},
"keepAlive": {
"description": "Seconds between PersistentKeepalive packets; 0 sends none, omit to keep the stored value",
"nullable": true,
"type": "integer"
"description": "Numeric values or AmneziaWG ranges; 0 disables, omission preserves.",
"oneOf": [
{
"type": "integer"
},
{
"type": "string"
}
]
},
"limitIp": {
"description": "IP limit for this client",
@@ -1955,7 +1961,15 @@ export const SCHEMAS: Record<string, unknown> = {
"type": "integer"
},
"keepAlive": {
"type": "integer"
"description": "Numeric values or AmneziaWG ranges.",
"oneOf": [
{
"type": "integer"
},
{
"type": "string"
}
]
},
"limitHwid": {
"type": "integer"
+2 -2
View File
@@ -420,7 +420,7 @@ export interface Client {
forwardedPorts?: string;
group?: string;
id?: string;
keepAlive?: number | null;
keepAlive?: number | string;
limitIp: number;
password?: string;
preSharedKey?: string;
@@ -471,7 +471,7 @@ export interface ClientRecord {
forwardedPorts: string;
group: string;
id: number;
keepAlive: number;
keepAlive: number | string;
limitHwid: number;
limitIp: number;
password: string;
+2 -2
View File
@@ -441,7 +441,7 @@ export const ClientSchema = z.object({
forwardedPorts: z.string().optional(),
group: z.string().optional(),
id: z.string().optional(),
keepAlive: z.number().int().nullable().optional(),
keepAlive: z.union([z.number().int(), z.string()]).optional(),
limitIp: z.number().int(),
password: z.string().optional(),
preSharedKey: z.string().optional(),
@@ -495,7 +495,7 @@ export const ClientRecordSchema = z.object({
forwardedPorts: z.string(),
group: z.string(),
id: z.number().int(),
keepAlive: z.number().int(),
keepAlive: z.union([z.number().int(), z.string()]),
limitHwid: z.number().int(),
limitIp: z.number().int(),
password: z.string(),