mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 11:05:45 +00:00
fb420be176
There's never a tailscaled on iOS. And we can't run child processes to look for it anyway. Updates tailscale/corp#20099 Change-Id: Ieb3776f4bb440c4f1c442fdd169bacbe17f23ddb Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
35 lines
692 B
Go
35 lines
692 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build linux || windows || (darwin && !ios) || freebsd
|
|
|
|
package safesocket
|
|
|
|
import (
|
|
"strings"
|
|
|
|
ps "github.com/mitchellh/go-ps"
|
|
)
|
|
|
|
func init() {
|
|
tailscaledProcExists = func() bool {
|
|
procs, err := ps.Processes()
|
|
if err != nil {
|
|
return false
|
|
}
|
|
for _, proc := range procs {
|
|
name := proc.Executable()
|
|
const tailscaled = "tailscaled"
|
|
if len(name) < len(tailscaled) {
|
|
continue
|
|
}
|
|
// Do case insensitive comparison for Windows,
|
|
// notably, and ignore any ".exe" suffix.
|
|
if strings.EqualFold(name[:len(tailscaled)], tailscaled) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
}
|