internal

package
v0.13.7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionMajor = 0
	VersionMinor = 13
	VersionPatch = 7
	VersionTag   = "" // example: "rc1"

)

Variables

View Source
var (
	PDUCountTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "dendrite",
			Subsystem: "federationapi",
			Name:      "recv_pdus",
			Help:      "Number of incoming PDUs from remote servers with labels for success",
		},
		[]string{"status"},
	)
	EDUCountTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Namespace: "dendrite",
			Subsystem: "federationapi",
			Name:      "recv_edus",
			Help:      "Number of incoming EDUs from remote servers",
		},
	)
)
View Source
var (
	ErrPasswordTooLong    = fmt.Errorf("password too long: max %d characters", maxPasswordLength)
	ErrPasswordWeak       = fmt.Errorf("password too weak: min %d characters", minPasswordLength)
	ErrUsernameTooLong    = fmt.Errorf("username exceeds the maximum length of %d characters", maxUsernameLength)
	ErrUsernameInvalid    = errors.New("username can only contain characters a-z, 0-9, or '_+-./='")
	ErrUsernameUnderscore = errors.New("username cannot start with a '_'")
)

Functions

func CloseAndLogIfError

func CloseAndLogIfError(ctx context.Context, closer io.Closer, message string)

CloseAndLogIfError Closes io.Closer and logs the error if any

func PasswordResponse added in v0.10.9

func PasswordResponse(err error) *util.JSONResponse

PasswordResponse returns a util.JSONResponse for a given error, if any.

func SetupHookLogging

func SetupHookLogging(hooks []config.LogrusHook)

SetupHookLogging configures the logging hooks defined in the configuration. If something fails here it means that the logging was improperly configured, so we just exit with the error

func SetupPprof

func SetupPprof()

SetupPprof starts a pprof listener. We use the DefaultServeMux here because it is simplest, and it gives us the freedom to run pprof on a separate port.

func SetupStdLogging

func SetupStdLogging()

SetupStdLogging configures the logging format to standard output. Typically, it is called when the config is not yet loaded.

func UsernameResponse added in v0.10.9

func UsernameResponse(err error) *util.JSONResponse

UsernameResponse returns a util.JSONResponse for the given error, if any.

func ValidateApplicationServiceRequest added in v0.13.5

func ValidateApplicationServiceRequest(
	cfg *config.ClientAPI,
	userIDOrLocalpart string,
	accessToken string,
) (string, *util.JSONResponse)

ValidateApplicationServiceRequest checks if a provided application service token corresponds to one that is registered, and, if so, checks if the supplied userIDOrLocalpart is within that application service's namespace.

As long as these two requirements are met, the matched application service ID will be returned. Otherwise, it will return a JSON response with the appropriate error message.

func ValidateApplicationServiceUserID added in v0.13.5

func ValidateApplicationServiceUserID(userID string) error

func ValidateApplicationServiceUsername added in v0.10.9

func ValidateApplicationServiceUsername(localpart string, domain spec.ServerName) error

ValidateApplicationServiceUsername returns an error if the username is invalid for an application service

func ValidatePassword added in v0.10.9

func ValidatePassword(password string) error

ValidatePassword returns an error if the password is invalid

func ValidateUsername added in v0.10.9

func ValidateUsername(localpart string, domain spec.ServerName) error

ValidateUsername returns an error if the username is invalid

func VersionString

func VersionString() string

Types

type MutexByRoom added in v0.4.0

type MutexByRoom struct {
	// contains filtered or unexported fields
}

func NewMutexByRoom added in v0.4.0

func NewMutexByRoom() *MutexByRoom

func (*MutexByRoom) Lock added in v0.4.0

func (m *MutexByRoom) Lock(roomID string)

func (*MutexByRoom) Unlock added in v0.4.0

func (m *MutexByRoom) Unlock(roomID string)

type Trace added in v0.12.0

type Trace struct {
	// contains filtered or unexported fields
}

func StartRegion added in v0.12.0

func StartRegion(inCtx context.Context, name string) (Trace, context.Context)

func StartTask added in v0.12.0

func StartTask(inCtx context.Context, name string) (Trace, context.Context)

func (Trace) EndRegion added in v0.12.0

func (t Trace) EndRegion()

func (Trace) EndTask added in v0.12.0

func (t Trace) EndTask()

func (Trace) SetTag added in v0.12.0

func (t Trace) SetTag(key string, value any)

type TxnReq added in v0.11.1

type TxnReq struct {
	gomatrixserverlib.Transaction
	// contains filtered or unexported fields
}

func NewTxnReq added in v0.11.1

func NewTxnReq(
	rsAPI api.FederationRoomserverAPI,
	userAPI userAPI.FederationUserAPI,
	ourServerName spec.ServerName,
	keys gomatrixserverlib.JSONVerifier,
	roomsMu *MutexByRoom,
	producer *producers.SyncAPIProducer,
	inboundPresenceEnabled bool,
	pdus []json.RawMessage,
	edus []gomatrixserverlib.EDU,
	origin spec.ServerName,
	transactionID gomatrixserverlib.TransactionID,
	destination spec.ServerName,
) TxnReq

func (*TxnReq) ProcessTransaction added in v0.11.1

func (t *TxnReq) ProcessTransaction(ctx context.Context) (*fclient.RespSend, *util.JSONResponse)

Directories

Path Synopsis
Package hooks exposes places in Dendrite where custom code can be executed, useful for MSCs.
Package hooks exposes places in Dendrite where custom code can be executed, useful for MSCs.

Jump to

Keyboard shortcuts

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