v0.5: (BREAKING) simplified config format, improved output formatting, fixed docker watcher

This commit is contained in:
yusing
2024-09-16 03:48:39 +08:00
parent 719693deb7
commit 5be8659a99
34 changed files with 165 additions and 343 deletions

View File

@@ -1,25 +1,24 @@
package fields
import (
F "github.com/yusing/go-proxy/utils/functional"
E "github.com/yusing/go-proxy/error"
)
type PathMode struct{ F.Stringable }
type PathMode string
func NewPathMode(pm string) (PathMode, E.NestedError) {
switch pm {
case "", "forward":
return PathMode{F.NewStringable(pm)}, E.Nil()
return PathMode(pm), E.Nil()
default:
return PathMode{}, E.Invalid("path mode", pm)
return "", E.Invalid("path mode", pm)
}
}
func (p PathMode) IsRemove() bool {
return p.String() == ""
return p == ""
}
func (p PathMode) IsForward() bool {
return p.String() == "forward"
return p == "forward"
}