package checker import ( "encoding/json" "fmt" "html/template" "sort" "strings" sdk "git.happydns.org/checker-sdk-go/checker" ) // ── HTML report ─────────────────────────────────────────────────────────────── type matrixCertData struct { SubjectCommonName string IssuerCommonName string SHA256Fingerprint string DNSNames []string } type matrixConnectionData struct { Address string TLSVersion string CipherSuite string Certs []matrixCertData AllChecksOK bool CheckDetails []matrixCheckItem Errors []string Open bool } type matrixCheckItem struct { Label string OK bool } type matrixConnErrData struct { Address string Message string } type matrixSRVRecord struct { Target string Port uint16 Priority uint16 Weight uint16 } type matrixHostData struct { Name string CName string Addrs []string } type matrixTemplateData struct { FederationOK bool Version string VersionError string WellKnownServer string WellKnownResult string SRVSkipped bool SRVCName string SRVRecords []matrixSRVRecord SRVError string Hosts []matrixHostData Addrs []string Connections []matrixConnectionData ConnectionErrors []matrixConnErrData } var matrixHTMLTemplate = template.Must( template.New("matrix").Parse(`
{{.Version}}{{if .VersionError}} — {{.VersionError}}{{end}}{{.TLSVersion}}{{if and .TLSVersion .CipherSuite}} — {{end}}{{.CipherSuite}}
{{end}} {{if .Certs}}| Subject | Issuer | DNS Names | Fingerprint (SHA-256) |
|---|---|---|---|
{{.SubjectCommonName}} |
{{.IssuerCommonName}} |
{{range .DNSNames}}{{.}} {{end}} |
{{.SHA256Fingerprint}} |
| {{if .OK}}✓{{else}}✗{{end}} | {{.Label}} |
⚠ {{.}}
{{end}}{{.Address}}
{{.Message}}
Server: {{.WellKnownServer}}
{{.WellKnownResult}}
{{else}}Not found.
{{end}}SRV lookup skipped{{if .SRVCName}} (CNAME: {{.SRVCName}}){{end}}
SRV error: {{.SRVError}}
{{else if .SRVRecords}}| Target | Port | Priority | Weight |
|---|---|---|---|
{{.Target}} |
{{.Port}} | {{.Priority}} | {{.Weight}} |
No SRV records found.
{{end}} {{if .Hosts}}
{{.Name}}
{{if .CName}} → {{.CName}}{{end}}
{{if .Addrs}}: {{range .Addrs}}{{.}} {{end}}{{end}}
{{.}}