Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions internal/wguser/conn_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ func dial(device string) (net.Conn, error) {

// find is the default implementation of Client.find.
func find() ([]string, error) {
return findUNIXSockets([]string{
paths := []string{
// It seems that /var/run is a common location between Linux and the
// BSDs, even though it's a symlink on Linux.
"/var/run/wireguard",
})
}
altPaths, err := altSockPaths()
if err != nil {
return nil, err
}
paths = append(paths, altPaths...)

return findUNIXSockets(paths)
}

// findUNIXSockets looks for UNIX socket files in the specified directories.
Expand Down
19 changes: 19 additions & 0 deletions internal/wguser/sockpath_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//go:build darwin

package wguser

import (
"os"
"path/filepath"
)

const NET_EXT_APP_ID = "com.wireguard.macos.network-extension"

func altSockPaths() ([]string, error) {
homeDir, err := os.UserHomeDir()
if err != nil {
return nil, err
}
path := filepath.Join(homeDir, "Library", "Containers", NET_EXT_APP_ID, "Data")
return []string{path}, nil
}
7 changes: 7 additions & 0 deletions internal/wguser/sockpath_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build !darwin && !windows

package wguser

func altSockPaths() ([]string, error) {
return nil, nil
}