Documentation
¶
Index ¶
- type BlocklistService
- type Config
- type ConfigAuth
- type ConfigBatch
- type ConfigBlocklist
- type ConfigCache
- type ConfigCacheBunny
- type ConfigCron
- type ConfigEmail
- type ConfigEmailPostmark
- type ConfigEmailPostmarkType
- type ConfigEmailTemplate
- type ConfigEmailTemplates
- type ConfigMatrix
- type ConfigPaths
- type ConfigPlausible
- type ConfigPublic
- type ConfigSearch
- type ConfigSearchDefaults
- type ConfigWebhooks
- type ConfigWorkers
- type Entry
- type IndexStats
- type IndexStatsRooms
- type IndexStatsServers
- type IndexStatsTime
- type Key
- type MatrixError
- type MatrixRoom
- type MatrixServer
- type MatrixServerContacts
- type RoomDirectoryFilter
- type RoomDirectoryRequest
- type RoomDirectoryResponse
- type RoomDirectoryRoom
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlocklistService ¶
type Config ¶
type Config struct {
Port string `yaml:"port"`
SentryDSN string `yaml:"sentry_dsn"`
Public *ConfigPublic `yaml:"public"`
Matrix *ConfigMatrix `yaml:"matrix"`
Search *ConfigSearch `yaml:"search"`
Path *ConfigPaths `yaml:"path"`
Batch *ConfigBatch `yaml:"batch"`
Auth *ConfigAuth `yaml:"auth"`
Cron *ConfigCron `yaml:"cron"`
Cache *ConfigCache `yaml:"cache"`
Workers *ConfigWorkers `yaml:"workers"`
Webhooks *ConfigWebhooks `yaml:"webhooks"`
Email *ConfigEmail `yaml:"email"`
Plausible *ConfigPlausible `yaml:"plausible"`
Languages []string `yaml:"languages"`
Servers []string `yaml:"servers"`
Blocklist *ConfigBlocklist `yaml:"blocklist"`
}
Config is MRS configuration model
type ConfigAuth ¶
type ConfigAuth struct {
Admin echobasicauth.Auth `yaml:"admin"`
Metrics echobasicauth.Auth `yaml:"metrics"`
Discovery echobasicauth.Auth `yaml:"discovery"`
Moderation echobasicauth.Auth `yaml:"moderation"`
}
ConfigAuth - auth-related configuration
type ConfigBatch ¶
type ConfigBatch struct {
Rooms int `yaml:"rooms"`
}
ConfigBatch - batches related configuration
type ConfigBlocklist ¶
ConfigBlocklist - blocklist related configuration
type ConfigCache ¶
type ConfigCache struct {
MaxAge int `yaml:"max_age"`
MaxAgeSearch int `yaml:"max_age_search"`
Bunny ConfigCacheBunny `yaml:"bunny"`
}
ConfigCache - cache-related configuration
type ConfigCacheBunny ¶
ConfigCacheBunny BunnyCDN cache purging config
type ConfigCron ¶
type ConfigCron struct {
Discovery string `yaml:"discovery"`
Parsing string `yaml:"parsing"`
Indexing string `yaml:"indexing"`
Full string `yaml:"full"`
}
ConfigCron - cronjobs config
type ConfigEmail ¶
type ConfigEmail struct {
Postmark ConfigEmailPostmark `yaml:"postmark"`
Moderation string `yaml:"moderation"`
Templates ConfigEmailTemplates `yaml:"templates"`
}
ConfigEmail - email related configuration
type ConfigEmailPostmark ¶
type ConfigEmailPostmark struct {
Token string `yaml:"server_token"`
Report ConfigEmailPostmarkType `yaml:"report"`
}
ConfigEmailPostmark is Postmark config
type ConfigEmailPostmarkType ¶
type ConfigEmailPostmarkType struct {
Stream string `yaml:"message_stream"`
From string `yaml:"from"`
}
ConfigEmailPostmarkType is postmark config for specific email type
type ConfigEmailTemplate ¶
ConfigEmailTemplate - email template config
type ConfigEmailTemplates ¶
type ConfigEmailTemplates struct {
Report ConfigEmailTemplate `yaml:"report"`
}
ConfigEmailTemplates - email temaplates config
type ConfigMatrix ¶
type ConfigMatrix struct {
ServerName string `yaml:"server_name"`
Support *msc1929.Response `yaml:"support"`
Keys []string `yaml:"keys"`
OldKeys []string `yaml:"old_keys"`
}
ConfigMatrix - matrix server config
type ConfigPaths ¶
ConfigPaths - paths configuration
type ConfigPlausible ¶
ConfigPlausible - plausible analytics configuration
type ConfigPublic ¶
type ConfigPublic struct {
Name string `yaml:"name"`
UI string `yaml:"ui"`
API string `yaml:"api"`
}
ConfigPublic - instance public information
type ConfigSearch ¶
type ConfigSearch struct {
Defaults ConfigSearchDefaults `yaml:"defaults"`
}
ConfigSearch - search-related configuration
type ConfigSearchDefaults ¶
type ConfigSearchDefaults struct {
Limit int `yaml:"limit"`
Offset int `yaml:"offset"`
SortBy string `yaml:"sort_by"`
}
ConfigSearchDefaults default params
type ConfigWebhooks ¶
ConfigWebhooks - webhooks related config
type ConfigWorkers ¶
ConfigWorkers - workers related configuration
type Entry ¶
type Entry struct {
ID string `json:"id" yaml:"id"`
Type string `json:"type"`
Alias string `json:"alias" yaml:"alias"`
Name string `json:"name" yaml:"name"`
Topic string `json:"topic" yaml:"topic"`
Avatar string `json:"avatar" yaml:"avatar"`
AvatarURL string `json:"avatar_url" yaml:"avatar_url"`
Server string `json:"server" yaml:"server"`
Members int `json:"members" yaml:"members"`
Language string `json:"language" yaml:"language"`
RoomType string `json:"room_type" yaml:"room_type"`
JoinRule string `json:"join_rule" yaml:"join_rule"`
GuestJoinable bool `json:"guest_can_join" yaml:"guest_can_join"`
WorldReadable bool `json:"world_readable" yaml:"world_readable"`
}
Entry represents indexable and/or indexed matrix room
func (*Entry) IsBlocked ¶
func (r *Entry) IsBlocked(block BlocklistService) bool
IsBlocked checks if room's server is blocked
func (*Entry) RoomDirectory ¶
func (r *Entry) RoomDirectory() *RoomDirectoryRoom
RoomDirectory converts processed matrix room intro room directory's room
type IndexStats ¶
type IndexStats struct {
Servers IndexStatsServers `json:"servers"`
Rooms IndexStatsRooms `json:"rooms"`
Discovery IndexStatsTime `json:"discovery"`
Parsing IndexStatsTime `json:"parsing"`
Indexing IndexStatsTime `json:"indexing"`
}
IndexStats structure
type IndexStatsRooms ¶
type IndexStatsRooms struct {
Indexed int `json:"indexed"`
Parsed int `json:"parsed"`
Banned int `json:"banned"`
Reported int `json:"reported"`
}
IndexStatsRooms structure
type IndexStatsServers ¶
type IndexStatsServers struct {
Online int `json:"online"`
Indexable int `json:"indexable"`
Blocked int `json:"blocked"`
}
IndexStatsServers structure
type IndexStatsTime ¶
type IndexStatsTime struct {
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at"`
}
IndexStatsTime structure
type Key ¶
type Key struct {
ID string
Private ed25519.PrivateKey
Public string
}
Key is ed25519 key
type MatrixError ¶
type MatrixError struct {
HTTP string `json:"-"` // HTTP Status e.g., 401 Unauthorized
Code string `json:"errcode"` // Matrix error code, e.g M_UNAUTHORIZED
Message string `json:"error"` // Matrix error message
}
MatrixError model
type MatrixRoom ¶
type MatrixRoom struct {
ID string `json:"room_id"`
Name string `json:"name"`
Topic string `json:"topic"`
Alias string `json:"canonical_alias"`
Avatar string `json:"avatar_url"`
Members int `json:"num_joined_members"`
RoomType string `json:"room_type"`
JoinRule string `json:"join_rule"`
GuestJoinable bool `json:"guest_can_join"`
WorldReadable bool `json:"world_readable"`
// Parsed (custom) fields
Server string `json:"server"`
Language string `json:"language"`
AvatarURL string `json:"avatar_url_http"`
ParsedAt time.Time `json:"parsed_at"`
}
MatrixRoom from matrix client-server API
func (*MatrixRoom) DirectoryEntry ¶
func (r *MatrixRoom) DirectoryEntry() *RoomDirectoryRoom
DirectoryEntry converts matrix room into matrix room directory entry
func (*MatrixRoom) Entry ¶
func (r *MatrixRoom) Entry() *Entry
Entry converts matrix room to search entry
func (*MatrixRoom) Parse ¶
func (r *MatrixRoom) Parse(detector lingua.LanguageDetector, mrsPublicURL string)
Parse matrix room info to prepare custom fields
func (*MatrixRoom) Servers ¶
func (r *MatrixRoom) Servers(ownServerName string) []string
Servers returns all servers from the room object, except own server
type MatrixServer ¶
type MatrixServer struct {
Name string `json:"name"`
URL string `json:"url"`
Online bool `json:"online"`
Indexable bool `json:"indexable"`
Contacts MatrixServerContacts `json:"contacts"` // Contacts as per MSC1929
OnlineAt time.Time `json:"online_at"`
UpdatedAt time.Time `json:"updated_at"` // Deprecated
}
MatrixServer info
type MatrixServerContacts ¶
type MatrixServerContacts struct {
Emails []string `json:"emails"`
MXIDs []string `json:"mxids"`
URL string `json:"url"`
}
MatrixServerContacts - MSC1929
func (MatrixServerContacts) IsEmpty ¶
func (c MatrixServerContacts) IsEmpty() bool
type RoomDirectoryFilter ¶
type RoomDirectoryFilter struct {
GenericSearchTerm string `json:"generic_search_term"`
RoomTypes []string `json:"room_types,omitempty"`
}
RoomDirectoryFilter for the RoomDirectoryRequest
type RoomDirectoryRequest ¶
type RoomDirectoryRequest struct {
Filter RoomDirectoryFilter `json:"filter"`
Limit int `json:"limit" query:"limit"`
Since string `json:"since" query:"since"`
}
RoomDirectoryRequest sent when calling POST /_matrix/federation/v1/publicRooms
type RoomDirectoryResponse ¶
type RoomDirectoryResponse struct {
Chunk []*RoomDirectoryRoom `json:"chunk"`
NextBatch string `json:"next_batch"`
PrevBatch string `json:"prev_batch"`
Total int `json:"total_room_count_estimate"`
}
RoomDirectoryResponse of /_matrix/federation/v1/publicRooms
type RoomDirectoryRoom ¶
type RoomDirectoryRoom struct {
Avatar string `json:"avatar_url,omitempty"`
Alias string `json:"canonical_alias,omitempty"`
GuestJoinable bool `json:"guest_can_join"`
JoinRule string `json:"join_rule,omitempty"`
Name string `json:"name,omitempty"`
Members int `json:"num_joined_members"`
ID string `json:"room_id"`
RoomType string `json:"room_type,omitempty"`
Topic string `json:"topic,omitempty"`
WorldReadable bool `json:"world_readable"`
}
RoomDirectoryRoom is MatrixRoom, but without any computed fields
func (*RoomDirectoryRoom) Convert ¶
func (r *RoomDirectoryRoom) Convert() *MatrixRoom
Convert room directory's room to matrix room