refactor(rules): rename Static and Returning commands into Terminating and NonTerminating commands

This commit is contained in:
yusing
2025-10-12 09:38:06 +08:00
parent 92aa61e732
commit 80dd142861
3 changed files with 17 additions and 17 deletions

View File

@@ -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
}