mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 13:52:46 +00:00
Yggdrasil demo updates ("Bare QUIC")
Squashed commit of the following: commit 86c2388e13ffdbabdd50cea205652dccc40e1860 Merge:b0a3ee6c
f5e7e751
Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Thu Jul 16 13:47:10 2020 +0100 Merge branch 'master' into neilalexander/yggbarequic commitb0a3ee6c5c
Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Thu Jul 16 13:42:22 2020 +0100 Add support for broadcasting wake-up EDUs to known hosts commit8a5c2020b3
Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Thu Jul 16 13:42:10 2020 +0100 Bare QUIC demo working commitd3939b3d65
Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Wed Jul 15 11:42:43 2020 +0100 Support bare Yggdrasil sessions with encrypted QUIC
This commit is contained in:
parent
f5e7e7513c
commit
e5208c2ec9
16 changed files with 217 additions and 155 deletions
|
@ -19,6 +19,7 @@ const (
|
|||
FederationSenderPerformJoinRequestPath = "/federationsender/performJoinRequest"
|
||||
FederationSenderPerformLeaveRequestPath = "/federationsender/performLeaveRequest"
|
||||
FederationSenderPerformServersAlivePath = "/federationsender/performServersAlive"
|
||||
FederationSenderPerformBroadcastEDUPath = "/federationsender/performBroadcastEDU"
|
||||
)
|
||||
|
||||
// NewFederationSenderClient creates a FederationSenderInternalAPI implemented by talking to a HTTP POST API.
|
||||
|
@ -105,3 +106,16 @@ func (h *httpFederationSenderInternalAPI) PerformDirectoryLookup(
|
|||
apiURL := h.federationSenderURL + FederationSenderPerformDirectoryLookupRequestPath
|
||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
// Handle an instruction to broadcast an EDU to all servers in rooms we are joined to.
|
||||
func (h *httpFederationSenderInternalAPI) PerformBroadcastEDU(
|
||||
ctx context.Context,
|
||||
request *api.PerformBroadcastEDURequest,
|
||||
response *api.PerformBroadcastEDUResponse,
|
||||
) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformBroadcastEDU")
|
||||
defer span.Finish()
|
||||
|
||||
apiURL := h.federationSenderURL + FederationSenderPerformBroadcastEDUPath
|
||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
|
|
@ -76,4 +76,17 @@ func AddRoutes(intAPI api.FederationSenderInternalAPI, internalAPIMux *mux.Route
|
|||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(FederationSenderPerformBroadcastEDUPath,
|
||||
httputil.MakeInternalAPI("PerformBroadcastEDU", func(req *http.Request) util.JSONResponse {
|
||||
var request api.PerformBroadcastEDURequest
|
||||
var response api.PerformBroadcastEDUResponse
|
||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||
}
|
||||
if err := intAPI.PerformBroadcastEDU(req.Context(), &request, &response); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue