mirror of
https://github.com/mjl-/mox.git
synced 2025-07-14 16:14:36 +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:
@ -75,9 +75,8 @@ const (
|
||||
ModeNone Mode = "none" // In case MTA-STS is not or no longer implemented.
|
||||
)
|
||||
|
||||
// STSMX is an allowlisted MX host name/pattern.
|
||||
// todo: find a way to name this just STSMX without getting duplicate names for "MX" in the sherpa api.
|
||||
type STSMX struct {
|
||||
// MX is an allowlisted MX host name/pattern.
|
||||
type MX struct {
|
||||
// "*." wildcard, e.g. if a subdomain matches. A wildcard must match exactly one
|
||||
// label. *.example.com matches mail.example.com, but not example.com, and not
|
||||
// foor.bar.example.com.
|
||||
@ -88,7 +87,7 @@ type STSMX struct {
|
||||
|
||||
// LogString returns a loggable string representing the host, with both unicode
|
||||
// and ascii version for IDNA domains.
|
||||
func (s STSMX) LogString() string {
|
||||
func (s MX) LogString() string {
|
||||
pre := ""
|
||||
if s.Wildcard {
|
||||
pre = "*."
|
||||
@ -103,7 +102,7 @@ func (s STSMX) LogString() string {
|
||||
type Policy struct {
|
||||
Version string // "STSv1"
|
||||
Mode Mode
|
||||
MX []STSMX
|
||||
MX []MX
|
||||
MaxAgeSeconds int // How long this policy can be cached. Suggested values are in weeks or more.
|
||||
Extensions []Pair
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ func (p *parser) take(s string) bool {
|
||||
}
|
||||
|
||||
// ../rfc/8461:469
|
||||
func (p *parser) xmx() (mx STSMX) {
|
||||
func (p *parser) xmx() (mx MX) {
|
||||
if p.prefix("*.") {
|
||||
mx.Wildcard = true
|
||||
p.o += 2
|
||||
|
@ -77,7 +77,7 @@ max_age: 1296000
|
||||
Policy{
|
||||
Version: "STSv1",
|
||||
Mode: ModeTesting,
|
||||
MX: []STSMX{
|
||||
MX: []MX{
|
||||
{Domain: dns.Domain{ASCII: "mx1.example.com"}},
|
||||
{Domain: dns.Domain{ASCII: "mx2.example.com"}},
|
||||
{Domain: dns.Domain{ASCII: "mx.backup-example.com"}},
|
||||
@ -89,7 +89,7 @@ max_age: 1296000
|
||||
Policy{
|
||||
Version: "STSv1",
|
||||
Mode: ModeEnforce,
|
||||
MX: []STSMX{
|
||||
MX: []MX{
|
||||
{Wildcard: true, Domain: dns.Domain{ASCII: "example.com"}},
|
||||
},
|
||||
MaxAgeSeconds: 0,
|
||||
@ -99,7 +99,7 @@ max_age: 1296000
|
||||
Policy{
|
||||
Version: "STSv1",
|
||||
Mode: ModeEnforce,
|
||||
MX: []STSMX{
|
||||
MX: []MX{
|
||||
{Wildcard: true, Domain: dns.Domain{ASCII: "example.com"}},
|
||||
},
|
||||
MaxAgeSeconds: 1,
|
||||
@ -140,7 +140,7 @@ max_age: 1296000
|
||||
policy := Policy{
|
||||
Version: "STSv1",
|
||||
Mode: ModeTesting,
|
||||
MX: []STSMX{
|
||||
MX: []MX{
|
||||
{Domain: dns.Domain{ASCII: "mx1.example.com"}},
|
||||
{Domain: dns.Domain{ASCII: "mx2.example.com"}},
|
||||
{Domain: dns.Domain{ASCII: "mx.backup-example.com"}},
|
||||
|
Reference in New Issue
Block a user