Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmailCheck ¶
func EmailCheck() string
func FormatMailReport ¶
func FormatMailReport(report MailReport) string
FormatMailReport renders the structured result in the compact table used by the standalone command. JSON callers should encode MailReport directly.
Types ¶
type Dialer ¶
type Dialer interface {
DialContext(ctx context.Context, network, address string) (net.Conn, error)
}
Dialer is the minimal transport dependency needed by CheckMail.
type EndpointKind ¶
type EndpointKind string
EndpointKind identifies the distinct mail capabilities reported by the checker. In particular, local listen and outbound SMTP are separate tests.
const ( KindLocalListen EndpointKind = "local_listen" KindOutboundSMTP25 EndpointKind = "outbound_smtp25" KindMXSMTP25 EndpointKind = "mx_smtp25" KindFixedProtocol EndpointKind = "fixed_protocol" )
type EndpointResult ¶
type EndpointResult struct {
Kind EndpointKind `json:"kind"`
Platform string `json:"platform,omitempty"`
Host string `json:"host,omitempty"`
Domain string `json:"domain,omitempty"`
Protocol string `json:"protocol,omitempty"`
Port int `json:"port"`
TLS bool `json:"tls"`
Preference uint16 `json:"mx_preference,omitempty"`
Status MailStatus `json:"status"`
Evidence string `json:"evidence,omitempty"`
Error string `json:"error,omitempty"`
LatencyMS int64 `json:"latency_ms"`
}
type LocalListener ¶
LocalListener is retained for source compatibility with the first structured API. CheckMail no longer binds ports to infer listener state; local listeners are detected by loopback connections through Dialer.
type MXResolver ¶
MXResolver is injectable for offline and deterministic tests.
type MailReport ¶
type MailReport struct {
SchemaVersion string `json:"schema_version"`
Local []EndpointResult `json:"local"`
OutboundSMTP25 []EndpointResult `json:"outbound_smtp25"`
MX []EndpointResult `json:"mx"`
Fixed []EndpointResult `json:"fixed"`
GeneratedAt time.Time `json:"generated_at"`
}
func CheckMail ¶
func CheckMail(ctx context.Context, specs []PlatformSpec, mx MXResolver, dialer Dialer, _ LocalListener) MailReport
CheckMail runs local, outbound, dynamic-MX, and fixed endpoint checks.
type MailStatus ¶
type MailStatus string
const ( MailAvailable MailStatus = "available" MailTimeout MailStatus = "timeout" MailRefused MailStatus = "refused" MailError MailStatus = "error" MailUnsupported MailStatus = "unsupported" )
type PlatformSpec ¶
type PlatformSpec struct {
Name string
Domain string
SMTPHost string
POP3Host string
IMAPHost string
}
PlatformSpec is a provider's fixed endpoints and its domain for MX lookup.
func DefaultPlatformSpecs ¶
func DefaultPlatformSpecs() []PlatformSpec
DefaultPlatformSpecs converts the existing model maps into structured specs.