homeserver

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const PolicyServerKeyID gomatrixserverlib.KeyID = "ed25519:policy_server"

Variables

View Source
var NoConfigChanges func(c *Config) = nil

Functions

func CreateAndInjectOriginForTest added in v1.4.0

func CreateAndInjectOriginForTest(t *testing.T, hs *Homeserver, originName string) (gomatrixserverlib.KeyID, ed25519.PrivateKey)

CreateAndInjectOriginForTest - Inserts an origin's keys into a homeserver instance for tests. DO NOT USE OUTSIDE OF TESTS.

func MakeSignedPDUForTest added in v1.4.0

func MakeSignedPDUForTest(t *testing.T, hs *Homeserver, base *test.BaseClientEvent) gomatrixserverlib.PDU

MakeSignedPDUForTest - Creates a signed PDU for testing purposes. DO NOT USE OUTSIDE OF TESTS.

func MatrixHttpError

func MatrixHttpError(w http.ResponseWriter, code int, errcode string, msg string)

func MustServeError added in v1.7.0

func MustServeError(w http.ResponseWriter, clientErr *ClientError)

Types

type ClientError added in v1.7.0

type ClientError struct {
	HttpCode         int
	Errcode          string
	Message          string
	AdditionalFields map[string]any
}

type Config

type Config struct {
	ServerName        string
	PrivateSigningKey ed25519.PrivateKey
	// The key used to sign events as neutral. This key is not published or used as a server key.
	PrivateEventSigningKey  ed25519.PrivateKey
	SigningKeyVersion       string
	KeyQueryServer          *KeyQueryServer
	ActorLocalpart          string
	CacheRoomStateFor       time.Duration
	TrustedOrigins          []string
	EnableDirectKeyFetching bool
	MediaClientUrl          string
	MediaClientAccessToken  string
	AdminContacts           []config.SupportContact
	SecurityContacts        []config.SupportContact
	SupportUrl              string
	AllowedNetworks         []string
	DeniedNetworks          []string

	// This should only be set during tests
	SkipVerify bool
}

type ExcludeUnsafeKeysFetcher added in v1.2.0

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

func NewExcludeUnsafeKeysFetcher added in v1.2.0

func NewExcludeUnsafeKeysFetcher(downstream gomatrixserverlib.KeyFetcher) *ExcludeUnsafeKeysFetcher

func (*ExcludeUnsafeKeysFetcher) FetcherName added in v1.2.0

func (f *ExcludeUnsafeKeysFetcher) FetcherName() string

type Homeserver

type Homeserver struct {
	ServerName spec.ServerName
	KeyId      gomatrixserverlib.KeyID
	// contains filtered or unexported fields
}

func NewHomeserver

func NewHomeserver(config *Config, storage storage.PersistentStorage, pool *queue.Pool, pubsubClient pubsub.Client) (*Homeserver, error)

func NewMockServerForTest added in v1.4.0

func NewMockServerForTest(t *testing.T, storage storage.PersistentStorage, configModFn func(c *Config)) *Homeserver

NewMockServerForTest - Creates a mock homeserver instance for testing purposes. DO NOT USE OUTSIDE OF TESTS.

func (*Homeserver) BindTo

func (h *Homeserver) BindTo(mux *http.ServeMux) error

func (*Homeserver) DownloadMedia

func (h *Homeserver) DownloadMedia(ctx context.Context, origin string, mediaId string) ([]byte, error)

DownloadMedia - Implements `media.Downloader`

func (*Homeserver) FetcherName

func (h *Homeserver) FetcherName() string

func (*Homeserver) GetEvent added in v1.4.0

func (h *Homeserver) GetEvent(ctx context.Context, eventId string, via []string) (gomatrixserverlib.PDU, error)

GetEvent - Fetches an event over federation from the listed servers. The first server to return a succesful result is used. If *all* servers return an error, a joined error is returned. If one server returns an error, but another server is successful, the error is discarded.

func (*Homeserver) GetPublicEventSigningKey

func (h *Homeserver) GetPublicEventSigningKey() ed25519.PublicKey

func (*Homeserver) JoinRoom

func (h *Homeserver) JoinRoom(ctx context.Context, roomId string, via string, communityId string) (*storage.StoredRoom, error)

func (*Homeserver) JoinRooms

func (h *Homeserver) JoinRooms(ctx context.Context, roomIds []string, via string, communityId string) error

JoinRooms - Attempts to join rooms in order, retrying a number of times if required. This is a non-idempotent function: it will store successful joins until an error occurs.

func (*Homeserver) LearnState added in v1.6.0

func (h *Homeserver) LearnState(ctx context.Context, roomId string, atEventId string, via string) error

func (*Homeserver) Ping

func (h *Homeserver) Ping(ctx context.Context, serverName string) error

Ping - Sends an authenticated request to the given server name in an attempt to encourage it to send us transactions/requests.

func (*Homeserver) RunFilters added in v1.4.0

func (h *Homeserver) RunFilters(ctx context.Context, event gomatrixserverlib.PDU, waitCh chan<- *queue.PoolResult) error

func (*Homeserver) SendNextTransactionTo added in v1.4.0

func (h *Homeserver) SendNextTransactionTo(ctx context.Context, destination string)

func (*Homeserver) SendRedactInstruction added in v1.4.0

func (h *Homeserver) SendRedactInstruction(ctx context.Context, forEvent gomatrixserverlib.PDU) error

type KeyQueryServer

type KeyQueryServer struct {
	Name           string
	PreferredKeyId string
	PreferredKey   ed25519.PublicKey
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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