mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-24 18:11:19 +01:00
v0.5: (BREAKING) simplified config format, improved output formatting, fixed docker watcher
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user