summaryrefslogtreecommitdiff
path: root/internal/wireguard
diff options
context:
space:
mode:
Diffstat (limited to 'internal/wireguard')
-rw-r--r--internal/wireguard/wireguard.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/wireguard/wireguard.go b/internal/wireguard/wireguard.go
index 45e6292..0c341f2 100644
--- a/internal/wireguard/wireguard.go
+++ b/internal/wireguard/wireguard.go
@@ -25,9 +25,9 @@ import (
// Tunnel represents an active Userspace WireGuard tunnel inside a network namespace.
type Tunnel struct {
- Device *device.Device
- Tun tun.Device
- dnsFile string
+ Device *device.Device
+ Tun tun.Device
+ dnsFile string
}
// StartTunnel creates a TUN device, launches wireguard-go over it, and configures IPs/routes.
@@ -108,7 +108,9 @@ func StartTunnel(pm *paths.PathManager, profile string, cfg *wgconf.Config, dnsS
} else {
dnsFile = path
cleanups = append(cleanups, func() {
- UnmountResolvConf(dnsFile)
+ if err := UnmountResolvConf(dnsFile); err != nil {
+ fmt.Printf("warning: failed to unmount resolv.conf during cleanup: %v\n", err)
+ }
})
}
@@ -243,7 +245,7 @@ func ConfigureResolvConf(dns string, profileDir string) (string, error) {
if dns == "" {
return "", nil
}
-
+
// Create the temporary resolv.conf file within the profile directory
// so it can be cleaned up during namespace unpinning.
tmpFile, err := os.CreateTemp(profileDir, "resolvconf")
@@ -274,8 +276,6 @@ func UnmountResolvConf(path string) error {
return nil
}
- fmt.Printf("DEBUG: Unmounting resolv.conf file: %s\n", path)
-
// Attempt to unmount. If it fails, it might already be unmounted
// or the namespace might be gone.
_ = unix.Unmount("/etc/resolv.conf", unix.MNT_DETACH)
@@ -335,7 +335,7 @@ func (h *HostBind) Close() error { return ni
func (h *HostBind) SetMark(mark uint32) error { return nil }
func (h *HostBind) Send(bufs [][]byte, endpoint conn.Endpoint) error { return nil }
func (h *HostBind) ParseEndpoint(s string) (conn.Endpoint, error) { return nil, nil }
-func (h *HostBind) BatchSize() int { return 0}
+func (h *HostBind) BatchSize() int { return 0 }
type FDBind struct {
originalFd int