Registry: trend chart, always-pass indicator, subnet columns in the address list dialog

- Registry: "Динамика по запускам" chart (Chart.js 4.5.1, vendored) over finalized
  runs per target or site, % or count, subnet and calendar period filters;
  GET /admin/registry/trend
- Registry: clickable "Всегда проходили" indicator with the address list and CSV;
  GET /admin/registry/always-pass and /always-pass/list
- Address list dialog: "Подсеть" and "Метка подсети" columns from the
  administrator's subnet list (shared db.SubnetMatcher), per-subnet summary chips
  with a client-side filter; "прочие" renamed to "вне списка подсетей"
- Rebuild control-api and admin-dashboard binaries; plans and summaries in
  docs/changes, README, API and USAGE updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5.5 committed 2026-10-08 13:15:02 +03:00
1 parent c13139cd41
commit 1536723196
50 files changed
+3560 -154

No files matched your search

+10 -45
View File
@@ -152,12 +152,13 @@ type failedIngress struct {
// addr is everything known about one address of the run.
type addr struct {
res db.RunResult
subnet string
egress typeStat
ingress typeStat
stored int
https struct {
res db.RunResult
subnet string
subnetLabel string
egress typeStat
ingress typeStat
stored int
https struct {
typeStat
validator string
failedTargets []string
@@ -187,7 +188,7 @@ type Analysis struct {
func Compute(in Input) (*Analysis, error) {
byReg := make(map[int64]*addr, len(in.Results))
var addrs []*addr
subnetOf := newSubnetMatcher(in.Subnets)
matcher := db.NewSubnetMatcher(in.Subnets)
runAddrs := 0
for _, r := range in.Results {
if r.Verdict != db.ResultCancelled {
@@ -199,7 +200,8 @@ func Compute(in Input) (*Analysis, error) {
continue
}
}
a := &addr{res: r, subnet: subnetOf(r.IPAddress), failedTargets: map[string]bool{}}
cidr, label := matcher.Lookup(r.IPAddress)
a := &addr{res: r, subnet: cidr, subnetLabel: label, failedTargets: map[string]bool{}}
a.ssh.errs = map[string]bool{}
byReg[r.RegistryID] = a
addrs = append(addrs, a)
@@ -623,43 +625,6 @@ func normalizeTarget(t string) string {
return strings.TrimSuffix(t, "/")
}
// newSubnetMatcher returns a function that maps an address to the most
// specific configured subnet. With no subnets configured addresses group by
// /24 (/64 for IPv6). An address outside the list goes to "прочие".
func newSubnetMatcher(subnets []db.Subnet) func(string) string {
type entry struct {
p netip.Prefix
name string
}
var list []entry
for _, s := range subnets {
if p, err := netip.ParsePrefix(s.CIDR); err == nil {
list = append(list, entry{p.Masked(), p.Masked().String()})
}
}
sort.Slice(list, func(i, j int) bool { return list[i].p.Bits() > list[j].p.Bits() })
return func(ip string) string {
a, err := netip.ParseAddr(ip)
if err != nil {
return "прочие"
}
if len(list) == 0 {
bits := 24
if a.Is6() {
bits = 64
}
p, _ := a.Prefix(bits)
return p.String()
}
for _, e := range list {
if e.p.Contains(a) {
return e.name
}
}
return "прочие"
}
}
// ErrorClassOf names the class of a failed ingress check: the check type and
// the reason, e.g. "SSH: таймаут", "ICMP: нет ответа".
func ErrorClassOf(checkType, detail string) string {