mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-21 08:39:03 +01:00
preparing for v0.5
This commit is contained in:
25
src/proxy/fields/path_mode.go
Normal file
25
src/proxy/fields/path_mode.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package fields
|
||||
|
||||
import (
|
||||
F "github.com/yusing/go-proxy/utils/functional"
|
||||
E "github.com/yusing/go-proxy/error"
|
||||
)
|
||||
|
||||
type PathMode struct{ F.Stringable }
|
||||
|
||||
func NewPathMode(pm string) (PathMode, E.NestedError) {
|
||||
switch pm {
|
||||
case "", "forward":
|
||||
return PathMode{F.NewStringable(pm)}, E.Nil()
|
||||
default:
|
||||
return PathMode{}, E.Invalid("path mode", pm)
|
||||
}
|
||||
}
|
||||
|
||||
func (p PathMode) IsRemove() bool {
|
||||
return p.String() == ""
|
||||
}
|
||||
|
||||
func (p PathMode) IsForward() bool {
|
||||
return p.String() == "forward"
|
||||
}
|
||||
Reference in New Issue
Block a user