mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-11 11:08:48 +00:00
25 lines
339 B
Go
25 lines
339 B
Go
package headermatches
|
|
|
|
import (
|
|
"net/http"
|
|
"regexp"
|
|
)
|
|
|
|
type Checker struct {
|
|
header string
|
|
regexp *regexp.Regexp
|
|
hash string
|
|
}
|
|
|
|
func (c *Checker) Check(r *http.Request) (bool, error) {
|
|
if c.regexp.MatchString(r.Header.Get(c.header)) {
|
|
return true, nil
|
|
}
|
|
|
|
return false, nil
|
|
}
|
|
|
|
func (c *Checker) Hash() string {
|
|
return c.hash
|
|
}
|