From 5b5b09b1edcf567ae929631ee8faad2371a68af0 Mon Sep 17 00:00:00 2001 From: Lanius-collaris <55432068+Lanius-collaris@users.noreply.github.com> Date: Fri, 21 Feb 2025 13:41:19 +0800 Subject: [PATCH] ipc: add a API to set socketDirectory The same app installed in Android work profile will use a different cache directory, so I have to allow socketDirectory to be modified at runtime. --- ipc/uapi_unix.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ipc/uapi_unix.go b/ipc/uapi_unix.go index 0da452a..07b26c3 100644 --- a/ipc/uapi_unix.go +++ b/ipc/uapi_unix.go @@ -27,6 +27,10 @@ const ( // socketDirectory is variable because it is modified by a linker // flag in wireguard-android. var socketDirectory = "/var/run/amneziawg" +// For android work profile +func SetSocketDirectory(directory string) { + socketDirectory = directory +} func sockPath(iface string) string { return fmt.Sprintf("%s/%s.sock", socketDirectory, iface)