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:
@@ -13,6 +13,7 @@ import (
|
||||
type walkOverride struct {
|
||||
Field string
|
||||
Kind TypeKind
|
||||
Type TypeRef
|
||||
}
|
||||
|
||||
type packageRequest struct {
|
||||
@@ -122,7 +123,11 @@ func buildFields(fld *ast.Field, overrides []walkOverride) []Field {
|
||||
t := exprToType(fld.Type)
|
||||
for _, o := range overrides {
|
||||
if o.Field == n.Name || o.Field == jsonName {
|
||||
t = TypeRef{Kind: o.Kind}
|
||||
if o.Type.Kind != "" {
|
||||
t = o.Type
|
||||
} else {
|
||||
t = TypeRef{Kind: o.Kind}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -145,7 +150,11 @@ func buildFields(fld *ast.Field, overrides []walkOverride) []Field {
|
||||
t := exprToType(fld.Type)
|
||||
for _, o := range overrides {
|
||||
if o.Field == exprIdentName(fld.Type) || o.Field == jsonName {
|
||||
t = TypeRef{Kind: o.Kind}
|
||||
if o.Type.Kind != "" {
|
||||
t = o.Type
|
||||
} else {
|
||||
t = TypeRef{Kind: o.Kind}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user