Documentation ¶
Index ¶
- Constants
- func MakeAuthAPI(metricsName string, userAPI userapi.UserInternalAPI, ...) http.Handler
- func MakeExternalAPI(metricsName string, f func(*http.Request) util.JSONResponse) http.Handler
- func MakeFedAPI(metricsName string, serverName gomatrixserverlib.ServerName, ...) http.Handler
- func MakeHTMLAPI(metricsName string, ...) http.Handler
- func MakeInternalAPI(metricsName string, f func(*http.Request) util.JSONResponse) http.Handler
- func PostJSON(ctx context.Context, span opentracing.Span, httpClient *http.Client, ...) error
- func URLDecodeMapValues(vmap map[string]string) (map[string]string, error)
- func WrapHandlerInBasicAuth(h http.Handler, b BasicAuth) http.HandlerFunc
- func WrapHandlerInCORS(h http.Handler) http.HandlerFunc
- type BasicAuth
- type FederationWakeups
- type RateLimits
Constants ¶
const ( PublicClientPathPrefix = "/_matrix/client/" PublicFederationPathPrefix = "/_matrix/federation/" PublicKeyPathPrefix = "/_matrix/key/" PublicMediaPathPrefix = "/_matrix/media/" PublicWellKnownPrefix = "/.well-known/matrix/" InternalPathPrefix = "/api/" )
Variables ¶
This section is empty.
Functions ¶
func MakeAuthAPI ¶
func MakeAuthAPI( metricsName string, userAPI userapi.UserInternalAPI, f func(*http.Request, *userapi.Device) util.JSONResponse, ) http.Handler
MakeAuthAPI turns a util.JSONRequestHandler function into an http.Handler which authenticates the request.
func MakeExternalAPI ¶
MakeExternalAPI turns a util.JSONRequestHandler function into an http.Handler. This is used for APIs that are called from the internet.
func MakeFedAPI ¶
func MakeFedAPI( metricsName string, serverName gomatrixserverlib.ServerName, keyRing gomatrixserverlib.JSONVerifier, wakeup *FederationWakeups, f func(*http.Request, *gomatrixserverlib.FederationRequest, map[string]string) util.JSONResponse, ) http.Handler
MakeFedAPI makes an http.Handler that checks matrix federation authentication.
func MakeHTMLAPI ¶
func MakeHTMLAPI(metricsName string, f func(http.ResponseWriter, *http.Request) *util.JSONResponse) http.Handler
MakeHTMLAPI adds Span metrics to the HTML Handler function This is used to serve HTML alongside JSON error messages
func MakeInternalAPI ¶
MakeInternalAPI turns a util.JSONRequestHandler function into an http.Handler. This is used for APIs that are internal to dendrite. If we are passed a tracing context in the request headers then we use that as the parent of any tracing spans we create.
func PostJSON ¶
func PostJSON( ctx context.Context, span opentracing.Span, httpClient *http.Client, apiURL string, request, response interface{}, ) error
PostJSON performs a POST request with JSON on an internal HTTP API
func URLDecodeMapValues ¶
URLDecodeMapValues is a function that iterates through each of the items in a map, URL decodes the value, and returns a new map with the decoded values under the same key names
func WrapHandlerInBasicAuth ¶
func WrapHandlerInBasicAuth(h http.Handler, b BasicAuth) http.HandlerFunc
WrapHandlerInBasicAuth adds basic auth to a handler. Only used for /metrics
func WrapHandlerInCORS ¶
func WrapHandlerInCORS(h http.Handler) http.HandlerFunc
WrapHandlerInCORS adds CORS headers to all responses, including all error responses. Handles OPTIONS requests directly.
Types ¶
type FederationWakeups ¶
type FederationWakeups struct { FsAPI federationapiAPI.FederationInternalAPI // contains filtered or unexported fields }
func (*FederationWakeups) Wakeup ¶
func (f *FederationWakeups) Wakeup(ctx context.Context, origin gomatrixserverlib.ServerName)
type RateLimits ¶ added in v0.6.0
type RateLimits struct {
// contains filtered or unexported fields
}
func NewRateLimits ¶ added in v0.6.0
func NewRateLimits(cfg *config.RateLimiting) *RateLimits
func (*RateLimits) Limit ¶ added in v0.6.0
func (l *RateLimits) Limit(req *http.Request) *util.JSONResponse