Documentation
¶
Overview ¶
Package services represents used services
Index ¶
- func NewMatrixClient(homeserver, username, password string) (MatrixClient, MatrixSyncer, error)
- type FormExtensions
- type FormHandler
- type FormPolicy
- type FormSender
- type HTTPServer
- type IPMatcher
- type Logger
- type MatrixBot
- type MatrixClient
- type MatrixCryptoStore
- type MatrixLogger
- type MatrixOlmMachine
- type MatrixRegistrationClient
- type MatrixStore
- type MatrixSyncer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMatrixClient ¶
func NewMatrixClient(homeserver, username, password string) (MatrixClient, MatrixSyncer, error)
NewMatrixClient - creates matrix client-server API client
Types ¶
type FormExtensions ¶ added in v1.1.0
FormExtensions map
type FormHandler ¶
type FormHandler interface { HandleGET(string, *http.Request) (string, error) HandlePOST(string, *http.Request) (string, error) }
FormHandler ...
func NewFormHandler ¶
func NewFormHandler(forms []*configuration.Form, exts FormExtensions, spam configuration.Spam, policy FormPolicy, sender FormSender, log Logger) FormHandler
NewFormHandler creates FormHandler object
type FormPolicy ¶
FormPolicy is escape/sanitization policy for all form fields
type FormSender ¶
type FormSender interface { SendWebhook(string, string, string, string, string) error SendMessage(id.RoomID, string) error }
FormSender is object that sends forms
type HTTPServer ¶
type HTTPServer interface {
Start()
}
HTTPServer ...
func NewHTTPServer ¶
func NewHTTPServer(port string, logger Logger, ipMatcher IPMatcher, formHandler FormHandler) HTTPServer
NewHTTPServer creates new HTTP server
type Logger ¶
type Logger interface { GetLog() *log.Logger Error(message string, args ...interface{}) Warn(message string, args ...interface{}) Info(message string, args ...interface{}) Debug(message string, args ...interface{}) Trace(message string, args ...interface{}) }
Logger interface
type MatrixBot ¶
type MatrixBot interface { SendEncryptedMessage(roomID id.RoomID, message string) error SendMessage(roomID id.RoomID, message string) error SendWebhook(avatar, name, format, text, url string) error Start(displayName string) Stop() }
MatrixBot ...
func NewMatrixBot ¶
func NewMatrixBot(client MatrixClient, syncer MatrixSyncer, machine MatrixOlmMachine, store MatrixStore, cryptoStore MatrixCryptoStore, logger MatrixLogger, registration MatrixRegistrationClient) MatrixBot
NewMatrixBot ...
func NewMatrixBotWithoutStorage ¶
func NewMatrixBotWithoutStorage(client MatrixClient, syncer MatrixSyncer, logger MatrixLogger, registration MatrixRegistrationClient) MatrixBot
NewMatrixBotWithoutStorage without persistent storage
type MatrixClient ¶
type MatrixClient interface { SendMessageEvent(id.RoomID, event.Type, interface{}, ...mautrix.ReqSendEvent) (*mautrix.RespSendEvent, error) GetOwnDisplayName() (*mautrix.RespUserDisplayName, error) SetDisplayName(string) error SetPresence(event.Presence) error JoinRoomByID(id.RoomID) (*mautrix.RespJoinRoom, error) LeaveRoom(id.RoomID) (*mautrix.RespLeaveRoom, error) Whoami() (*mautrix.RespWhoami, error) Sync() error Logout() (*mautrix.RespLogout, error) }
MatrixClient - matrix client-server API client interface
type MatrixCryptoStore ¶
MatrixCryptoStore - MatrixOlmMachine store
func NewMatrixCryptoStore ¶
func NewMatrixCryptoStore(db *sql.DB, driver string, logger MatrixLogger, userID id.UserID, deviceID id.DeviceID) (MatrixCryptoStore, error)
NewMatrixCryptoStore returns crypto.Store implementation
type MatrixLogger ¶
MatrixLogger - matrix logger
type MatrixOlmMachine ¶
type MatrixOlmMachine interface { EncryptMegolmEvent(id.RoomID, event.Type, interface{}) (*event.EncryptedEventContent, error) DecryptMegolmEvent(*event.Event) (*event.Event, error) ProcessSyncResponse(*mautrix.RespSync, string) bool HandleMemberEvent(*event.Event) FlushStore() error }
MatrixOlmMachine - matrix olm machine
func NewOlmMachine ¶
func NewOlmMachine(client MatrixClient, logger MatrixLogger, cryptoStore MatrixCryptoStore, stateStore MatrixStore) (MatrixOlmMachine, error)
NewOlmMachine returns OLM machine
type MatrixRegistrationClient ¶
type MatrixRegistrationClient interface { CreateToken(string, string) (*models.RegistrationToken, error) DisableToken(string) (*models.RegistrationToken, error) GetList() ([]models.RegistrationToken, error) GetRoomID() id.RoomID GetStatus(string) (*models.RegistrationToken, error) }
MatrixRegistrationClient - matrix-registration API client
func NewMatrixRegistrationClient ¶
func NewMatrixRegistrationClient(url string, secret string, roomID id.RoomID) MatrixRegistrationClient
NewMatrixRegistrationClient returns matrix-registration API client
type MatrixStore ¶
type MatrixStore interface { mautrix.Storer crypto.StateStore SetMembership(*event.Event) SetEncryptionEvent(*event.Event) GetRoomMembers(id.RoomID) []id.UserID }
MatrixStore - matrix client store & Olm Machine state store
func NewMatrixStore ¶
func NewMatrixStore(db *sql.DB, driver string, logger MatrixLogger) (MatrixStore, error)
NewMatrixStore returns implementation of mautrix.Storer
type MatrixSyncer ¶
type MatrixSyncer interface { mautrix.ExtensibleSyncer }
MatrixSyncer is a wrapper around mautrix default syncer