package checker import ( "time" sdk "git.happydns.org/checker-sdk-go/checker" ) // Version is the checker version reported in CheckerDefinition.Version. var Version = "built-in" // Definition returns the CheckerDefinition for the alias checker. func Definition() *sdk.CheckerDefinition { def := &sdk.CheckerDefinition{ ID: "alias", Name: "CNAME / DNAME / ALIAS chain", Version: Version, Availability: sdk.CheckerAvailability{ ApplyToService: true, ApplyToDomain: true, ApplyToZone: true, LimitToServices: []string{ "svcs.CNAME", "svcs.SpecialCNAME", }, }, ObservationKeys: []sdk.ObservationKey{ObservationKeyAlias}, Options: sdk.CheckerOptionsDocumentation{ UserOpts: []sdk.CheckerOptionDocumentation{ { Id: "maxChainLength", Type: "uint", Label: "Maximum chain length", Description: "Above this number of hops the chain is reported as critical. Most resolvers give up around 8-16.", Default: float64(8), }, { Id: "minTargetTTL", Type: "uint", Label: "Minimum TTL (seconds)", Description: "Hops with a TTL below this threshold are flagged as a warning. Very short TTLs degrade cache performance.", Default: float64(60), }, { Id: "requireResolvableTarget", Type: "bool", Label: "Require resolvable target", Description: "When enabled, a chain whose final target returns no A/AAAA is reported as critical (otherwise a warning).", Default: true, }, { Id: "allowApexCNAME", Type: "bool", Label: "Allow CNAME at apex", Description: "When enabled, a CNAME at a zone apex is only reported as warning. RFC 1912 forbids this, so leaving it off is strongly recommended.", Default: false, }, { Id: "recognizeApexFlattening", Type: "bool", Label: "Recognize ALIAS/ANAME flattening", Description: "When enabled, providers that serve A/AAAA at the apex (ALIAS/ANAME pseudo-records) are reported as informational instead of a coexistence violation.", Default: true, }, }, DomainOpts: []sdk.CheckerOptionDocumentation{ { Id: "domain_name", Label: "Parent domain name", AutoFill: sdk.AutoFillDomainName, }, { Id: "subdomain", Label: "Subdomain", AutoFill: sdk.AutoFillSubdomain, }, }, ServiceOpts: []sdk.CheckerOptionDocumentation{ { Id: "service_type", Label: "Service type", AutoFill: sdk.AutoFillServiceType, }, { Id: "service", Label: "Service", AutoFill: sdk.AutoFillService, }, }, }, Rules: []sdk.CheckRule{ Rule(), }, HasHTMLReport: true, Interval: &sdk.CheckIntervalSpec{ Min: 5 * time.Minute, Max: 24 * time.Hour, Default: 1 * time.Hour, }, } def.BuildRulesInfo() return def }