Documentation ¶
Index ¶
- Constants
- func IsValidRegex(regexString string) bool
- func Load(configPath string) error
- func LoadMonolithic(configPath string) error
- func SetConfig(cfg *Dendrite)
- type Address
- type ApplicationService
- type ApplicationServiceNamespace
- type ChannelConf
- type ConsumerConf
- type DataBaseConf
- type DataSource
- type Dendrite
- type DistLockConf
- type Error
- type LicenseConf
- type Logger
- type Path
- type ProducerConf
- type SkipItem
- type TransportConf
Constants ¶
const DebugRequest = false
const DefaultCompressLength = 1024 * 1024
const Version = 0
Version is the current version of the config format. This will change whenever we make breaking changes to the config format.
Variables ¶
This section is empty.
Functions ¶
func IsValidRegex ¶
IsValidRegex returns true or false based on whether the given string is valid regex or not
func Load ¶
Load a yaml config file for a server run as multiple processes. Checks the config to ensure that it is valid. The checks are different if the server is run as a monolithic process instead of being split into multiple components
func LoadMonolithic ¶
LoadMonolithic loads a yaml config file for a server run as a single monolith. Checks the config to ensure that it is valid. The checks are different if the server is run as a monolithic process instead of being split into multiple components
Types ¶
type ApplicationService ¶
type ApplicationService struct { // User-defined, unique, persistent ID of the application service ID string `yaml:"id"` // Base URL of the application service URL string `yaml:"url"` // Application service token provided in requests to a homeserver ASToken string `yaml:"as_token"` // Homeserver token provided in requests to an application service HSToken string `yaml:"hs_token"` // Localpart of application service user SenderLocalpart string `yaml:"sender_localpart"` InterestedAll bool `yaml:"interested_all"` // Information about an application service's namespaces NamespaceMap map[string][]ApplicationServiceNamespace `yaml:"namespaces"` }
ApplicationService represents a Matrix application service. https://matrix.org/docs/spec/application_service/unstable.html
func (*ApplicationService) IsInterestedInRoomAlias ¶
func (a *ApplicationService) IsInterestedInRoomAlias( roomAlias string, ) bool
IsInterestedInRoomAlias returns a bool on whether an application service's namespace includes the given room alias
func (*ApplicationService) IsInterestedInRoomID ¶
func (a *ApplicationService) IsInterestedInRoomID( roomID string, ) bool
IsInterestedInRoomID returns a bool on whether an application service's namespace includes the given room ID
func (*ApplicationService) IsInterestedInUserID ¶
func (a *ApplicationService) IsInterestedInUserID( userID string, ) bool
IsInterestedInUserID returns a bool on whether an application service's namespace includes the given user ID
type ApplicationServiceNamespace ¶
type ApplicationServiceNamespace struct { // Whether or not the namespace is managed solely by this application service Exclusive bool `yaml:"exclusive"` // A regex pattern that represents the namespace Regex string `yaml:"regex"` // Regex object representing our pattern. Saves having to recompile every time RegexpObject *regexp.Regexp }
ApplicationServiceNamespace is the namespace that a specific application service has management over.
type ChannelConf ¶
type ConsumerConf ¶
type ConsumerConf struct { Topic string `yaml:"topic"` Group string `yaml:"group"` Underlying string `yaml:"underlying"` Name string `yaml:"name"` AutoCommit *bool `yaml:"enable_auto_commit,omitempty"` CommitIntervalMS *int `yaml:"auto_commit_interval_ms,omitempty"` AutoOffsetReset *string `yaml:"topic_auto_offset_reset,omitempty"` EnableGoChannel *bool `yaml:"go_channel_enable,omitempty"` }
func (*ConsumerConf) AutoCommitIntervalMS ¶
func (c *ConsumerConf) AutoCommitIntervalMS() *int
func (*ConsumerConf) EnableAutoCommit ¶
func (c *ConsumerConf) EnableAutoCommit() *bool
func (*ConsumerConf) GoChannelEnable ¶
func (c *ConsumerConf) GoChannelEnable() *bool
func (*ConsumerConf) TopicAutoOffsetReset ¶
func (c *ConsumerConf) TopicAutoOffsetReset() *string
type DataBaseConf ¶
type DataSource ¶
type DataSource string
A DataSource for opening a postgresql database using lib/pq.
type Dendrite ¶
type Dendrite struct { // The version of the configuration file. // If the version in a file doesn't match the current dendrite config // version then we can give a clear error message telling the user // to update their config file to the current version. // The version of the file should only be different if there has // been a breaking change to the config file format. Version int `yaml:"version"` // The configuration required for a matrix server. Matrix struct { // The name of the server. This is usually the domain name, e.g 'matrix.org', 'localhost'. ServerName []string `yaml:"server_name"` HomeServerURL string `yaml:"homeserver_url"` IdentityServerURL string `yaml:"identity_server_url"` InstanceId int `yaml:"instance_id"` // Path to the private key which will be used to sign requests and events. PrivateKeyPath Path `yaml:"private_key"` // The private key which will be used to sign requests and events. PrivateKey ed25519.PrivateKey `yaml:"-"` // An arbitrary string used to uniquely identify the PrivateKey. Must start with the // prefix "ed25519:". KeyID gomatrixserverlib.KeyID `yaml:"-"` // List of paths to X509 certificates used by the external federation listeners. // These are used to calculate the TLS fingerprints to publish for this server. // Other matrix servers talking to this server will expect the x509 certificate // to match one of these certificates. // The certificates should be in PEM format. FederationCertificatePaths []Path `yaml:"federation_certificates"` // A list of SHA256 TLS fingerprints for the X509 certificates used by the // federation listener for this server. TLSFingerPrints []gomatrixserverlib.TLSFingerprint `yaml:"-"` // How long a remote server can cache our server key for before requesting it again. // Increasing this number will reduce the number of requests made by remote servers // for our key, but increases the period a compromised key will be considered valid // by remote servers. // Defaults to 24 hours. KeyValidityPeriod time.Duration `yaml:"key_validity_period"` // List of domains that the server will trust as identity servers to // verify third-party identifiers. // Defaults to an empty array. TrustedIDServers []string `yaml:"trusted_third_party_id_servers"` // If set, allows registration by anyone who also has the shared // secret, even if registration is otherwise disabled. RegistrationSharedSecret string `yaml:"registration_shared_secret"` // This Home Server's ReCAPTCHA public key. RecaptchaPublicKey string `yaml:"recaptcha_public_key"` // This Home Server's ReCAPTCHA private key. RecaptchaPrivateKey string `yaml:"recaptcha_private_key"` // Boolean stating whether catpcha registration is enabled // and required RecaptchaEnabled bool `yaml:"enable_registration_captcha"` // Secret used to bypass the captcha registration entirely RecaptchaBypassSecret string `yaml:"captcha_bypass_secret"` // HTTP API endpoint used to verify whether the captcha response // was successful RecaptchaSiteVerifyAPI string `yaml:"recaptcha_siteverify_api"` // If set disables new users from registering (except via shared // secrets) RegistrationDisabled bool `yaml:"registration_disabled"` ServerFromDB bool `yaml:"server_from_db"` } `yaml:"matrix"` // The configuration specific to the media repostitory. Media struct { NetdiskUrl string `yaml:"netdisk_url"` UploadUrl string `yaml:"upload_url"` DownloadUrl string `yaml:"download_url"` ThumbnailUrl string `yaml:"thumbnail_url"` MediaInfoUrl string `yaml:"mediainfo_url"` } `yaml:"media"` TransportConfs []TransportConf `yaml:"transport_configs"` ChannelConfs []ChannelConf `yaml:"channel_configs"` // The configuration for talking to kafka. Kafka struct { Statistics struct { ProducerInterval int `yaml:"producer_interval"` ConsumerInterval int `yaml:"consumer_interval"` } `yaml:"statistics"` CommonCfg struct { EnableIdempotence bool `yaml:"enable_idempotence"` ForceAsyncSend bool `yaml:"force_async_send"` ReplicaFactor int `yaml:"replica_factor"` NumPartitions int `yaml:"num_partitions"` NumProducers int `yaml:"num_producers"` } `yaml:"common_cfg"` Producer struct { OutputRoomEvent ProducerConf `yaml:"output_room_event"` InputRoomEvent ProducerConf `yaml:"input_room_event"` OutputClientData ProducerConf `yaml:"output_client_data"` OutputProfileData ProducerConf `yaml:"output_profile_data"` DBUpdates ProducerConf `yaml:"db_updates"` GetVisibilityRange ProducerConf `yaml:"get_visibility_range"` OutputRoomFedEvent ProducerConf `yaml:"output_room_fed_event"` FedEduUpdate ProducerConf `yaml:"fed_edu_update"` EventRecover ProducerConf `yaml:"output_room_event_recover"` FedBridgeOut ProducerConf `yaml:"fed_bridge_out"` FedBridgeOutHs ProducerConf `yaml:"fed_bridge_out_hs"` FedBridgeOutRes ProducerConf `yaml:"fed_bridge_out_res"` DeviceStateUpdate ProducerConf `yaml:"output_device_state_update"` SettingUpdate ProducerConf `yaml:"setting_update"` UserInfoUpdate ProducerConf `yaml:"user_info_update"` } `yaml:"producers"` Consumer struct { OutputRoomEventPublicRooms ConsumerConf `yaml:"output_room_event_publicroom"` // OutputRoomEventPublicRooms "public-rooms", OutputRoomEventAppservice ConsumerConf `yaml:"output_room_event_appservice"` // OutputRoomEventAppservice applicationService OutputRoomEventSyncServer ConsumerConf `yaml:"output_room_event_syncserver"` // OutputRoomEventSyncServer, "sync-server" OutputRoomEventSyncWriter ConsumerConf `yaml:"output_room_event_syncwriter"` // OutputRoomEventSyncServer, "sync-writer" OutputRoomEventSyncAggregate ConsumerConf `yaml:"output_room_event_syncaggregate"` // OutputRoomEventSyncServer, "sync-aggregate" InputRoomEvent ConsumerConf `yaml:"input_room_event"` // InputRoomEvent "roomserver" OutputClientData ConsumerConf `yaml:"output_client_data"` // OutputClientData "sync-api" OutputProfileSyncAggregate ConsumerConf `yaml:"output_profile_syncaggregate"` // OutputClientData "sync-api" OutputProfileSyncServer ConsumerConf `yaml:"output_profile_syncserver"` // OutputClientData "sync-api" CacheUpdates ConsumerConf `yaml:"cache_updates"` // DBUpdates persist-cache DBUpdates ConsumerConf `yaml:"db_updates"` // DBUpdates persist-db FedBridgeOut ConsumerConf `yaml:"fed_bridge_out"` FedBridgeOutHs ConsumerConf `yaml:"fed_bridge_out_hs"` FedBridgeOutRes ConsumerConf `yaml:"fed_bridge_out_res"` // fed api in SettingUpdateSyncServer ConsumerConf `yaml:"setting_update_syncserver"` SettingUpdateSyncAggregate ConsumerConf `yaml:"setting_update_syncaggregate"` SetttngUpdateProxy ConsumerConf `yaml:"setting_update_proxy"` SettingUpdateContent ConsumerConf `yaml:"setting_update_content"` DownloadMedia ConsumerConf `yaml:"download_media"` } `yaml:"consumers"` } `yaml:"kafka"` Rpc struct { RsQryTopic string `yaml:"rs_qry_topic"` PrQryTopic string `yaml:"pr_qry_topic"` AliasTopic string `yaml:"alias_topic"` RoomInputTopic string `yaml:"room_input_topic"` FedAliasTopic string `yaml:"fed_alias_topic"` FedProfileTopic string `yaml:"fed_profile_topic"` FedAvatarTopic string `yaml:"fed_avatar_topic"` FedDisplayNameTopic string `yaml:"fed_displayname_topic"` FedRsQryTopic string `yaml:"fed_rs_qry_topic"` FedDownloadTopic string `yaml:"fed_download_topic"` FedInviteTopic string `yaml:"fed_invite_topic"` FedUserInfoTopic string `yaml:"fed_user_info_topic"` FedMakeJoinTopic string `yaml:"fed_make_join_topic"` FedSendJoinTopic string `yaml:"fed_send_join_topic"` FedMakeLeaveTopic string `yaml:"fed_make_leave_topic"` FedSendLeaveTopic string `yaml:"fed_send_leave_topic"` ProxyClientApiTopic string `yaml:"proxy_client_api_topic"` ProxyEncryptoApiTopic string `yaml:"proxy_encrypto_api_topic"` ProxyPublicRoomApiTopic string `yaml:"proxy_publicroom_api_topic"` ProxyPushApiTopic string `yaml:"proxy_push_api_topic"` ProxySyncApiTopic string `yaml:"proxy_sync_api_topic"` ProxySyncAggregateApiTopic string `yaml:"proxy_syncaggregate_api_topic"` ProxyFedApiTopic string `yaml:"proxy_fed_api_topic"` ProxyBgmgrApiTopic string `yaml:"proxy_bgmgr_api_topic"` ProxyRCSServerApiTopic string `yaml:"proxy_rcsserver_api_topic"` } `yaml:"rpc"` Redis struct { Uris []string `yaml:"uris"` } `yaml:"redis"` Nats struct { Uri string `yaml:"uri"` } `yaml:"nats"` // Postgres Config Database struct { EnableBatch bool `yaml:"enable_batch"` CreateDB DataBaseConf `yaml:"create_db"` // The Account database stores the login details and account information // for local users. It is accessed by the ClientAPI. Account DataBaseConf `yaml:"account"` // The Device database stores session information for the devices of logged // in local users. It is accessed by the ClientAPI, the MediaAPI and the SyncAPI. Device DataBaseConf `yaml:"device"` // The ServerKey database caches the public keys of remote servers. // It may be accessed by the FederationAPI, the ClientAPI, and the MediaAPI. ServerKey DataBaseConf `yaml:"server_key"` // The SyncAPI stores information used by the SyncAPI server. // It is only accessed by the SyncAPI server. SyncAPI DataBaseConf `yaml:"sync_api"` // The RoomServer database stores information about matrix rooms. // It is only accessed by the RoomServer. RoomServer DataBaseConf `yaml:"room_server"` // The PublicRoomsAPI database stores information used to compute the public // room directory. It is only accessed by the PublicRoomsAPI server. PublicRoomsAPI DataBaseConf `yaml:"public_rooms_api"` // presence database Presence DataBaseConf `yaml:"presence"` // Encryption api database EncryptAPI DataBaseConf `yaml:"encrypt_api"` // The Naffka database is used internally by the naffka library, if used. Naffka DataBaseConf `yaml:"naffka,omitempty"` //Push server database PushAPI DataBaseConf `yaml:"push_api"` ApplicationService DataBaseConf `yaml:"application_service"` ServerConf DataBaseConf `yaml:"server_conf"` Content DataBaseConf `yaml:"content"` RCSServer DataBaseConf `yaml:"rcs_server"` UseSync bool `yaml:"use_sync"` } `yaml:"database"` // TURN Server Config TURN struct { // TODO Guest Support // Whether or not guests can request TURN credentials //AllowGuests bool `yaml:"turn_allow_guests"` // How long the authorization should last UserLifetime string `yaml:"turn_user_lifetime"` // The list of TURN URIs to pass to clients URIs []string `yaml:"turn_uris"` // Authorization via Shared Secret // The shared secret from coturn SharedSecret string `yaml:"turn_shared_secret"` // Authorization via Static Username & Password // Hardcoded Username and Password Username string `yaml:"turn_username"` Password string `yaml:"turn_password"` } `yaml:"turn"` // The internal addresses the components will listen on. // These should not be exposed externally as they expose metrics and debugging APIs. Listen struct { MediaAPI Address `yaml:"media_api"` ClientAPI Address `yaml:"client_api"` FederationAPI Address `yaml:"federation_api"` SyncAPI Address `yaml:"sync_api"` RoomServer Address `yaml:"room_server"` PublicRoomsAPI Address `yaml:"public_rooms_api"` PushAPI Address `yaml:"push_api"` } `yaml:"listen"` // The config for tracing the dendrite servers. Tracing struct { // The config for the jaeger opentracing reporter. Jaeger jaegerconfig.Configuration `yaml:"jaeger"` } `yaml:"tracing"` // Application Services // https://matrix.org/docs/spec/application_service/unstable.html ApplicationServices struct { // Configuration files for various application services ConfigFiles []string `yaml:"config_files"` } `yaml:"application_services"` Authorization struct { // Configuration for login authorize mode AuthorizeMode string `yaml:"login_authorize_mode"` AuthorizeCode string `yaml:"login_authorize_code"` } `yaml:"authorization"` PushService struct { // Configuration for push service RemoveFailTimes int `yaml:"remove_fail_times"` PushServerUrl string `yaml:"push_server_url"` AndroidPushServerUrl string `yaml:"android_push_server_url"` } `yaml:"push_service"` Log struct { Signaled bool Level string `yaml:"level"` Files []string `yaml:"files"` Underlying string `yaml:"underlying"` WriteToStdout bool `yaml:"write_to_stdout"` RedirectStderr bool `yaml:"redirect_stderr"` ZapConfig struct { MaxSize int `yaml:"max_size"` MaxBackups int `yaml:"max_backups"` MaxAge int `yaml:"max_age"` LocalTime bool `yaml:"localtime"` Compress bool `yaml:"compress"` JsonFormat bool `yaml:"json_format"` BtEnabled bool `yaml:"bt_enabled"` BtLevel string `yaml:"bt_level"` FieldSeparator string `yaml:"field_separator"` } `yaml:"zap_config"` } `yaml:"log"` // Any information derived from the configuration options for later use. Derived struct { Registration struct { // Flows is a slice of flows, which represent one possible way that the client can authenticate a request. // http://matrix.org/docs/spec/HEAD/client_server/r0.3.0.html#user-interactive-authentication-api // As long as the generated flows only rely on config file options, // we can generate them on startup and store them until needed Flows []external.AuthFlow `json:"flows"` // Params that need to be returned to the client during // registration in order to complete registration stages. Params map[string]interface{} `json:"params"` } // Application Services parsed from their config files // The paths of which were given above in the main config file ApplicationServices []ApplicationService // A meta-regex compiled from all exclusive Application Service // Regexes. When a user registers, we check that their username // does not match any exclusive Application Service namespaces ExclusiveApplicationServicesUsernameRegexp *regexp.Regexp } `yaml:"-"` Migration struct { // Configuration for migration DomainName string `yaml:"domain_name"` UpdateAvatar bool `yaml:"update_avatar"` ProcessDevice bool `yaml:"process_device"` AppendWhenRoomExist bool `yaml:"append_when_room_exist"` SynapseDB string `yaml:"synapse_db"` GoRoomDB string `yaml:"go_room_db"` GoAccountDB string `yaml:"go_account_db"` SynapseUrl string `yaml:"synapse_url"` MigrationList []string `yaml:"migration_list"` IgnoreRooms []string `yaml:"ignore_rooms"` RoomList []string `yaml:"room_list"` } `yaml:"migration"` Cache struct { DurationDefault int `yaml:"durationDefault"` DurationRefresh int `yaml:"durationRefresh"` } `yaml:"cache"` Macaroon struct { Key string `yaml:"macaroonKey"` Id string `yaml:"macaroonId"` Loc string `yaml:"macaroonLoc"` } `yaml:"macaroon"` EventSkip struct { Items []SkipItem `yaml:"skip_item_list"` } `yaml:"eventskip"` CompressLength int64 `yaml:"compress_length"` Lru struct { MaxEntries int `yaml:"max_entries"` GcPerNum int `yaml:"gc_per_num"` } `yaml:"lru"` FlushDelay int `yaml:"flush_delay"` SyncMngChanNum uint32 `yaml:"sync_mng_chan_num"` RecoverPath string `yaml:"recover_path"` SendMemberEvent bool `yaml:"send_member_event"` UseMessageFilter bool `yaml:"use_message_filter"` CalculateReadCount bool `yaml:"calculate_read_count"` RetryFlushDB bool `yaml:"retry_flush_db"` PubLoginInfo bool `yaml:"pub_login_info"` UseEncrypt bool `yaml:"use_encrypt"` DefaultAvatar string `yaml:"default_avatar"` DebugLevel string `yaml:"debug_level"` TokenRewrite struct { StaffDomain string `yaml:"staff_domain"` RetailDomain string `yaml:"retail_domain"` StaffDB string `yaml:"staff_db"` RetailDB string `yaml:"retail_db"` } `yaml:"token_rewrite"` MultiInstance struct { Instance uint32 `yaml:"instance"` Total uint32 `yaml:"total"` MultiWrite bool `yaml:"multi_write"` SyncServerTotal uint32 `yaml:"sync_server_total"` } `yaml:"multi_instance"` DeviceMng struct { ScanUnActive int64 `yaml:"scan_unactive"` KickUnActive int64 `yaml:"kick_unactive"` } `yaml:"device_mng"` StateMgr struct { StateNotify bool `yaml:"state_notify"` StateOffline int64 `yaml:"state_offline"` StateOfflineIOS int64 `yaml:"state_offline_ios"` } `yaml:"state_mgr"` Encryption struct { Mirror bool `yaml:"mirror"` } `yaml:"encryption"` NotaryService struct { CliHttpsEnable bool `yaml:"cli_https_enable"` SrvHttpsEnable bool `yaml:"srv_https_enable"` RootCAUrl string `yaml:"root_ca_url"` CRLUrl string `yaml:"crl_url"` CertUrl string `yaml:"cert_url"` } `yaml:"notary_service"` ExternalMigration struct { Enable bool `yaml:"enable"` Services string `yaml:"services"` MongoURL string `yaml:"mongo_url"` } `yaml:"external_migration"` DistLockCustom struct { Instance DistLockConf `yaml:"instance"` RoomState DistLockConf `yaml:"room_state"` RoomStateExt DistLockConf `yaml:"room_state_ext"` } `yaml:"dist_lock_custom"` License string `yaml:"license"` LicenseItem LicenseConf }
Dendrite contains all the config used by a dendrite process. Relative paths are resolved relative to the current working directory
func (*Dendrite) GetDBConfig ¶
func (*Dendrite) RoomServerURL ¶
RoomServerURL returns an HTTP URL for where the roomserver is listening.
type DistLockConf ¶
type Error ¶
type Error struct { // List of problems encountered parsing the config. Problems []string }
An Error indicates a problem parsing the config.
type LicenseConf ¶
type LicenseConf struct { OrganName string `json:"organ_name"` ExpireTime int64 `json:"expire_time"` TotalUsers int64 `json:"total_users"` TotalRooms int64 `json:"total_rooms"` RoomMembers int64 `json:"room_members"` Desc string `json:"desc"` OrganDomain string `json:"organ_domain"` EegOrgan string `json:"reg_organ"` Encryption bool `json:"encryption"` Secret string `json:"secret"` }
type ProducerConf ¶
type ProducerConf struct { Topic string `yaml:"topic"` Underlying string `yaml:"underlying"` Name string `yaml:"name"` Inst int `yaml:"inst"` //producer instance number, default one instance LingerMs *string `yaml:"linger_ms,omitempty"` }
func (*ProducerConf) LingerMsConf ¶
func (p *ProducerConf) LingerMsConf() *string