Files
go-zero/rest/types.go

43 lines
697 B
Go
Raw Normal View History

2020-07-31 11:14:48 +08:00
package rest
2020-07-26 17:09:05 +08:00
import (
"net/http"
"time"
)
2020-07-26 17:09:05 +08:00
type (
2021-03-01 19:15:35 +08:00
// Middleware defines the middleware method.
2020-07-31 11:45:16 +08:00
Middleware func(next http.HandlerFunc) http.HandlerFunc
2021-03-01 19:15:35 +08:00
// A Route is a http route.
2020-07-26 17:09:05 +08:00
Route struct {
Method string
Path string
Handler http.HandlerFunc
}
2021-03-01 19:15:35 +08:00
// RouteOption defines the method to customize a featured route.
2020-07-31 11:45:16 +08:00
RouteOption func(r *featuredRoutes)
2020-07-26 17:09:05 +08:00
jwtSetting struct {
enabled bool
secret string
prevSecret string
}
signatureSetting struct {
SignatureConf
enabled bool
}
featuredRoutes struct {
timeout *time.Duration
2020-07-26 17:09:05 +08:00
priority bool
jwt jwtSetting
signature signatureSetting
sse bool
2020-07-26 17:09:05 +08:00
routes []Route
maxBytes int64
2020-07-26 17:09:05 +08:00
}
)