Versions in this module Expand all Collapse all v0 v0.1.0 Aug 20, 2024 Changes in this version + const MaxCacheAge + const RobotsTxtPublicRoom + const RobotsTxtPublicRooms + var SearchFieldsBoost = map[string]float64 + type Blocklist struct + func NewBlocklist(cfg ConfigService) *Blocklist + func (b *Blocklist) Add(server string) + func (b *Blocklist) ByID(matrixID string) bool + func (b *Blocklist) ByServer(server string) bool + func (b *Blocklist) Len() int + func (b *Blocklist) Reset() + func (b *Blocklist) Slice() []string + type BlocklistService interface + Add func(server string) + ByID func(matrixID string) bool + ByServer func(server string) bool + Reset func() + Slice func() []string + type Cache struct + func NewCache(cfg ConfigService, stats cacheStats) *Cache + func (cache *Cache) IsBunny(ip string) bool + func (cache *Cache) Middleware() echo.MiddlewareFunc + func (cache *Cache) MiddlewareImmutable() echo.MiddlewareFunc + func (cache *Cache) MiddlewareSearch() echo.MiddlewareFunc + func (cache *Cache) Purge(ctx context.Context) + type Config struct + func NewConfig(path string) (*Config, error) + func (c *Config) Get() *model.Config + func (c *Config) Read(ctx context.Context) + func (c *Config) Write(cfg *model.Config) error + type ConfigService interface + Get func() *model.Config + type Crawler struct + func NewCrawler(cfg ConfigService, fedSvc FederationService, v ValidatorService, ...) *Crawler + func (m *Crawler) AddServer(ctx context.Context, name string) int + func (m *Crawler) AddServers(ctx context.Context, names []string, workers int) + func (m *Crawler) DiscoverServers(ctx context.Context, workers int, overrideList ...*utils.List[string, string]) + func (m *Crawler) EachRoom(ctx context.Context, handler func(roomID string, data *model.MatrixRoom) bool) + func (m *Crawler) GetServersRoomsCount(ctx context.Context) map[string]int + func (m *Crawler) IndexableServers(ctx context.Context) []string + func (m *Crawler) OnlineServers(ctx context.Context) []string + func (m *Crawler) ParseRooms(ctx context.Context, workers int) + type DataFacade struct + func NewDataFacade(crawler dataCrawlerService, index dataIndexService, stats dataStatsService, ...) *DataFacade + func (df *DataFacade) AddServer(ctx context.Context, name string) int + func (df *DataFacade) AddServers(ctx context.Context, names []string, workers int) + func (df *DataFacade) DiscoverServers(ctx context.Context, workers int) + func (df *DataFacade) Full(ctx context.Context, discoveryWorkers, parsingWorkers int) + func (df *DataFacade) GetServersRoomsCount(ctx context.Context) map[string]int + func (df *DataFacade) Ingest(ctx context.Context) + func (df *DataFacade) ParseRooms(ctx context.Context, workers int) + type DataRepository interface + AddRoomBatch func(context.Context, *model.MatrixRoom) + AddServer func(context.Context, *model.MatrixServer) error + BanRoom func(context.Context, string) error + BatchServers func(context.Context, []string) error + EachRoom func(context.Context, func(string, *model.MatrixRoom) bool) + FilterServers func(context.Context, func(server *model.MatrixServer) bool) map[string]*model.MatrixServer + FlushRoomBatch func(context.Context) + GetBannedRooms func(context.Context, ...string) ([]string, error) + GetReportedRooms func(context.Context, ...string) (map[string]string, error) + GetRoom func(context.Context, string) (*model.MatrixRoom, error) + GetServerInfo func(context.Context, string) (*model.MatrixServer, error) + GetServersRoomsCount func(ctx context.Context) map[string]int + HasServer func(context.Context, string) bool + IsReported func(context.Context, string) bool + MarkServersOffline func(context.Context, []string) + RemoveRooms func(context.Context, []string) + RemoveServer func(context.Context, string) error + RemoveServers func(context.Context, []string) + ReportRoom func(context.Context, string, string) error + SaveServersRooms func(ctx context.Context, data map[string][]string) error + SetBiggestRooms func(context.Context, []string) error + SetServersRoomsCount func(ctx context.Context, data map[string]int) error + UnbanRoom func(context.Context, string) error + UnreportRoom func(context.Context, string) error + type Email struct + func NewEmail(cfg ConfigService) *Email + func (e *Email) SendModReport(message, email string) error + func (e *Email) SendReport(ctx context.Context, room *model.MatrixRoom, server *model.MatrixServer, ...) error + type EmailService interface + SendModReport func(text, email string) error + SendReport func(ctx context.Context, room *model.MatrixRoom, server *model.MatrixServer, ...) error + type FederationService interface + QueryCSURL func(ctx context.Context, serverName string) string + QueryPublicRooms func(ctx context.Context, serverName, limit, since string) (*model.RoomDirectoryResponse, error) + QueryServerName func(ctx context.Context, serverName string) (string, error) + QueryVersion func(ctx context.Context, serverName string) (string, string, error) + type Index struct + func NewIndex(cfg ConfigService, index IndexRepository) *Index + func (i *Index) EmptyIndex(ctx context.Context) error + func (i *Index) IndexBatch(ctx context.Context) error + func (i *Index) RoomsBatch(ctx context.Context, roomID string, data *model.Entry) error + type IndexRepository interface + Delete func(roomID string) error + Index func(roomID string, data *model.Entry) error + IndexBatch func(*bleve.Batch) error + NewBatch func() *bleve.Batch + Swap func(ctx context.Context) error + type Lenable interface + Len func() int + type Moderation struct + func NewModeration(cfg ConfigService, data DataRepository, index IndexRepository, ...) *Moderation + func (m *Moderation) Ban(ctx context.Context, roomID string) error + func (m *Moderation) List(ctx context.Context, serverName ...string) ([]string, error) + func (m *Moderation) Report(ctx context.Context, roomID, reason string) error + func (m *Moderation) Unban(ctx context.Context, roomID string) error + type Plausible struct + func NewPlausible(cfg ConfigService) *Plausible + func (p *Plausible) Enabled() bool + func (p *Plausible) TrackSearch(ctx context.Context, incomingReq *http.Request, ip, query string) + type Robots struct + func NewRobots() *Robots + func (r *Robots) Allowed(ctx context.Context, serverName, endpoint string) bool + type RobotsService interface + Allowed func(ctx context.Context, serverName, endpoint string) bool + type Search struct + func NewSearch(cfg ConfigService, data searchDataRepository, repo SearchRepository, ...) *Search + func (s *Search) Search(ctx context.Context, q, sortBy string, limit, offset int) ([]*model.Entry, int, error) + type SearchRepository interface + Search func(ctx context.Context, searchQuery query.Query, limit, offset int, ...) ([]*model.Entry, int, error) + type Stats struct + func NewStats(cfg ConfigService, data StatsRepository, index, blocklist Lenable) *Stats + func (s *Stats) Collect(ctx context.Context) + func (s *Stats) CollectServers(ctx context.Context, reload bool) + func (s *Stats) Get() *model.IndexStats + func (s *Stats) GetTL(ctx context.Context) map[time.Time]*model.IndexStats + func (s *Stats) SetFinishedAt(ctx context.Context, process string, finishedAt time.Time) + func (s *Stats) SetStartedAt(ctx context.Context, process string, startedAt time.Time) + type StatsRepository interface + GetIndexStats func(ctx context.Context) *model.IndexStats + GetIndexStatsTL func(ctx context.Context, prefix string) (map[time.Time]*model.IndexStats, error) + SetFinishedAt func(ctx context.Context, process string, finishedAt time.Time) error + SetIndexBannedRooms func(ctx context.Context, rooms int) error + SetIndexBlockedServers func(ctx context.Context, servers int) error + SetIndexIndexableServers func(ctx context.Context, servers int) error + SetIndexIndexedRooms func(ctx context.Context, rooms int) error + SetIndexOnlineServers func(ctx context.Context, servers int) error + SetIndexParsedRooms func(ctx context.Context, rooms int) error + SetIndexReportedRooms func(ctx context.Context, rooms int) error + SetIndexStatsTL func(ctx context.Context, calculatedAt time.Time, stats *model.IndexStats) error + SetStartedAt func(ctx context.Context, process string, startedAt time.Time) error + type StatsService interface + Get func() *model.IndexStats + type Validator struct + func NewValidator(cfg ConfigService, block BlocklistService, matrix FederationService, ...) *Validator + func (v *Validator) Domain(server string) bool + func (v *Validator) IsIndexable(ctx context.Context, server string) bool + func (v *Validator) IsOnline(ctx context.Context, server string) (string, bool) + func (v *Validator) IsRoomAllowed(ctx context.Context, server string, room *model.MatrixRoom) bool + type ValidatorService interface + Domain func(server string) bool + IsIndexable func(ctx context.Context, server string) bool + IsOnline func(ctx context.Context, server string) (string, bool) + IsRoomAllowed func(ctx context.Context, server string, room *model.MatrixRoom) bool