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

Method ApplyConfig

backend/wireguard/manager.go:228–238  ·  view source on GitHub ↗

ApplyConfig safely configures the device with the given configuration under lock.

(config wgtypes.Config)

Source from the content-addressed store, hash-verified

226
227// ApplyConfig safely configures the device with the given configuration under lock.
228func (m *Manager) ApplyConfig(config wgtypes.Config) error {
229 m.mu.Lock()
230 defer m.mu.Unlock()
231
232 if m.client == nil {
233 return fmt.Errorf("wgctrl client is not initialized")
234 }
235
236 configure := m.getConfigureDevice()
237 return configure(m.client, m.iFaceName, config)
238}
239
240// GetDevice returns the current WireGuard device statistics
241func (m *Manager) GetDevice() (*wgtypes.Device, error) {

Callers 1

restartLockedMethod · 0.80

Calls 1

getConfigureDeviceMethod · 0.95

Tested by

no test coverage detected