fea: support age timer for knock

This commit is contained in:
Daniel Ding
2024-01-02 15:53:19 +08:00
parent 1af91f2f65
commit 77fa149380
8 changed files with 156 additions and 56 deletions

11
pkg/cache/openvpn.go vendored
View File

@@ -157,6 +157,17 @@ func (o *vpnClient) List(name string) <-chan *schema.VPNClient {
return c
}
func (o *vpnClient) Get(name, user string) *schema.VPNClient {
username := user + "@" + name
clients := o.readStatus(name)
for _, client := range clients {
if client.Name == username {
return client
}
}
return nil
}
func (o *vpnClient) clientFile(name string) string {
files, _ := filepath.Glob(o.Dir(name, "*client.ovpn"))
if len(files) > 0 {