This repository has been archived on 2026-03-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
greywall/internal/platform/platform.go
2025-12-18 13:14:41 -08:00

35 lines
618 B
Go

// Package platform provides OS detection utilities.
package platform
import "runtime"
// Type represents the detected platform.
type Type string
const (
MacOS Type = "macos"
Linux Type = "linux"
Windows Type = "windows"
Unknown Type = "unknown"
)
// Detect returns the current platform type.
func Detect() Type {
switch runtime.GOOS {
case "darwin":
return MacOS
case "linux":
return Linux
case "windows":
return Windows
default:
return Unknown
}
}
// IsSupported returns true if the platform supports sandboxing.
func IsSupported() bool {
p := Detect()
return p == MacOS || p == Linux
}