//go:build standalone package checker import ( "errors" "net/http" "strings" sdk "git.happydns.org/checker-sdk-go/checker" ) func (p *aliasProvider) RenderForm() []sdk.CheckerOptionField { return []sdk.CheckerOptionField{ { Id: "name", Type: "string", Label: "Domain name to check", Placeholder: "alias.example.com", Required: true, Description: "Fully-qualified name carrying (or suspected of carrying) a CNAME / DNAME / ALIAS record.", }, } } func (p *aliasProvider) ParseForm(r *http.Request) (sdk.CheckerOptions, error) { name := strings.TrimSpace(r.FormValue("name")) if name == "" { return nil, errors.New("name is required") } name = strings.TrimSuffix(name, ".") // Split into subdomain + domain_name so rules autoscoping on domain_name // still work; the collector accepts either representation. parts := strings.SplitN(name, ".", 2) sub := parts[0] parent := "" if len(parts) == 2 { parent = parts[1] } else { parent = name sub = "" } return sdk.CheckerOptions{ "domain_name": parent, "subdomain": sub, }, nil }