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:
Mechiel Lukkien
2024-04-19 10:51:24 +02:00
parent 962575f21b
commit ec967ef321
18 changed files with 73 additions and 83 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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"}},