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

Function buildAddConfigFromPeerInfo

backend/wireguard/user_common.go:182–188  ·  view source on GitHub ↗
(peer *PeerInfo, presharedKey *wgtypes.Key)

Source from the content-addressed store, hash-verified

180}
181
182func buildAddConfigFromPeerInfo(peer *PeerInfo, presharedKey *wgtypes.Key) (wgtypes.PeerConfig, error) {
183 if len(peer.AllowedIPs) == 0 {
184 return wgtypes.PeerConfig{}, fmt.Errorf("peer %s has no allowed IPs", peer.Email)
185 }
186
187 return buildAddConfig(peer.PublicKey, peer.AllowedIPs, presharedKey), nil
188}
189
190func peerIPAllowedOnInterface(peerNet *net.IPNet, ifaceNets []*net.IPNet) bool {
191 if len(ifaceNets) == 0 {

Callers 2

buildSyncDiffMethod · 0.85
buildTargetPeerConfigsFunction · 0.85

Calls 1

buildAddConfigFunction · 0.85

Tested by

no test coverage detected