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:
@@ -124,6 +124,14 @@ inbound. There is no separate toggle for this: unlike a kernel tunnel,
|
||||
there's no other way for a peer's traffic to reach the internet once it's
|
||||
decapsulated.
|
||||
|
||||
## Keepalive ranges
|
||||
|
||||
AmneziaWG clients accept `keepAlive` as a number or an ordered range from 0 to 65535, such as `15-25`. Omitted values keep the existing setting; explicit `0` disables keepalive. Native `.conf` files preserve ranges, while Clash/Mihomo scalar-only output uses the lower bound (`0-25` therefore disables keepalive). Plain WireGuard clients support only a scalar value. Upgrade sub-nodes before sending them range values because older nodes parse keepalive as an integer.
|
||||
|
||||
Parser support is present in the native tools and the panel embedded engine: [the native `awg-tools` v3.1.20260812 config parser](https://github.com/amnezia-vpn/amneziawg-tools/blob/v3.1.20260812/src/config.c#L596-L599) sends `PersistentKeepalive` to its [ordered-range parser](https://github.com/amnezia-vpn/amneziawg-tools/blob/v3.1.20260812/src/type.c#L40-L59), and this panel pins [amneziawg-go v3.1.20260828](https://github.com/amnezia-vpn/amneziawg-go/tree/v3.1.20260828) in `go.mod`; its [UAPI parser](https://github.com/amnezia-vpn/amneziawg-go/blob/v3.1.20260828/device/uapi.go#L663-L674) reads the interval as a `UintRange`. This confirms parser support for these code paths, not interoperability with every third-party client. The panel enforces the documented 0-65535 limit on new values; the native parser's syntax support is not a substitute for that validation.
|
||||
|
||||

|
||||
|
||||
## What the configuration looks like
|
||||
|
||||
A client's downloadable `.conf` (also what the `vpn://` share link encodes,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
@@ -1759,9 +1759,15 @@
|
||||
"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",
|
||||
@@ -1981,7 +1987,15 @@
|
||||
"type": "integer"
|
||||
},
|
||||
"keepAlive": {
|
||||
"type": "integer"
|
||||
"description": "Numeric values or AmneziaWG ranges.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"limitHwid": {
|
||||
"type": "integer"
|
||||
|
||||
Reference in New Issue
Block a user