diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-08-13 12:16:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-13 12:16:37 +0100 |
commit | 9677a95afc529d1766d487db46965266c6fbaa6a (patch) | |
tree | d98ccf518a3f8386054f93be4138988def9848be /federationsender | |
parent | 820c56c165ec8f0409d23cd151a7ff89fbe09ffa (diff) |
API setup refactoring (#1266)
* Start HTTP endpoint refactoring
* Update SetupAndServeHTTP
* Fix builds
* Don't set up external listener if no address configured
* TLS HTTP setup
* Break apart client/federation/key/media muxes
* Tweaks
* Fix P2P demos
* Fix media API routing
* Review comments @Kegsay
* Update sample config
* Fix gobind build
* Fix External -> Public in federation API test
Diffstat (limited to 'federationsender')
-rw-r--r-- | federationsender/inthttp/server.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/federationsender/inthttp/server.go b/federationsender/inthttp/server.go index ee05cf95..16ef4b09 100644 --- a/federationsender/inthttp/server.go +++ b/federationsender/inthttp/server.go @@ -26,7 +26,8 @@ func AddRoutes(intAPI api.FederationSenderInternalAPI, internalAPIMux *mux.Route return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) - internalAPIMux.Handle(FederationSenderPerformJoinRequestPath, + internalAPIMux.Handle( + FederationSenderPerformJoinRequestPath, httputil.MakeInternalAPI("PerformJoinRequest", func(req *http.Request) util.JSONResponse { var request api.PerformJoinRequest var response api.PerformJoinResponse @@ -37,7 +38,8 @@ func AddRoutes(intAPI api.FederationSenderInternalAPI, internalAPIMux *mux.Route return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) - internalAPIMux.Handle(FederationSenderPerformLeaveRequestPath, + internalAPIMux.Handle( + FederationSenderPerformLeaveRequestPath, httputil.MakeInternalAPI("PerformLeaveRequest", func(req *http.Request) util.JSONResponse { var request api.PerformLeaveRequest var response api.PerformLeaveResponse @@ -50,7 +52,8 @@ func AddRoutes(intAPI api.FederationSenderInternalAPI, internalAPIMux *mux.Route return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) - internalAPIMux.Handle(FederationSenderPerformDirectoryLookupRequestPath, + internalAPIMux.Handle( + FederationSenderPerformDirectoryLookupRequestPath, httputil.MakeInternalAPI("PerformDirectoryLookupRequest", func(req *http.Request) util.JSONResponse { var request api.PerformDirectoryLookupRequest var response api.PerformDirectoryLookupResponse @@ -63,7 +66,8 @@ func AddRoutes(intAPI api.FederationSenderInternalAPI, internalAPIMux *mux.Route return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) - internalAPIMux.Handle(FederationSenderPerformServersAlivePath, + internalAPIMux.Handle( + FederationSenderPerformServersAlivePath, httputil.MakeInternalAPI("PerformServersAliveRequest", func(req *http.Request) util.JSONResponse { var request api.PerformServersAliveRequest var response api.PerformServersAliveResponse @@ -76,7 +80,8 @@ func AddRoutes(intAPI api.FederationSenderInternalAPI, internalAPIMux *mux.Route return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) - internalAPIMux.Handle(FederationSenderPerformBroadcastEDUPath, + internalAPIMux.Handle( + FederationSenderPerformBroadcastEDUPath, httputil.MakeInternalAPI("PerformBroadcastEDU", func(req *http.Request) util.JSONResponse { var request api.PerformBroadcastEDURequest var response api.PerformBroadcastEDUResponse |