routing

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: AGPL-3.0 Imports: 34 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	SendRouteName           = "Send"
	QueryDirectoryRouteName = "QueryDirectory"
	QueryProfileRouteName   = "QueryProfile"
)
View Source
const (
	// Event was passed to the Roomserver
	MetricsOutcomeOK = "ok"
	// Event failed to be processed
	MetricsOutcomeFail = "fail"
	// Event failed auth checks
	MetricsOutcomeRejected = "rejected"
	// Terminated the transaction
	MetricsOutcomeFatal = "fatal"
	// The event has missing auth_events we need to fetch
	MetricsWorkMissingAuthEvents = "missing_auth_events"
	// No work had to be done as we had all prev/auth events
	MetricsWorkDirect = "direct"
	// The event has missing prev_events we need to call /g_m_e for
	MetricsWorkMissingPrevEvents = "missing_prev_events"
)

Variables

This section is empty.

Functions

func ClaimOneTimeKeys

func ClaimOneTimeKeys(
	httpReq *http.Request, request *fclient.FederationRequest, keyAPI api.FederationKeyAPI, thisServer spec.ServerName,
) util.JSONResponse

ClaimOneTimeKeys claims OTKs for users on this server. https://matrix.org/docs/spec/server_server/latest#post-matrix-federation-v1-user-keys-claim

func CreateInvitesFrom3PIDInvites

func CreateInvitesFrom3PIDInvites(
	req *http.Request, rsAPI api.FederationRoomserverAPI,
	cfg *config.FederationAPI,
	federation fclient.FederationClient,
	userAPI userapi.FederationUserAPI,
) util.JSONResponse

CreateInvitesFrom3PIDInvites implements POST /_matrix/federation/v1/3pid/onbind

func ErrorIfLocalServerNotInRoom

func ErrorIfLocalServerNotInRoom(
	ctx context.Context,
	rsAPI api.FederationRoomserverAPI,
	roomID string,
) *util.JSONResponse

func ExchangeThirdPartyInvite

func ExchangeThirdPartyInvite(
	httpReq *http.Request,
	request *fclient.FederationRequest,
	roomID string,
	rsAPI api.FederationRoomserverAPI,
	cfg *config.FederationAPI,
	federation fclient.FederationClient,
) util.JSONResponse

ExchangeThirdPartyInvite implements PUT /_matrix/federation/v1/exchange_third_party_invite/{roomID}

func GetEvent

func GetEvent(
	ctx context.Context,
	request *fclient.FederationRequest,
	rsAPI api.FederationRoomserverAPI,
	eventID string,
	origin spec.ServerName,
) util.JSONResponse

GetEvent returns the requested event

func GetEventAuth

func GetEventAuth(
	ctx context.Context,
	request *fclient.FederationRequest,
	rsAPI api.FederationRoomserverAPI,
	roomID string,
	eventID string,
) util.JSONResponse

GetEventAuth returns event auth for the roomID and eventID

func GetMissingEvents

func GetMissingEvents(
	httpReq *http.Request,
	request *fclient.FederationRequest,
	rsAPI api.FederationRoomserverAPI,
	roomID string,
) util.JSONResponse

GetMissingEvents returns missing events between earliest_events & latest_events. Events are fetched from room DAG starting from latest_events until we reach earliest_events or the limit.

func GetOpenIDUserInfo

func GetOpenIDUserInfo(
	httpReq *http.Request,
	userAPI userapi.FederationUserAPI,
) util.JSONResponse

GetOpenIDUserInfo implements GET /_matrix/federation/v1/openid/userinfo

func GetPostPublicRooms

func GetPostPublicRooms(req *http.Request, rsAPI roomserverAPI.FederationRoomserverAPI) util.JSONResponse

GetPostPublicRooms implements GET and POST /publicRooms

func GetProfile

func GetProfile(
	httpReq *http.Request,
	userAPI userapi.FederationUserAPI,
	cfg *config.FederationAPI,
) util.JSONResponse

GetProfile implements GET /_matrix/federation/v1/query/profile

func GetState

GetState returns state events & auth events for the roomID, eventID

func GetStateIDs

func GetStateIDs(
	ctx context.Context,
	request *fclient.FederationRequest,
	rsAPI api.FederationRoomserverAPI,
	roomID string,
) util.JSONResponse

GetStateIDs returns state event IDs & auth event IDs for the roomID, eventID

func GetUserDevices

func GetUserDevices(
	req *http.Request,
	keyAPI api.FederationKeyAPI,
	userID string,
) util.JSONResponse

GetUserDevices for the given user id

func InviteV1

InviteV1 implements /_matrix/federation/v1/invite/{roomID}/{eventID}

func InviteV2

InviteV2 implements /_matrix/federation/v2/invite/{roomID}/{eventID}

func InviteV3

InviteV3 implements /_matrix/federation/v2/invite/{roomID}/{userID}

func LocalKeys

func LocalKeys(cfg *config.FederationAPI, serverName spec.ServerName) util.JSONResponse

LocalKeys returns the local keys for the server. See https://matrix.org/docs/spec/server_server/unstable.html#publishing-keys

func MakeFedAPI

func MakeFedAPI(
	metricsName string, serverName spec.ServerName,
	isLocalServerName func(spec.ServerName) bool,
	keyRing gomatrixserverlib.JSONVerifier,
	wakeup *FederationWakeups,
	f func(*http.Request, *fclient.FederationRequest, map[string]string) util.JSONResponse,
) http.Handler

MakeFedAPI makes an http.Handler that checks matrix federation authentication.

func MakeFedHTTPAPI

func MakeFedHTTPAPI(
	serverName spec.ServerName,
	isLocalServerName func(spec.ServerName) bool,
	keyRing gomatrixserverlib.JSONVerifier,
	f func(http.ResponseWriter, *http.Request),
) http.Handler

MakeFedHTTPAPI makes an http.Handler that checks matrix federation authentication.

func MakeJoin

func MakeJoin(
	httpReq *http.Request,
	request *fclient.FederationRequest,
	cfg *config.FederationAPI,
	rsAPI api.FederationRoomserverAPI,
	roomID spec.RoomID, userID spec.UserID,
	remoteVersions []gomatrixserverlib.RoomVersion,
) util.JSONResponse

MakeJoin implements the /make_join API

func MakeLeave

func MakeLeave(
	httpReq *http.Request,
	request *fclient.FederationRequest,
	cfg *config.FederationAPI,
	rsAPI api.FederationRoomserverAPI,
	roomID spec.RoomID, userID spec.UserID,
) util.JSONResponse

MakeLeave implements the /make_leave API

func Peek

func Peek(
	httpReq *http.Request,
	request *fclient.FederationRequest,
	cfg *config.FederationAPI,
	rsAPI api.FederationRoomserverAPI,
	roomID, peekID string,
	remoteVersions []gomatrixserverlib.RoomVersion,
) util.JSONResponse

Peek implements the SS /peek API, handling inbound peeks

func QueryDeviceKeys

func QueryDeviceKeys(
	httpReq *http.Request, request *fclient.FederationRequest, keyAPI api.FederationKeyAPI, thisServer spec.ServerName,
) util.JSONResponse

QueryDeviceKeys returns device keys for users on this server. https://matrix.org/docs/spec/server_server/latest#post-matrix-federation-v1-user-keys-query

func QueryRoomHierarchy

func QueryRoomHierarchy(httpReq *http.Request, request *fclient.FederationRequest, roomIDStr string, rsAPI roomserverAPI.FederationRoomserverAPI) util.JSONResponse

Query the immediate children of a room/space

Implements /_matrix/federation/v1/hierarchy/{roomID}

func RoomAliasToID

RoomAliasToID converts the queried alias into a room ID and returns it

func Send

Send implements /_matrix/federation/v1/send/{txnID}

func SendJoin

SendJoin implements the /send_join API

func SendLeave

func SendLeave(
	httpReq *http.Request,
	request *fclient.FederationRequest,
	cfg *config.FederationAPI,
	rsAPI api.FederationRoomserverAPI,
	keys gomatrixserverlib.JSONVerifier,
	roomID, eventID string,
) util.JSONResponse

SendLeave implements the /send_leave API nolint:gocyclo

func Setup

Setup registers HTTP handlers with the given ServeMux. The provided publicAPIMux MUST have `UseEncodedPath()` enabled or else routes will incorrectly path unescape twice (once from the router, once from MakeFedAPI). We need to have this enabled so we can decode paths like foo/bar%2Fbaz as [foo, bar/baz] - by default it will decode to [foo, bar, baz]

Due to Setup being used to call many other functions, a gocyclo nolint is applied: nolint: gocyclo

func Version

func Version() util.JSONResponse

Version returns the server version

Types

type FederationWakeups

type FederationWakeups struct {
	FsAPI *fedInternal.FederationInternalAPI
	// contains filtered or unexported fields
}

func (*FederationWakeups) Wakeup

func (f *FederationWakeups) Wakeup(ctx context.Context, origin spec.ServerName)

type NotaryKeysResponse

type NotaryKeysResponse struct {
	ServerKeys []json.RawMessage `json:"server_keys"`
}

type PublicRoomReq

type PublicRoomReq struct {
	Since              string `json:"since,omitempty"`
	Limit              int16  `json:"limit,omitempty"`
	Filter             filter `json:"filter,omitempty"`
	IncludeAllNetworks bool   `json:"include_all_networks,omitempty"`
	NetworkID          string `json:"third_party_instance_id,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL