You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package rest
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
// Middleware defines the middleware method.
|
|
|
|
Middleware func(next http.HandlerFunc) http.HandlerFunc
|
|
|
|
|
|
|
|
// A Route is a http route.
|
|
|
|
Route struct {
|
|
|
|
Method string
|
|
|
|
Path string
|
|
|
|
Handler http.HandlerFunc
|
|
|
|
}
|
|
|
|
|
|
|
|
// RouteOption defines the method to customize a featured route.
|
|
|
|
RouteOption func(r *featuredRoutes)
|
|
|
|
|
|
|
|
jwtSetting struct {
|
|
|
|
enabled bool
|
|
|
|
secret string
|
|
|
|
prevSecret string
|
|
|
|
}
|
|
|
|
|
|
|
|
signatureSetting struct {
|
|
|
|
SignatureConf
|
|
|
|
enabled bool
|
|
|
|
}
|
|
|
|
|
|
|
|
featuredRoutes struct {
|
|
|
|
timeout time.Duration
|
|
|
|
priority bool
|
|
|
|
jwt jwtSetting
|
|
|
|
signature signatureSetting
|
|
|
|
routes []Route
|
|
|
|
}
|
|
|
|
)
|