DefaultTailscaledSocket returns the path to the tailscaled Unix socket or the empty string if there's no reasonable default.
()
| 22 | // DefaultTailscaledSocket returns the path to the tailscaled Unix socket |
| 23 | // or the empty string if there's no reasonable default. |
| 24 | func DefaultTailscaledSocket() string { |
| 25 | if runtime.GOOS == "windows" { |
| 26 | return `\\.\pipe\ProtectedPrefix\Administrators\Tailscale\tailscaled` |
| 27 | } |
| 28 | if runtime.GOOS == "darwin" { |
| 29 | return "/var/run/tailscaled.socket" |
| 30 | } |
| 31 | if runtime.GOOS == "plan9" { |
| 32 | return "/srv/tailscaled.sock" |
| 33 | } |
| 34 | switch distro.Get() { |
| 35 | case distro.Synology: |
| 36 | if distro.DSMVersion() == 6 { |
| 37 | return "/var/packages/Tailscale/etc/tailscaled.sock" |
| 38 | } |
| 39 | // DSM 7 (and higher? or failure to detect.) |
| 40 | return "/var/packages/Tailscale/var/tailscaled.sock" |
| 41 | case distro.Gokrazy: |
| 42 | return "/perm/tailscaled/tailscaled.sock" |
| 43 | case distro.QNAP: |
| 44 | return "/tmp/tailscale/tailscaled.sock" |
| 45 | } |
| 46 | if fi, err := os.Stat("/var/run"); err == nil && fi.IsDir() { |
| 47 | return "/var/run/tailscale/tailscaled.sock" |
| 48 | } |
| 49 | return "tailscaled.sock" |
| 50 | } |
| 51 | |
| 52 | // Overridden in init by OS-specific files. |
| 53 | var ( |
no test coverage detected
searching dependent graphs…