Initial import

This commit is contained in:
2025-09-26 08:49:53 +02:00
commit a76650da35
35 changed files with 4660 additions and 0 deletions

45
proxy/match/match.go Normal file
View File

@@ -0,0 +1,45 @@
package match
import (
"fmt"
"net"
"net/http"
)
type Matchers map[string]map[string]Matcher
func (all Matchers) Get(kind, name string) (m Matcher, err error) {
if typeMatchers, ok := all[kind]; ok {
if m, ok = typeMatchers[name]; ok {
return
}
return nil, fmt.Errorf("no %s matcher named %q found", kind, name)
}
return nil, fmt.Errorf("no %s matcher found", kind)
}
type Matcher interface {
Name() string
}
type Updater interface {
Update() error
}
type IP interface {
Matcher
MatchesIP(net.IP) bool
}
type Request interface {
Matcher
MatchesRequest(*http.Request) bool
}
type Response interface {
Matcher
MatchesResponse(*http.Response) bool
}