types.go 679 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package rest
  2. import (
  3. "net/http"
  4. "time"
  5. )
  6. type (
  7. // Middleware defines the middleware method.
  8. Middleware func(next http.HandlerFunc) http.HandlerFunc
  9. // A Route is a http route.
  10. Route struct {
  11. Method string
  12. Path string
  13. Handler http.HandlerFunc
  14. }
  15. // RouteOption defines the method to customize a featured route.
  16. RouteOption func(r *featuredRoutes)
  17. jwtSetting struct {
  18. enabled bool
  19. secret string
  20. prevSecret string
  21. }
  22. signatureSetting struct {
  23. SignatureConf
  24. enabled bool
  25. }
  26. featuredRoutes struct {
  27. timeout time.Duration
  28. priority bool
  29. jwt jwtSetting
  30. signature signatureSetting
  31. routes []Route
  32. maxBytes int64
  33. }
  34. )