mirror of
https://github.com/tailscale/tailscale.git
synced 2026-05-08 21:56:48 +02:00
wip
Co-authored-by: Andrea Gottardo <andrea@tailscale.com>
This commit is contained in:
parent
0d8033fd83
commit
e582d148bd
11
mdm/mdm.go
11
mdm/mdm.go
@ -9,9 +9,18 @@ import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
|
||||
"tailscale.com/version"
|
||||
)
|
||||
|
||||
// MDMSettings gets MDM settings from device.
|
||||
type MDMSettings interface {
|
||||
// ReadBool returns a boolean whether the given MDM key exists or not on device settings.
|
||||
ReadBool(key string) (bool, error)
|
||||
// ReadString reads the MDM settings value string given the key.
|
||||
ReadString(key string) (string, error)
|
||||
}
|
||||
|
||||
func ReadBool(key string) (bool, error) {
|
||||
if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
|
||||
return readUserDefaultsBool(key)
|
||||
@ -48,7 +57,7 @@ func readUserDefaultsBool(key string) (bool, error) {
|
||||
} else if asString == "1" {
|
||||
return true, nil
|
||||
} else {
|
||||
return false, fmt.Errorf("unexpected user defaults value for", key, ":", err)
|
||||
return false, fmt.Errorf("unexpected user defaults value for %v: %v", key, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user