diff --git a/CHANGELOG.md b/CHANGELOG.md index 495f58a..ca965ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,10 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); version ### Changed +- ci: gofmt on eight files that failed the formatting workflow check (panel + config, DNS check, domain transfer export, rate-limit tests, auth principal, + domain and delivery handlers, web package doc comment). + - docs: full-tree review plan ([docs/plans/code-review.md](docs/plans/code-review.md)) — architecture, quality, GUI, tests, licence; P0 is domain-admin send-log authorization. Roadmap queues that plan ahead of inbound-relay and records diff --git a/cmd/panel/main.go b/cmd/panel/main.go index d553466..1f1ffa1 100644 --- a/cmd/panel/main.go +++ b/cmd/panel/main.go @@ -53,16 +53,16 @@ type config struct { mailLog string retentionDays int - dataDir string - dbPath string - manifestPath string - setupTokenPath string - hostname string - cookieSecure bool - submissionEnabled bool - trustedProxies []*net.IPNet - sessionIdleDays int - dnsResolvers []string + dataDir string + dbPath string + manifestPath string + setupTokenPath string + hostname string + cookieSecure bool + submissionEnabled bool + trustedProxies []*net.IPNet + sessionIdleDays int + dnsResolvers []string rateLimitMessagesPerIP int rateLimitWindowSeconds int diff --git a/internal/dnscheck/dnscheck.go b/internal/dnscheck/dnscheck.go index 59a2181..3781664 100644 --- a/internal/dnscheck/dnscheck.go +++ b/internal/dnscheck/dnscheck.go @@ -70,12 +70,12 @@ type Domain struct { // compares DNS against the key this server actually signs with. Hostname and // ServerIPs identify this server and come from a preceding Server check. type Query struct { - Name string - Selector string - ExpectedDKIM string - Hostname string - ServerIPs []string - DMARCReportEmail string // resolved rua= destination; empty = policy-only template + Name string + Selector string + ExpectedDKIM string + Hostname string + ServerIPs []string + DMARCReportEmail string // resolved rua= destination; empty = policy-only template } // resolver is the slice of *net.Resolver this package uses, as an interface so diff --git a/internal/domain/transfer.go b/internal/domain/transfer.go index 206819e..befb9ee 100644 --- a/internal/domain/transfer.go +++ b/internal/domain/transfer.go @@ -23,7 +23,7 @@ type DomainExport struct { Version string `json:"version"` Domain string `json:"domain"` DKIMSelector string `json:"dkim_selector"` - DKIMPrivateKey string `json:"dkim_private_key"` // PKCS#1 PEM + DKIMPrivateKey string `json:"dkim_private_key"` // PKCS#1 PEM DMARCRua *string `json:"dmarc_rua,omitempty"` // nil = inherit profile; set = override ("" = none) Applications []AppExport `json:"applications"` } diff --git a/internal/store/ratelimits_test.go b/internal/store/ratelimits_test.go index e922145..51b0182 100644 --- a/internal/store/ratelimits_test.go +++ b/internal/store/ratelimits_test.go @@ -152,9 +152,9 @@ func TestDeleteRateLimitsForDomain(t *testing.T) { func TestRateLimitActiveAndAllowsIP(t *testing.T) { inactive := []RateLimit{ {}, - {Scope: RateLimitScopeDomain, AllowedIPs: []string{"203.0.113.1"}}, // no ceiling - {Scope: RateLimitScopeDomain, MaxMessages: 5}, // no window - {Scope: RateLimitScopeApp, MaxMessages: 5, WindowSeconds: 60}, // app needs IPs + {Scope: RateLimitScopeDomain, AllowedIPs: []string{"203.0.113.1"}}, // no ceiling + {Scope: RateLimitScopeDomain, MaxMessages: 5}, // no window + {Scope: RateLimitScopeApp, MaxMessages: 5, WindowSeconds: 60}, // app needs IPs {Scope: RateLimitScopeApp, AllowedIPs: []string{"203.0.113.1"}, MaxMessages: 5}, // no window } for i, rl := range inactive { diff --git a/internal/web/auth/principal.go b/internal/web/auth/principal.go index 534cff5..e0397ab 100644 --- a/internal/web/auth/principal.go +++ b/internal/web/auth/principal.go @@ -10,8 +10,8 @@ import ( type ctxKey int const ( - usernameKey ctxKey = 0 - principalKey ctxKey = 1 + usernameKey ctxKey = 0 + principalKey ctxKey = 1 ) // Role is a panel user's access level. diff --git a/internal/web/handlers/handlers_domains.go b/internal/web/handlers/handlers_domains.go index d090be4..b3ea23e 100644 --- a/internal/web/handlers/handlers_domains.go +++ b/internal/web/handlers/handlers_domains.go @@ -124,10 +124,10 @@ func (h *Handlers) HandleDeleteConfirm(w http.ResponseWriter, r *http.Request) { return } h.view.Render(w, http.StatusOK, "domain_delete", map[string]any{ - "Title": "SelfPost — delete " + d.Name, - "User": auth.CurrentUser(r), - "Active": "domains", - "Domain": d, + "Title": "SelfPost — delete " + d.Name, + "User": auth.CurrentUser(r), + "Active": "domains", + "Domain": d, "IsGlobal": true, }) } diff --git a/internal/web/handlers/handlers_monitor.go b/internal/web/handlers/handlers_monitor.go index 45aa2e3..98dc3b9 100644 --- a/internal/web/handlers/handlers_monitor.go +++ b/internal/web/handlers/handlers_monitor.go @@ -107,11 +107,11 @@ func (h *Handlers) HandleDelivery(w http.ResponseWriter, r *http.Request) { row.Subject = mailhdr.DecodeSubject(row.Subject) logRows, logNote := h.deliveryLog(row) h.view.Render(w, http.StatusOK, "delivery", map[string]any{ - "Title": "SelfPost — delivery", - "User": auth.CurrentUser(r), - "Active": "deliveries", + "Title": "SelfPost — delivery", + "User": auth.CurrentUser(r), + "Active": "deliveries", "IsGlobal": p.IsGlobal(), - "Row": row, + "Row": row, // The status in the panel's own badge vocabulary, so the headline reads // the same way as every other health signal in the panel. "Level": deliveryLevel(row.Status), diff --git a/internal/web/web.go b/internal/web/web.go index 466150c..4e23006 100644 --- a/internal/web/web.go +++ b/internal/web/web.go @@ -1,4 +1,4 @@ -// Package web implements the SelfPost control panel's HTTP surface: the +// Package web implements the SelfPost control panel's HTTP surface: the // one-time administrator setup flow (security.md), login/session handling // (security.md) and the authenticated shell the later phases build on. package web