mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 17:44:35 +03:00
use new sherpadoc rename mechanism to remove some typename stuttering
the stuttering was introduced to make the same type name declared in multiple packages, and used in the admin sherpa api, unique. with sherpadoc's new rename, we can make them unique when generating the api definition/docs, and the Go code can use nicer names.
This commit is contained in:
@ -92,9 +92,9 @@ func parseRecord(s string, checkRequired bool) (record *Record, isdmarc bool, re
|
||||
// ../rfc/7489:1105
|
||||
p.xerrorf("p= (policy) must be first tag")
|
||||
}
|
||||
r.Policy = DMARCPolicy(p.xtakelist("none", "quarantine", "reject"))
|
||||
r.Policy = Policy(p.xtakelist("none", "quarantine", "reject"))
|
||||
case "sp":
|
||||
r.SubdomainPolicy = DMARCPolicy(p.xkeyword())
|
||||
r.SubdomainPolicy = Policy(p.xkeyword())
|
||||
// note: we check if the value is valid before returning.
|
||||
case "rua":
|
||||
r.AggregateReportAddresses = append(r.AggregateReportAddresses, p.xuri())
|
||||
|
34
dmarc/txt.go
34
dmarc/txt.go
@ -5,18 +5,16 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// todo: DMARCPolicy should be named just Policy, but this is causing conflicting types in sherpadoc output. should somehow get the dmarc-prefix only in the sherpadoc.
|
||||
|
||||
// Policy as used in DMARC DNS record for "p=" or "sp=".
|
||||
type DMARCPolicy string
|
||||
type Policy string
|
||||
|
||||
// ../rfc/7489:1157
|
||||
|
||||
const (
|
||||
PolicyEmpty DMARCPolicy = "" // Only for the optional Record.SubdomainPolicy.
|
||||
PolicyNone DMARCPolicy = "none"
|
||||
PolicyQuarantine DMARCPolicy = "quarantine"
|
||||
PolicyReject DMARCPolicy = "reject"
|
||||
PolicyEmpty Policy = "" // Only for the optional Record.SubdomainPolicy.
|
||||
PolicyNone Policy = "none"
|
||||
PolicyQuarantine Policy = "quarantine"
|
||||
PolicyReject Policy = "reject"
|
||||
)
|
||||
|
||||
// URI is a destination address for reporting.
|
||||
@ -55,17 +53,17 @@ const (
|
||||
//
|
||||
// v=DMARC1; p=reject; rua=mailto:postmaster@mox.example
|
||||
type Record struct {
|
||||
Version string // "v=DMARC1", fixed.
|
||||
Policy DMARCPolicy // Required, for "p=".
|
||||
SubdomainPolicy DMARCPolicy // Like policy but for subdomains. Optional, for "sp=".
|
||||
AggregateReportAddresses []URI // Optional, for "rua=". Destination addresses for aggregate reports.
|
||||
FailureReportAddresses []URI // Optional, for "ruf=". Destination addresses for failure reports.
|
||||
ADKIM Align // Alignment: "r" (default) for relaxed or "s" for simple. For "adkim=".
|
||||
ASPF Align // Alignment: "r" (default) for relaxed or "s" for simple. For "aspf=".
|
||||
AggregateReportingInterval int // In seconds, default 86400. For "ri="
|
||||
FailureReportingOptions []string // "0" (default), "1", "d", "s". For "fo=".
|
||||
ReportingFormat []string // "afrf" (default). For "rf=".
|
||||
Percentage int // Between 0 and 100, default 100. For "pct=". Policy applies randomly to this percentage of messages.
|
||||
Version string // "v=DMARC1", fixed.
|
||||
Policy Policy // Required, for "p=".
|
||||
SubdomainPolicy Policy // Like policy but for subdomains. Optional, for "sp=".
|
||||
AggregateReportAddresses []URI // Optional, for "rua=". Destination addresses for aggregate reports.
|
||||
FailureReportAddresses []URI // Optional, for "ruf=". Destination addresses for failure reports.
|
||||
ADKIM Align // Alignment: "r" (default) for relaxed or "s" for simple. For "adkim=".
|
||||
ASPF Align // Alignment: "r" (default) for relaxed or "s" for simple. For "aspf=".
|
||||
AggregateReportingInterval int // In seconds, default 86400. For "ri="
|
||||
FailureReportingOptions []string // "0" (default), "1", "d", "s". For "fo=".
|
||||
ReportingFormat []string // "afrf" (default). For "rf=".
|
||||
Percentage int // Between 0 and 100, default 100. For "pct=". Policy applies randomly to this percentage of messages.
|
||||
}
|
||||
|
||||
// DefaultRecord holds the defaults for a DMARC record.
|
||||
|
Reference in New Issue
Block a user