mirror of
https://github.com/fosrl/newt.git
synced 2026-02-08 05:56:40 +00:00
@@ -477,6 +477,8 @@ func (s *WireGuardService) handleConfig(msg websocket.WSMessage) {
|
|||||||
// Ensure the WireGuard interface and peers are configured
|
// Ensure the WireGuard interface and peers are configured
|
||||||
if err := s.ensureWireguardInterface(config); err != nil {
|
if err := s.ensureWireguardInterface(config); err != nil {
|
||||||
logger.Error("Failed to ensure WireGuard interface: %v", err)
|
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 {
|
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
|
// For netstack, we need to manage peers differently
|
||||||
// We'll configure peers directly on the device using IPC
|
// 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
|
// First, clear all existing peers by getting current config and removing them
|
||||||
currentConfig, err := s.device.IpcGet()
|
currentConfig, err := s.device.IpcGet()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user