mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-31 14:13:09 +02:00
restructured the project to comply community guideline, for others check release note
This commit is contained in:
24
internal/proxy/fields/path_mode.go
Normal file
24
internal/proxy/fields/path_mode.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package fields
|
||||
|
||||
import (
|
||||
E "github.com/yusing/go-proxy/internal/error"
|
||||
)
|
||||
|
||||
type PathMode string
|
||||
|
||||
func NewPathMode(pm string) (PathMode, E.NestedError) {
|
||||
switch pm {
|
||||
case "", "forward":
|
||||
return PathMode(pm), nil
|
||||
default:
|
||||
return "", E.Invalid("path mode", pm)
|
||||
}
|
||||
}
|
||||
|
||||
func (p PathMode) IsRemove() bool {
|
||||
return p == ""
|
||||
}
|
||||
|
||||
func (p PathMode) IsForward() bool {
|
||||
return p == "forward"
|
||||
}
|
||||
Reference in New Issue
Block a user