Files
anubis-mirror/lib/checker/all.go
Xe Iaso 590d8303ad refactor: use new checker types
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-07-25 19:39:14 +00:00

36 lines
504 B
Go

package checker
import (
"fmt"
"net/http"
"strings"
"github.com/TecharoHQ/anubis/internal"
)
type All []Interface
func (a All) Check(r *http.Request) (bool, error) {
for _, c := range a {
match, err := c.Check(r)
if err != nil {
return match, err
}
if !match {
return false, err // no match
}
}
return true, nil // match
}
func (a All) Hash() string {
var sb strings.Builder
for _, c := range a {
fmt.Fprintln(&sb, c.Hash())
}
return internal.FastHash(sb.String())
}