MCPcopy Create free account
hub / github.com/PasarGuard/node / buildAddConfig

Function buildAddConfig

backend/wireguard/user_common.go:20–30  ·  view source on GitHub ↗
(publicKey wgtypes.Key, allowedIPs []net.IPNet, presharedKey *wgtypes.Key)

Source from the content-addressed store, hash-verified

18)
19
20func buildAddConfig(publicKey wgtypes.Key, allowedIPs []net.IPNet, presharedKey *wgtypes.Key) wgtypes.PeerConfig {
21 config := wgtypes.PeerConfig{
22 PublicKey: publicKey,
23 AllowedIPs: allowedIPs,
24 PersistentKeepaliveInterval: keepAlive,
25 }
26 if presharedKey != nil {
27 config.PresharedKey = presharedKey
28 }
29 return config
30}
31
32func buildRemoveConfig(publicKey wgtypes.Key) wgtypes.PeerConfig {
33 return wgtypes.PeerConfig{PublicKey: publicKey, Remove: true}

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected