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

Method ApplyPeers

backend/wireguard/manager.go:197–210  ·  view source on GitHub ↗

ApplyPeers applies a batch of peer configurations in a single kernel call.

(peers []wgtypes.PeerConfig)

Source from the content-addressed store, hash-verified

195
196// ApplyPeers applies a batch of peer configurations in a single kernel call.
197func (m *Manager) ApplyPeers(peers []wgtypes.PeerConfig) error {
198 if len(peers) == 0 {
199 return nil
200 }
201
202 m.mu.Lock()
203 defer m.mu.Unlock()
204
205 if m.client == nil {
206 return fmt.Errorf("wgctrl client is not initialized")
207 }
208
209 return m.client.ConfigureDevice(m.iFaceName, wgtypes.Config{Peers: peers})
210}
211
212// ApplyPeersReplaceAll applies peers as an authoritative full snapshot in a single kernel call.
213func (m *Manager) ApplyPeersReplaceAll(peers []wgtypes.PeerConfig) error {

Callers 1

Calls 1

ConfigureDeviceMethod · 0.65

Tested by

no test coverage detected