26 lines
959 B
Go
26 lines
959 B
Go
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
// Command plugin is the happyDomain plugin entrypoint for the DNSViz checker.
|
|
//
|
|
// It is built as a Go plugin (`go build -buildmode=plugin`) and loaded at
|
|
// runtime by happyDomain.
|
|
package main
|
|
|
|
import (
|
|
dnsviz "git.happydns.org/checker-dnsviz/checker"
|
|
"git.happydns.org/checker-dnsviz/internal/collect"
|
|
sdk "git.happydns.org/checker-sdk-go/checker"
|
|
)
|
|
|
|
// Version is overridden at link time: -ldflags "-X main.Version=1.2.3".
|
|
var Version = "custom-build"
|
|
|
|
// NewCheckerPlugin is the symbol resolved by happyDomain when loading the
|
|
// .so file. It returns the checker definition and the observation provider
|
|
// that the host will register in its global registries.
|
|
func NewCheckerPlugin() (*sdk.CheckerDefinition, sdk.ObservationProvider, error) {
|
|
dnsviz.Version = Version
|
|
col := &collect.Collector{}
|
|
prvd := dnsviz.Provider(col.Collect)
|
|
return prvd.(sdk.CheckerDefinitionProvider).Definition(), prvd, nil
|
|
}
|