paths: socket path can be configured from environment variable "TS_SOCKET"

Signed-off-by: Maximilian Pachl <m@ximilian.info>
pull/7538/head
Maximilian Pachl 2023-03-12 14:26:15 +01:00
parent 958c89470b
commit ea704ec877
No known key found for this signature in database
GPG Key ID: 64E9E31489BD9420
1 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,11 @@ var AppSharedDir syncs.AtomicValue[string]
// DefaultTailscaledSocket returns the path to the tailscaled Unix socket
// or the empty string if there's no reasonable default.
func DefaultTailscaledSocket() string {
envSocket := os.Getenv("TS_SOCKET")
if envSocket != "" {
return envSocket
}
if runtime.GOOS == "windows" {
return `\\.\pipe\ProtectedPrefix\Administrators\Tailscale\tailscaled`
}