Permalink
Checking mergeability…
Don’t worry, you can still create the pull request.
Comparing changes
Open a pull request
- 2 commits
- 2 files changed
- 0 commit comments
- 1 contributor
Unified
Split
Showing
with
20 additions
and 4 deletions.
- +10 −2 uapi_bsd.go
- +10 −2 uapi_linux.go
| @@ -17,8 +17,6 @@ import ( | |||
| "unsafe" | |||
| ) | |||
|
|
|||
| var socketDirectory = "/var/run/wireguard" | |||
|
|
|||
| const ( | |||
| ipcErrorIO = -int64(unix.EIO) | |||
| ipcErrorProtocol = -int64(unix.EPROTO) | |||
| @@ -66,6 +64,11 @@ func (l *UAPIListener) Addr() net.Addr { | |||
|
|
|||
| func UAPIListen(name string, file *os.File) (net.Listener, error) { | |||
|
|
|||
| socketDirectory := os.Getenv("WG_SOCKET_DIR") | |||
| if socketDirectory == "" { | |||
| socketDirectory = "/var/run/wireguard" | |||
| } | |||
|
|
|||
| // wrap file in listener | |||
|
|
|||
| listener, err := net.FileListener(file) | |||
| @@ -148,6 +151,11 @@ func UAPIListen(name string, file *os.File) (net.Listener, error) { | |||
|
|
|||
| func UAPIOpen(name string) (*os.File, error) { | |||
|
|
|||
| socketDirectory := os.Getenv("WG_SOCKET_DIR") | |||
| if socketDirectory == "" { | |||
| socketDirectory = "/var/run/wireguard" | |||
| } | |||
|
|
|||
| // check if path exist | |||
|
|
|||
| err := os.MkdirAll(socketDirectory, 0755) | |||
| @@ -15,8 +15,6 @@ import ( | |||
| "path" | |||
| ) | |||
|
|
|||
| var socketDirectory = "/var/run/wireguard" | |||
|
|
|||
| const ( | |||
| ipcErrorIO = -int64(unix.EIO) | |||
| ipcErrorProtocol = -int64(unix.EPROTO) | |||
| @@ -64,6 +62,11 @@ func (l *UAPIListener) Addr() net.Addr { | |||
|
|
|||
| func UAPIListen(name string, file *os.File) (net.Listener, error) { | |||
|
|
|||
| socketDirectory := os.Getenv("WG_SOCKET_DIR") | |||
| if socketDirectory == "" { | |||
| socketDirectory = "/var/run/wireguard" | |||
| } | |||
|
|
|||
| // wrap file in listener | |||
|
|
|||
| listener, err := net.FileListener(file) | |||
| @@ -145,6 +148,11 @@ func UAPIListen(name string, file *os.File) (net.Listener, error) { | |||
|
|
|||
| func UAPIOpen(name string) (*os.File, error) { | |||
|
|
|||
| socketDirectory := os.Getenv("WG_SOCKET_DIR") | |||
| if socketDirectory == "" { | |||
| socketDirectory = "/var/run/wireguard" | |||
| } | |||
|
|
|||
| // check if path exist | |||
|
|
|||
| err := os.MkdirAll(socketDirectory, 0755) | |||