diff --git a/clients/clients.go b/clients/clients.go index 4779915..b2dca47 100644 --- a/clients/clients.go +++ b/clients/clients.go @@ -477,6 +477,8 @@ func (s *WireGuardService) handleConfig(msg websocket.WSMessage) { // Ensure the WireGuard interface and peers are configured if err := s.ensureWireguardInterface(config); err != nil { logger.Error("Failed to ensure WireGuard interface: %v", err) + logger.Error("Clients functionality will be disabled until the interface can be created") + return } if err := s.ensureWireguardPeers(config.Peers); err != nil { @@ -652,6 +654,11 @@ func (s *WireGuardService) ensureWireguardPeers(peers []Peer) error { // For netstack, we need to manage peers differently // We'll configure peers directly on the device using IPC + // Check if device is initialized + if s.device == nil { + return fmt.Errorf("WireGuard device is not initialized") + } + // First, clear all existing peers by getting current config and removing them currentConfig, err := s.device.IpcGet() if err != nil {