mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:08:31 +02:00
refactor(rules): rename Static and Returning commands into Terminating and NonTerminating commands
This commit is contained in:
@@ -9,12 +9,12 @@ type (
|
||||
// finally proceed to next command (or return) base on situation
|
||||
Handle(cached Cache, w http.ResponseWriter, r *http.Request) (proceed bool)
|
||||
}
|
||||
// StaticCommand will run then proceed to next command or reverse proxy.
|
||||
StaticCommand http.HandlerFunc
|
||||
// ReturningCommand will run then return immediately.
|
||||
ReturningCommand http.HandlerFunc
|
||||
// NonTerminatingCommand will run then proceed to next command or reverse proxy.
|
||||
NonTerminatingCommand http.HandlerFunc
|
||||
// TerminatingCommand will run then return immediately.
|
||||
TerminatingCommand http.HandlerFunc
|
||||
// DynamicCommand will return base on the request
|
||||
// and can raed or modify the values.
|
||||
// and can read or modify the values.
|
||||
DynamicCommand func(cached Cache, w http.ResponseWriter, r *http.Request) (proceed bool)
|
||||
// BypassCommand will skip all the following commands
|
||||
// and directly return to reverse proxy.
|
||||
@@ -23,12 +23,12 @@ type (
|
||||
Commands []CommandHandler
|
||||
)
|
||||
|
||||
func (c StaticCommand) Handle(cached Cache, w http.ResponseWriter, r *http.Request) (proceed bool) {
|
||||
func (c NonTerminatingCommand) Handle(cached Cache, w http.ResponseWriter, r *http.Request) (proceed bool) {
|
||||
c(w, r)
|
||||
return true
|
||||
}
|
||||
|
||||
func (c ReturningCommand) Handle(cached Cache, w http.ResponseWriter, r *http.Request) (proceed bool) {
|
||||
func (c TerminatingCommand) Handle(cached Cache, w http.ResponseWriter, r *http.Request) (proceed bool) {
|
||||
c(w, r)
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user