checker: split monolithic rule into per-concern rules
Replace the single matrix_federation rule with individual rules for federation status, well-known delegation, SRV records, connection reachability, TLS checks, and homeserver version, so the UI surfaces a clear checklist. Drop the incorrect well-known/server_name equality check: m.server points at the delegated federation endpoint, which is intentionally distinct from server_name.
This commit is contained in:
parent
2bd0ae99bd
commit
e4b6481d32
8 changed files with 346 additions and 60 deletions
40
checker/rules_version.go
Normal file
40
checker/rules_version.go
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package checker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
sdk "git.happydns.org/checker-sdk-go/checker"
|
||||
)
|
||||
|
||||
// versionRule reports whether the federation tester could fetch the
|
||||
// homeserver version string. The test probe reaches /_matrix/federation/v1/version,
|
||||
// so a failure here hints at a federation-path problem even when the rest
|
||||
// of the federation handshake looks healthy.
|
||||
type versionRule struct{}
|
||||
|
||||
func (r *versionRule) Name() string { return "matrix.version" }
|
||||
func (r *versionRule) Description() string {
|
||||
return "Checks that the homeserver responds to /_matrix/federation/v1/version and reports its name and version."
|
||||
}
|
||||
|
||||
func (r *versionRule) Evaluate(ctx context.Context, obs sdk.ObservationGetter, _ sdk.CheckerOptions) []sdk.CheckState {
|
||||
data, errSt := loadMatrixData(ctx, obs)
|
||||
if errSt != nil {
|
||||
return []sdk.CheckState{*errSt}
|
||||
}
|
||||
|
||||
if data.Version.Error != "" {
|
||||
return []sdk.CheckState{warnState("matrix.version.error", fmt.Sprintf("Homeserver /version probe failed: %s", data.Version.Error))}
|
||||
}
|
||||
|
||||
version := strings.TrimSpace(data.Version.Name + " " + data.Version.Version)
|
||||
if version == "" {
|
||||
return []sdk.CheckState{infoState("matrix.version.unknown", "Homeserver did not return a version string.")}
|
||||
}
|
||||
|
||||
st := passState("matrix.version.ok", fmt.Sprintf("Homeserver running %s.", version))
|
||||
st.Meta = map[string]any{"version": version}
|
||||
return []sdk.CheckState{st}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue