ApplyConfig safely configures the device with the given configuration under lock.
(config wgtypes.Config)
| 226 | |
| 227 | // ApplyConfig safely configures the device with the given configuration under lock. |
| 228 | func (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 |
| 241 | func (m *Manager) GetDevice() (*wgtypes.Device, error) { |
no test coverage detected