Files
gluetun/internal/pprof/helpers_test.go
Quentin McGaw a6f00f2fb2 chore(lint): upgrade golangci-lint to v1.47.2
- Fix Slowloris attacks on HTTP servers
- Force set default of 5 minutes for pprof read timeout
- Change `ShutdownTimeout` to time.Duration since it cannot be set to 0
2022-08-01 21:09:16 +00:00

34 lines
565 B
Go

package pprof
import (
"regexp"
gomock "github.com/golang/mock/gomock"
)
func boolPtr(b bool) *bool { return &b }
var _ gomock.Matcher = (*regexMatcher)(nil)
type regexMatcher struct {
regexp *regexp.Regexp
}
func (r *regexMatcher) Matches(x interface{}) bool {
s, ok := x.(string)
if !ok {
return false
}
return r.regexp.MatchString(s)
}
func (r *regexMatcher) String() string {
return "regular expression " + r.regexp.String()
}
func newRegexMatcher(regex string) *regexMatcher {
return &regexMatcher{
regexp: regexp.MustCompile(regex),
}
}