mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-28 11:51:53 +01:00
restructured the project to comply community guideline, for others check release note
This commit is contained in:
23
internal/proxy/fields/stop_method.go
Normal file
23
internal/proxy/fields/stop_method.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package fields
|
||||
|
||||
import (
|
||||
E "github.com/yusing/go-proxy/internal/error"
|
||||
)
|
||||
|
||||
type StopMethod string
|
||||
|
||||
const (
|
||||
StopMethodPause StopMethod = "pause"
|
||||
StopMethodStop StopMethod = "stop"
|
||||
StopMethodKill StopMethod = "kill"
|
||||
)
|
||||
|
||||
func ValidateStopMethod(s string) (StopMethod, E.NestedError) {
|
||||
sm := StopMethod(s)
|
||||
switch sm {
|
||||
case StopMethodPause, StopMethodStop, StopMethodKill:
|
||||
return sm, nil
|
||||
default:
|
||||
return "", E.Invalid("stop_method", sm)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user