macos

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DoctorChecks = []string{"storage", "memory", "cpu", "descriptors", "services", "updates", "crashes", "restarts", "startup", "apps", "network"}

Functions

func ParseNOFILELimit

func ParseNOFILELimit(data string) (soft, hard uint64, ok bool)

func StandardApplicationRoots added in v0.2.0

func StandardApplicationRoots() []string

Types

type App

type App struct {
	Path           string `json:"path"`
	Name           string `json:"name"`
	BundleID       string `json:"bundle_id,omitempty"`
	Executable     string `json:"executable,omitempty"`
	ExecutablePath string `json:"executable_path,omitempty"`
	Version        string `json:"version,omitempty"`
	MinimumOS      string `json:"minimum_os,omitempty"`
}

type AppScanner added in v0.2.0

type AppScanner struct {
	Runner platform.Runner
	Quick  bool
}

func (AppScanner) Scan added in v0.2.0

func (s AppScanner) Scan(ctx context.Context, roots []string, limit, workers int) (report.Report, error)

type Collector

type Collector struct {
	Runner platform.Runner
	Emit   func(ProgressEvent)
}

func (Collector) Collect

func (c Collector) Collect(ctx context.Context, app App, opts DiagnoseOptions) (report.Report, error)

func (Collector) System

func (c Collector) System(ctx context.Context, top int, privileged bool) (report.Report, error)

type CrashTermination

type CrashTermination = report.CrashTermination

func ParseCrashTermination

func ParseCrashTermination(data []byte, extension string) CrashTermination

type DescriptorSample

type DescriptorSample struct {
	Count  int            `json:"count"`
	ByType map[string]int `json:"by_type"`
	ByPath map[string]int `json:"by_path,omitempty"`
}

func ParseLSOF

func ParseLSOF(data []byte) DescriptorSample

type DiagnoseOptions

type DiagnoseOptions struct {
	Observe     time.Duration
	NoLaunch    bool
	NewInstance bool
	Privileged  bool
}

type Doctor added in v0.3.0

type Doctor struct {
	Runner platform.Runner
	Emit   func(ProgressEvent)
}

func (Doctor) Inspect added in v0.3.0

func (d Doctor) Inspect(ctx context.Context, opts DoctorOptions) (report.Report, error)

type DoctorOptions added in v0.3.0

type DoctorOptions struct {
	Only []string
	Skip []string
}

type LogSummary

type LogSummary struct {
	EMFILE                  int `json:"emfile"`
	ENFILE                  int `json:"enfile"`
	SecStaticCode           int `json:"sec_static_code"`
	SyspolicydEMFILE        int `json:"syspolicyd_emfile"`
	SyspolicydENFILE        int `json:"syspolicyd_enfile"`
	SyspolicydSecStaticCode int `json:"syspolicyd_sec_static_code"`
	SyspolicydWedgeSequence int `json:"syspolicyd_wedge_sequence"`
	Signature               int `json:"signature_errors"`
	Gatekeeper              int `json:"gatekeeper_errors"`
	Notarization            int `json:"notarization_errors"`
	XProtect                int `json:"xprotect"`
	LaunchServices          int `json:"launch_services"`
	Terminations            int `json:"terminations"`
	MissingLibrary          int `json:"missing_library"`
}

func ParseLogEvents

func ParseLogEvents(data []byte) LogSummary

type NetworkInspector added in v0.3.0

type NetworkInspector struct {
	Runner platform.Runner
}

func (NetworkInspector) Inspect added in v0.3.0

func (n NetworkInspector) Inspect(ctx context.Context, target string) (report.Report, error)

type PermissionInspector added in v0.2.0

type PermissionInspector struct {
	Runner platform.Runner
}

func (PermissionInspector) Inspect added in v0.2.0

func (p PermissionInspector) Inspect(ctx context.Context, app App, lookback time.Duration) (report.Report, error)

type ProcessDescriptorCount

type ProcessDescriptorCount struct {
	PID     int    `json:"pid"`
	Command string `json:"command"`
	Count   int    `json:"count"`
}

func ParseProcessDescriptorCounts

func ParseProcessDescriptorCounts(data []byte) []ProcessDescriptorCount

type ProcessInspector added in v0.2.0

type ProcessInspector struct {
	Runner platform.Runner
}

func (ProcessInspector) Inspect added in v0.2.0

func (p ProcessInspector) Inspect(ctx context.Context, target string, thresholds ProcessThresholds) (report.Report, error)

func (ProcessInspector) Sample added in v0.2.0

func (p ProcessInspector) Sample(ctx context.Context, pid int, path string) error

type ProcessThresholds added in v0.2.0

type ProcessThresholds struct {
	CPUPercent  float64
	MemoryBytes uint64
}

type ProgressEvent

type ProgressEvent struct {
	ID       string
	Label    string
	Status   string
	Duration time.Duration
}

type ResolveError

type ResolveError struct {
	Code  string
	Input string
	Err   error
}

func (*ResolveError) Error

func (e *ResolveError) Error() string

func (*ResolveError) Unwrap

func (e *ResolveError) Unwrap() error

type Resolver

type Resolver struct {
	Runner      platform.Runner
	SearchRoots []string
}

func (Resolver) Resolve

func (r Resolver) Resolve(ctx context.Context, input string) ([]App, error)

type WatchEvent

type WatchEvent struct {
	SchemaVersion     string          `json:"schema_version"`
	Type              string          `json:"type"`
	Timestamp         time.Time       `json:"timestamp"`
	Target            string          `json:"target"`
	PID               int             `json:"pid,omitempty"`
	DescriptorCount   int             `json:"descriptor_count,omitempty"`
	Growth            int             `json:"growth,omitempty"`
	GrowthRate        float64         `json:"growth_per_second,omitempty"`
	WindowSeconds     int             `json:"window_seconds,omitempty"`
	Severity          report.Severity `json:"severity"`
	Message           string          `json:"message"`
	ByType            map[string]int  `json:"by_type,omitempty"`
	ByPath            map[string]int  `json:"by_path,omitempty"`
	CPUPercent        float64         `json:"cpu_percent,omitempty"`
	RSSBytes          uint64          `json:"rss_bytes,omitempty"`
	Threads           int             `json:"threads,omitempty"`
	SocketCount       int             `json:"socket_count,omitempty"`
	DiskReadBytes     uint64          `json:"disk_read_bytes,omitempty"`
	DiskWriteBytes    uint64          `json:"disk_write_bytes,omitempty"`
	MemoryFreePercent float64         `json:"memory_free_percent,omitempty"`
	RestartCount      int             `json:"restart_count,omitempty"`
}

type WatchOptions

type WatchOptions struct {
	Target       string
	Interval     time.Duration
	Window       time.Duration
	WarnGrowth   int
	Duration     time.Duration
	IncludePaths bool
	Thresholds   diagnosis.ResourceThresholds
}

type Watcher

type Watcher struct {
	Runner platform.Runner
	Now    func() time.Time
}

func (Watcher) Run

func (w Watcher) Run(ctx context.Context, opts WatchOptions, emit func(WatchEvent) error) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL