Documentation
¶
Index ¶
- Constants
- func BoldText(text string) string
- func BoolToCheckbox(b bool) string
- func BoolToStatusColored(b bool) string
- func Colorize(color, text string) string
- func Danger(text string) string
- func DimText(text string) string
- func FormatBiometricCapabilities(result *BiometricCapabilities, format string) string
- func FormatBiometricCapabilitiesTable(result *BiometricCapabilities) string
- func FormatBytes(bytes uint64) string
- func FormatCPUUsage(result *CPUUsageResult, format string) string
- func FormatCPUUsageTable(result *CPUUsageResult) string
- func FormatEncryption(result *EncryptionResult, format string) string
- func FormatEncryptionTable(result *EncryptionResult) string
- func FormatMemory(result *MemoryResult, format string) string
- func FormatMemoryTable(result *MemoryResult) string
- func FormatOutput(data any, tableFunc func() string, format string) string
- func FormatProcessList(result *ProcessListResult, format string) string
- func FormatProcessListTable(result *ProcessListResult) string
- func FormatSecureBoot(result *SecureBootResult, format string) string
- func FormatSecureBootTable(result *SecureBootResult) string
- func FormatSecuritySummary(result *SecuritySummary, format string) string
- func FormatSecuritySummaryTable(result *SecuritySummary) string
- func FormatTPM(result *TPMResult, format string) string
- func FormatTPMTable(result *TPMResult) string
- func Header(text string) string
- func Info(text string) string
- func IsBiometricsSupported() bool
- func IsEncryptionSupported() bool
- func IsSecureBootSupported() bool
- func IsTPMSupported() bool
- func Muted(text string) string
- func PadLeft(s string, width int) string
- func PadRight(s string, width int) string
- func ProgressBar(percent float64, width int) string
- func StripANSI(s string) string
- func Success(text string) string
- func TableBottom(widths ...int) string
- func TableRow(cols ...string) string
- func TableRowColored(cols ...string) string
- func TableSeparator(widths ...int) string
- func TableTop(widths ...int) string
- func UsageColor(percent float64) string
- func VisibleLen(s string) int
- func Warning(text string) string
- type BioSummary
- type BiometricCapabilities
- type BootSummary
- type CPUUsageResult
- type EncSummary
- type EncryptedVolume
- type EncryptionResult
- type MemoryResult
- type ProcessInfo
- type ProcessListResult
- type SecureBootResult
- type SecuritySummary
- type TPMResult
- type TPMSummary
Constants ¶
const ( FormatJSON = "json" FormatTable = "table" )
OutputFormat constants
const ( Reset = "\033[0m" Bold = "\033[1m" Dim = "\033[2m" Italic = "\033[3m" Underline = "\033[4m" // Foreground colors Black = "\033[30m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" // Bright foreground colors BrightBlack = "\033[90m" BrightRed = "\033[91m" BrightGreen = "\033[92m" BrightYellow = "\033[93m" BrightBlue = "\033[94m" BrightMagenta = "\033[95m" BrightCyan = "\033[96m" BrightWhite = "\033[97m" // Background colors BgBlue = "\033[44m" BgCyan = "\033[46m" BgWhite = "\033[47m" )
ANSI color codes
const ( IconCPU = "🖥️ " IconMemory = "💾" IconProcess = "⚙️ " IconCheck = "✓" IconCross = "✗" IconCircle = "●" IconDiamond = "◆" IconArrow = "→" IconBar = "█" IconBarLight = "░" IconBarMed = "▒" IconCore = "◉" IconPID = "⬡" IconStatus = "◈" IconWarning = "⚠️ " IconInfo = "ℹ️ " IconLock = "🔒" IconUnlock = "🔓" IconKey = "🔑" IconShield = "🛡️ " IconFingerprint = "👆" IconFace = "👤" IconApple = "🍎" IconChip = "🔲" )
UTF-8 icons
Variables ¶
This section is empty.
Functions ¶
func BoolToStatusColored ¶
BoolToStatusColored returns a colored status string
func FormatBiometricCapabilities ¶
func FormatBiometricCapabilities(result *BiometricCapabilities, format string) string
FormatBiometricCapabilities formats biometric capabilities in the specified format
func FormatBiometricCapabilitiesTable ¶
func FormatBiometricCapabilitiesTable(result *BiometricCapabilities) string
FormatBiometricCapabilitiesTable formats biometric capabilities as a colored table
func FormatBytes ¶
FormatBytes converts bytes to human-readable format
func FormatCPUUsage ¶
func FormatCPUUsage(result *CPUUsageResult, format string) string
FormatCPUUsage formats CPU usage in the specified format
func FormatCPUUsageTable ¶
func FormatCPUUsageTable(result *CPUUsageResult) string
FormatCPUUsageTable formats CPU usage as a colored table
func FormatEncryption ¶
func FormatEncryption(result *EncryptionResult, format string) string
FormatEncryption formats encryption status in the specified format
func FormatEncryptionTable ¶
func FormatEncryptionTable(result *EncryptionResult) string
FormatEncryptionTable formats encryption status as a colored table
func FormatMemory ¶
func FormatMemory(result *MemoryResult, format string) string
FormatMemory formats memory usage in the specified format
func FormatMemoryTable ¶
func FormatMemoryTable(result *MemoryResult) string
FormatMemoryTable formats memory usage as a colored table
func FormatOutput ¶
FormatOutput returns the result in the requested format (json or table)
func FormatProcessList ¶
func FormatProcessList(result *ProcessListResult, format string) string
FormatProcessList formats process list in the specified format
func FormatProcessListTable ¶
func FormatProcessListTable(result *ProcessListResult) string
FormatProcessListTable formats process list as a colored table
func FormatSecureBoot ¶
func FormatSecureBoot(result *SecureBootResult, format string) string
FormatSecureBoot formats Secure Boot status in the specified format
func FormatSecureBootTable ¶
func FormatSecureBootTable(result *SecureBootResult) string
FormatSecureBootTable formats Secure Boot status as a colored table
func FormatSecuritySummary ¶
func FormatSecuritySummary(result *SecuritySummary, format string) string
FormatSecuritySummary formats security summary in the specified format
func FormatSecuritySummaryTable ¶
func FormatSecuritySummaryTable(result *SecuritySummary) string
FormatSecuritySummaryTable formats security summary as a colored table
func FormatTPMTable ¶
FormatTPMTable formats TPM status as a colored table
func IsBiometricsSupported ¶
func IsBiometricsSupported() bool
IsBiometricsSupported returns true on Linux (fprintd/howdy may be available)
func IsEncryptionSupported ¶
func IsEncryptionSupported() bool
IsEncryptionSupported returns true on Linux
func IsSecureBootSupported ¶
func IsSecureBootSupported() bool
IsSecureBootSupported returns true on Linux
func ProgressBar ¶
ProgressBar creates a colored progress bar
func TableBottom ¶
TableBottom creates a bottom border for tables
func TableRowColored ¶
TableRowColored creates a colored table row
func TableSeparator ¶
TableSeparator creates a separator line for tables
func UsageColor ¶
UsageColor returns the appropriate color based on usage percentage
func VisibleLen ¶
VisibleLen calculates the visible display width of a string (excluding ANSI codes and accounting for wide characters like emojis)
Types ¶
type BioSummary ¶
type BioSummary struct {
Available bool `json:"available"`
Configured bool `json:"configured"`
Type string `json:"type"`
}
BioSummary contains biometrics summary info
type BiometricCapabilities ¶
type BiometricCapabilities struct {
TouchIDAvailable bool `json:"touch_id_available"`
TouchIDEnrolled bool `json:"touch_id_enrolled"`
FaceIDAvailable bool `json:"face_id_available"`
FaceIDEnrolled bool `json:"face_id_enrolled"`
BiometryType string `json:"biometry_type"`
// Linux-specific fields
FprintdAvailable bool `json:"fprintd_available,omitempty"`
FprintdEnrolled bool `json:"fprintd_enrolled,omitempty"`
HowdyAvailable bool `json:"howdy_available,omitempty"`
HowdyConfigured bool `json:"howdy_configured,omitempty"`
Platform string `json:"platform"`
}
BiometricCapabilities contains detailed biometric capability information
func GetBiometricCapabilities ¶
func GetBiometricCapabilities() (*BiometricCapabilities, error)
GetBiometricCapabilities returns biometric capabilities (Linux)
type BootSummary ¶
BootSummary contains Secure Boot summary info
type CPUUsageResult ¶
type CPUUsageResult struct {
UsagePercent float64 `json:"usage_percent"`
PerCore []float64 `json:"per_core"`
}
CPUUsageResult contains CPU usage information
func GetCPUUsage ¶
func GetCPUUsage(ctx context.Context) (*CPUUsageResult, error)
GetCPUUsage returns current CPU usage
type EncSummary ¶
type EncSummary struct {
Enabled bool `json:"enabled"`
Type string `json:"type"`
Status string `json:"status"`
}
EncSummary contains encryption summary info
type EncryptedVolume ¶
type EncryptedVolume struct {
Name string `json:"name"`
MountPoint string `json:"mount_point,omitempty"`
Encrypted bool `json:"encrypted"`
Status string `json:"status"`
}
EncryptedVolume represents an encrypted volume
type EncryptionResult ¶
type EncryptionResult struct {
Enabled bool `json:"enabled"`
Platform string `json:"platform"`
Type string `json:"type"`
Status string `json:"status"`
EncryptedVolumes []EncryptedVolume `json:"encrypted_volumes,omitempty"`
Details string `json:"details,omitempty"`
}
EncryptionResult contains disk encryption status information
func GetEncryptionStatus ¶
func GetEncryptionStatus() (*EncryptionResult, error)
GetEncryptionStatus returns the disk encryption status (Linux - LUKS)
type MemoryResult ¶
type MemoryResult struct {
TotalBytes uint64 `json:"total_bytes"`
UsedBytes uint64 `json:"used_bytes"`
FreeBytes uint64 `json:"free_bytes"`
AvailableBytes uint64 `json:"available_bytes"`
UsedPercent float64 `json:"used_percent"`
TotalHuman string `json:"total_human"`
UsedHuman string `json:"used_human"`
AvailableHuman string `json:"available_human"`
}
MemoryResult contains memory usage information
type ProcessInfo ¶
type ProcessInfo struct {
PID int32 `json:"pid"`
Name string `json:"name"`
CPUPercent float64 `json:"cpu_percent"`
MemoryPercent float32 `json:"memory_percent"`
Status string `json:"status"`
}
ProcessInfo contains information about a single process
type ProcessListResult ¶
type ProcessListResult struct {
Processes []ProcessInfo `json:"processes"`
Total int `json:"total"`
}
ProcessListResult contains the process list result
func ListProcesses ¶
func ListProcesses(ctx context.Context, limit int) (*ProcessListResult, error)
ListProcesses returns a list of running processes
type SecureBootResult ¶
type SecureBootResult struct {
Enabled bool `json:"enabled"`
Platform string `json:"platform"`
Mode string `json:"mode"`
PolicyVersion string `json:"policy_version,omitempty"`
SecureBootType string `json:"secure_boot_type"`
Details string `json:"details,omitempty"`
}
SecureBootResult contains Secure Boot status information
func GetSecureBootStatus ¶
func GetSecureBootStatus() (*SecureBootResult, error)
GetSecureBootStatus returns the Secure Boot status (Linux)
type SecuritySummary ¶
type SecuritySummary struct {
Platform string `json:"platform"`
OverallScore int `json:"overall_score"`
OverallStatus string `json:"overall_status"`
TPM *TPMSummary `json:"tpm"`
SecureBoot *BootSummary `json:"secure_boot"`
Encryption *EncSummary `json:"encryption"`
Biometrics *BioSummary `json:"biometrics"`
Recommendations []string `json:"recommendations,omitempty"`
}
SecuritySummary contains a unified security posture overview
func GetSecuritySummary ¶
func GetSecuritySummary() (*SecuritySummary, error)
GetSecuritySummary returns a unified security posture overview
type TPMResult ¶
type TPMResult struct {
Present bool `json:"present"`
Enabled bool `json:"enabled"`
Version string `json:"version"`
Manufacturer string `json:"manufacturer"`
Type string `json:"type"`
Platform string `json:"platform"`
Capabilities []string `json:"capabilities"`
HardwareKeySupport bool `json:"hardware_key_support"`
}
TPMResult contains TPM status information
func GetTPMStatus ¶
GetTPMStatus returns the TPM status (Linux)
type TPMSummary ¶
type TPMSummary struct {
Present bool `json:"present"`
Enabled bool `json:"enabled"`
Type string `json:"type"`
}
TPMSummary contains TPM summary info