feat: add main command feat: add todos feat: add signup api feat: do not repeat code fix: user return feat: work out static box fix: setup static handlers feat: add share types License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> feat: start static License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> feat: bring back more features License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> add feat: readd more files License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> feat: add dockerignore License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> feat: gitignore License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> feat: readd submodule License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
30 lines
497 B
Go
30 lines
497 B
Go
package types
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
// Rule is a allow/disallow rule.
|
|
type Rule struct {
|
|
Regex bool
|
|
Allow bool
|
|
Path string
|
|
Regexp *Regexp
|
|
}
|
|
|
|
// Regexp is a wrapper to the native regexp type where we
|
|
// save the raw expression.
|
|
type Regexp struct {
|
|
Raw string
|
|
regexp *regexp.Regexp
|
|
}
|
|
|
|
// MatchString checks if a string matches the regexp.
|
|
func (r *Regexp) MatchString(s string) bool {
|
|
if r.regexp == nil {
|
|
r.regexp = regexp.MustCompile(r.Raw)
|
|
}
|
|
|
|
return r.regexp.MatchString(s)
|
|
}
|