package checker import ( "time" sdk "git.happydns.org/checker-sdk-go/checker" ) var Version = "built-in" func Definition() *sdk.CheckerDefinition { def := &sdk.CheckerDefinition{ ID: "happydeliver", Name: "Outbound deliverability (via happyDeliver)", Version: Version, Availability: sdk.CheckerAvailability{ ApplyToService: true, LimitToServices: []string{"svcs.MXs"}, }, ObservationKeys: []sdk.ObservationKey{ObservationKeyHappyDeliver}, Options: sdk.CheckerOptionsDocumentation{ AdminOpts: []sdk.CheckerOptionDocumentation{ { Id: "happydeliver_url", Type: "string", Label: "happyDeliver instance URL", Description: "Default base URL of the happyDeliver API. Users may override per-domain.", Placeholder: "https://deliver.example.org", }, { Id: "happydeliver_token", Type: "string", Label: "happyDeliver API token", Description: "Default bearer token for the happyDeliver API.", Secret: true, }, }, UserOpts: []sdk.CheckerOptionDocumentation{ { Id: "happydeliver_url", Type: "string", Label: "happyDeliver instance URL (override)", Description: "Override the operator-provided happyDeliver URL.", }, { Id: "happydeliver_token", Type: "string", Label: "happyDeliver API token (override)", Description: "Override the operator-provided happyDeliver token.", Secret: true, }, { Id: "smtp_host", Type: "string", Label: "Sending SMTP host", Description: "Hostname or IP of the submission server used to send the test email.", Required: true, }, { Id: "smtp_port", Type: "number", Label: "Sending SMTP port", Description: "Submission port (typically 587 for STARTTLS, 465 for implicit TLS, 25 for plain).", Default: float64(587), Required: true, }, { Id: "smtp_username", Type: "string", Label: "SMTP username", Description: "Username used to authenticate against the submission server.", }, { Id: "smtp_password", Type: "string", Label: "SMTP password", Description: "Password used to authenticate against the submission server.", Secret: true, }, { Id: "smtp_tls", Type: "string", Label: "TLS mode", Description: "How to negotiate TLS with the submission server.", Choices: []string{"starttls", "tls", "none"}, Default: "starttls", }, { Id: "from_address", Type: "string", Label: "From address", Description: "Address used in the From header of the test email. Must be in the tested domain.", Required: true, }, { Id: "subject_override", Type: "string", Label: "Subject (optional)", Description: "Override the default test subject.", }, { Id: "body_text_override", Type: "string", Label: "Plain-text body (optional)", Textarea: true, Description: "Override the default plain-text body.", }, { Id: "body_html_override", Type: "string", Label: "HTML body (optional)", Textarea: true, Description: "Override the default HTML body.", }, { Id: "wait_timeout", Type: "number", Label: "Wait timeout (s)", Description: "Seconds to wait for happyDeliver to receive and analyse the message.", Default: float64(900), }, { Id: "poll_interval", Type: "number", Label: "Poll interval (s)", Description: "Seconds between status polls. Clamped to [2, 60].", Default: float64(5), }, }, DomainOpts: []sdk.CheckerOptionDocumentation{ { Id: "domain_name", Label: "Domain name", AutoFill: sdk.AutoFillDomainName, }, }, }, Rules: []sdk.CheckRule{ NewSectionRule(SectionOverall, "Overall", 70), NewSectionRule(SectionDNS, "DNS", 70), NewSectionRule(SectionAuthentication, "Authentication (SPF/DKIM/DMARC)", 80), NewSectionRule(SectionSpam, "Spam filters", 70), NewSectionRule(SectionBlacklist, "Blacklists", 90), NewSectionRule(SectionHeader, "Headers", 70), NewSectionRule(SectionContent, "Content", 60), NewLifecycleRule(), }, Interval: &sdk.CheckIntervalSpec{ Min: 1 * time.Hour, Max: 30 * 24 * time.Hour, Default: 7 * 24 * time.Hour, }, HasMetrics: true, } return def }