ApplyPeers applies a batch of peer configurations in a single kernel call.
(peers []wgtypes.PeerConfig)
| 195 | |
| 196 | // ApplyPeers applies a batch of peer configurations in a single kernel call. |
| 197 | func (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. |
| 213 | func (m *Manager) ApplyPeersReplaceAll(peers []wgtypes.PeerConfig) error { |
no test coverage detected