Files
3x-ui/internal/sub/keepalive.go
T
YoungReckless4 35e09191de 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.
2026-10-24 06:36:49 +02:00

19 lines
414 B
Go

package sub
import (
"strings"
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
)
func keepAliveForScalarExport(client model.Client) (int, bool) {
if client.KeepAlive == nil {
return 0, false
}
if strings.Contains(client.KeepAliveText(), "-") && client.KeepAlive.Validate(true) == nil {
return client.KeepAlive.MinSeconds(), true
}
value := client.KeepAliveSeconds()
return value, value > 0
}