core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package core coordinates detection probes and merges their results.

Index

Constants

View Source
const (
	// DefaultTimeout bounds a run. The overall budget is generous enough that a healthy
	// desktop never approaches it, and the per-probe budget is short enough
	// that a single unresponsive server costs a fraction of a second rather
	// than the lot.
	DefaultTimeout = 2 * time.Second
	// DefaultProbeTimeout bounds each individual detection probe.
	DefaultProbeTimeout = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config = schema.Config[domain.Section]

Config controls a detection run.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig is the configuration used when the caller supplies no options.

func NewConfig

func NewConfig(opts ...Option) Config

NewConfig applies opts to the defaults. It is separate from New because the caller needs the effective configuration in order to decide which adapters to construct in the first place.

type Deps

Deps are the adapters an Engine runs. Every field may be nil, in which case the corresponding data is simply left unset.

type Engine

type Engine = Func[*domain.Environment]

Engine runs a configured set of probes.

func New

func New(deps *Deps, cfg *Config) *Engine

New returns an Engine wired to deps.

type Func

type Func[T any] func(ctx context.Context) (T, error)

Func delegates the probe to its configured function.

func (Func[T]) Detect

func (run Func[T]) Detect(ctx context.Context) (T, error)

Detect delegates to the configured function.

type Option

type Option func(*Config)

Option mutates a Config.

func WithNativeGL

func WithNativeGL() Option

WithNativeGL enables the dlopen graphics probe.

func WithProbeTimeout

func WithProbeTimeout(d time.Duration) Option

WithProbeTimeout bounds each individual probe.

func WithProcessScan

func WithProcessScan() Option

WithProcessScan enables the /proc compositor fallback.

func WithSections

func WithSections(s domain.Section) Option

WithSections selects which parts of the Environment to populate.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout bounds the whole detection run.

Jump to

Keyboard shortcuts

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