Documentation
¶
Index ¶
- Constants
- Variables
- func CreateAndInjectOriginForTest(t *testing.T, hs *Homeserver, originName string) (gomatrixserverlib.KeyID, ed25519.PrivateKey)
- func MakeSignedPDUForTest(t *testing.T, hs *Homeserver, base *test.BaseClientEvent) gomatrixserverlib.PDU
- func MatrixHttpError(w http.ResponseWriter, code int, errcode string, msg string)
- func MustServeError(w http.ResponseWriter, clientErr *ClientError)
- type ClientError
- type Config
- type ExcludeUnsafeKeysFetcher
- type Homeserver
- func (h *Homeserver) BindTo(mux *http.ServeMux) error
- func (h *Homeserver) DownloadMedia(ctx context.Context, origin string, mediaId string) ([]byte, error)
- func (h *Homeserver) FetchKeys(ctx context.Context, ...) (...)
- func (h *Homeserver) FetcherName() string
- func (h *Homeserver) GetEvent(ctx context.Context, eventId string, via []string) (gomatrixserverlib.PDU, error)
- func (h *Homeserver) GetPublicEventSigningKey() ed25519.PublicKey
- func (h *Homeserver) JoinRoom(ctx context.Context, roomId string, via string, communityId string) (*storage.StoredRoom, error)
- func (h *Homeserver) JoinRooms(ctx context.Context, roomIds []string, via string, communityId string) error
- func (h *Homeserver) LearnState(ctx context.Context, roomId string, atEventId string, via string) error
- func (h *Homeserver) Ping(ctx context.Context, serverName string) error
- func (h *Homeserver) RunFilters(ctx context.Context, event gomatrixserverlib.PDU, ...) error
- func (h *Homeserver) SendNextTransactionTo(ctx context.Context, destination string)
- func (h *Homeserver) SendRedactInstruction(ctx context.Context, forEvent gomatrixserverlib.PDU) error
- func (h *Homeserver) StoreKeys(ctx context.Context, ...) error
- type KeyQueryServer
Constants ¶
const PolicyServerKeyID gomatrixserverlib.KeyID = "ed25519:policy_server"
Variables ¶
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 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) FetchKeys ¶ added in v1.2.0
func (f *ExcludeUnsafeKeysFetcher) FetchKeys(ctx context.Context, reqs map[gomatrixserverlib.PublicKeyLookupRequest]spec.Timestamp) (map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult, error)
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) DownloadMedia ¶
func (h *Homeserver) DownloadMedia(ctx context.Context, origin string, mediaId string) ([]byte, error)
DownloadMedia - Implements `media.Downloader`
func (*Homeserver) FetchKeys ¶
func (h *Homeserver) FetchKeys(ctx context.Context, requests map[gomatrixserverlib.PublicKeyLookupRequest]spec.Timestamp) (map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult, error)
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 (*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
func (*Homeserver) StoreKeys ¶
func (h *Homeserver) StoreKeys(ctx context.Context, results map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult) error
Source Files
¶
- api_basic_server_info.go
- api_devices.go
- api_msc4284_check.go
- api_msc4284_sign.go
- api_policy_sign.go
- api_transactions.go
- errors.go
- homeserver.go
- keyring.go
- keyring_fetcher.go
- learn_state.go
- outbound_events.go
- outbound_general.go
- outbound_join.go
- outbound_media.go
- outbound_transactions.go
- run_filters.go
- test_utils.go
- todevice_redaction.go