add simple wireguard support

This commit is contained in:
Mikaël Cluseau
2025-09-03 16:04:43 +02:00
parent 98eb601fd3
commit 8ae52501c9
6 changed files with 75 additions and 8 deletions

View File

@ -266,6 +266,20 @@ func (ctx *renderContext) TemplateFuncs() map[string]any {
return
},
"wg_key": func(name string) (key string, err error) {
return wgKey(name + "/hosts/" + ctx.Host.Name)
},
"wg_psk": func(name, peerName string) (key string, err error) {
a := ctx.Host.Name
b := peerName
if a > b {
a, b = b, a
}
return wgKey(name + "/psks/" + a + " " + b)
},
"wg_pubkey": func(name, host string) (key string, err error) {
return wgKey(name + "/hosts/" + host)
},
} {
funcs[name] = method
}