Documentation
¶
Overview ¶
Package discovery detects HTTP services running on the edge host next to the agent (e.g. Home Assistant). The edges provider pulls the result over the tunnel via the agent's /api/v1/services endpoint and materializes an EdgeService per discovered service. Detectors must never fail the endpoint: every probe/exec error is treated as "not detected".
Index ¶
Constants ¶
const ServiceTypeRunner = "runner"
ServiceTypeRunner is the type of a supervised harness runner. It is not probed for like the other types: the agent supervises the process itself, so the harness plane hands its entries to the services endpoint directly rather than implementing a Detector.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Detector ¶
type Detector interface {
// Name is the detector id, used for logging.
Name() string
// Detect returns the discovered service and true when found. It must not
// return partial results with false, and must never block longer than a
// few seconds.
Detect(ctx context.Context) (*DiscoveredService, bool)
}
Detector probes for one kind of service.
func DefaultDetectors ¶
func DefaultDetectors() []Detector
DefaultDetectors is the built-in detector set. Home Assistant is the first; add more here as new integrations land.
type DiscoveredService ¶
type DiscoveredService struct {
// Name is a human-readable service name (e.g. "home-assistant").
Name string `json:"name"`
// Type is the detector id; it matches an EdgeServiceType value.
Type string `json:"type"`
// Scheme is "http" or "https".
Scheme string `json:"scheme"`
// Port is the loopback port the service listens on.
Port int32 `json:"port"`
// Version is best-effort (e.g. a container image tag).
Version string `json:"version,omitempty"`
// InstallType is how the service is installed: container|core|haos|supervised.
InstallType string `json:"installType,omitempty"`
// Harness names the coding harness when Type is "runner". It is what makes
// the Service name `<edge>-<harness>` rather than `<edge>-runner`, so a
// machine offering both harnesses publishes two distinguishable Services.
Harness string `json:"harness,omitempty"`
// Ready and Reasons carry a supervised service's own readiness, which the
// agent already knows from probing it and the provider would otherwise
// have to rediscover. Only the runner detector sets them.
Ready bool `json:"ready,omitempty"`
Reasons []string `json:"reasons,omitempty"`
}
DiscoveredService is one service the agent found on the host. JSON tags match the wire format the provider's discovery reconciler decodes.