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.
This commit is contained in:
Lanius-collaris 2025-02-21 13:41:19 +08:00
parent e3f1273f8a
commit 5b5b09b1ed

View file

@ -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)