bridgeconfig

package
v0.0.0-...-3dbc48c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2022 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Upgrader = up.SimpleUpgrader(doUpgrade)

Upgrader is a config upgrader that copies the default fields in the homeserver, appservice and logging blocks.

Functions

func RegisterPermissionLevel

func RegisterPermissionLevel(name string, level PermissionLevel)

Types

type AppserviceConfig

type AppserviceConfig struct {
	Address  string `yaml:"address"`
	Hostname string `yaml:"hostname"`
	Port     uint16 `yaml:"port"`

	Database DatabaseConfig `yaml:"database"`

	ID  string        `yaml:"id"`
	Bot BotUserConfig `yaml:"bot"`

	ASToken string `yaml:"as_token"`
	HSToken string `yaml:"hs_token"`

	EphemeralEvents bool `yaml:"ephemeral_events"`
}

func (*AppserviceConfig) GetRegistration

func (asc *AppserviceConfig) GetRegistration() *appservice.Registration

GetRegistration copies the data from the bridge config into an *appservice.Registration struct. This can't be used with the homeserver, see GenerateRegistration for generating files for the homeserver.

type BaseConfig

type BaseConfig struct {
	Homeserver HomeserverConfig     `yaml:"homeserver"`
	AppService AppserviceConfig     `yaml:"appservice"`
	Bridge     BridgeConfig         `yaml:"-"`
	Logging    appservice.LogConfig `yaml:"logging"`
}

func (*BaseConfig) GenerateRegistration

func (config *BaseConfig) GenerateRegistration() *appservice.Registration

GenerateRegistration generates a registration file for the homeserver.

func (*BaseConfig) MakeAppService

func (config *BaseConfig) MakeAppService() *appservice.AppService

func (*BaseConfig) MakeUserIDRegex

func (config *BaseConfig) MakeUserIDRegex() *regexp.Regexp

type BotUserConfig

type BotUserConfig struct {
	Username    string `yaml:"username"`
	Displayname string `yaml:"displayname"`
	Avatar      string `yaml:"avatar"`

	ParsedAvatar id.ContentURI `yaml:"-"`
}

func (*BotUserConfig) UnmarshalYAML

func (buc *BotUserConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type BridgeConfig

type BridgeConfig interface {
	FormatUsername(username string) string
	GetEncryptionConfig() EncryptionConfig
	GetCommandPrefix() string
	GetManagementRoomTexts() ManagementRoomTexts
	GetResendBridgeInfo() bool
	EnableMessageStatusEvents() bool
	EnableMessageErrorNotices() bool
	Validate() error
}

type DatabaseConfig

type DatabaseConfig struct {
	Type string `yaml:"type"`
	URI  string `yaml:"uri"`

	MaxOpenConns int `yaml:"max_open_conns"`
	MaxIdleConns int `yaml:"max_idle_conns"`

	ConnMaxIdleTime string `yaml:"conn_max_idle_time"`
	ConnMaxLifetime string `yaml:"conn_max_lifetime"`
}

type EncryptionConfig

type EncryptionConfig struct {
	Allow      bool `yaml:"allow"`
	Default    bool `yaml:"default"`
	Require    bool `yaml:"require"`
	Appservice bool `yaml:"appservice"`

	VerificationLevels struct {
		Receive id.TrustState `yaml:"receive"`
		Send    id.TrustState `yaml:"send"`
		Share   id.TrustState `yaml:"share"`
	} `yaml:"verification_levels"`
	AllowKeySharing bool `yaml:"allow_key_sharing"`

	Rotation struct {
		EnableCustom bool  `yaml:"enable_custom"`
		Milliseconds int64 `yaml:"milliseconds"`
		Messages     int   `yaml:"messages"`
	} `yaml:"rotation"`
}

type HomeserverConfig

type HomeserverConfig struct {
	Address    string `yaml:"address"`
	Domain     string `yaml:"domain"`
	AsyncMedia bool   `yaml:"async_media"`

	Asmux                         bool   `yaml:"asmux"`
	StatusEndpoint                string `yaml:"status_endpoint"`
	MessageSendCheckpointEndpoint string `yaml:"message_send_checkpoint_endpoint"`

	WSProxy        string `yaml:"websocket_proxy"`
	WSPingInterval int    `yaml:"ping_interval_seconds"`
}

type ManagementRoomTexts

type ManagementRoomTexts struct {
	Welcome            string `yaml:"welcome"`
	WelcomeConnected   string `yaml:"welcome_connected"`
	WelcomeUnconnected string `yaml:"welcome_unconnected"`
	AdditionalHelp     string `yaml:"additional_help"`
}

type PermissionConfig

type PermissionConfig map[string]PermissionLevel

func (PermissionConfig) Get

func (pc PermissionConfig) Get(userID id.UserID) PermissionLevel

func (*PermissionConfig) UnmarshalYAML

func (pc *PermissionConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type PermissionLevel

type PermissionLevel int
const (
	PermissionLevelBlock PermissionLevel = 0
	PermissionLevelRelay PermissionLevel = 5
	PermissionLevelUser  PermissionLevel = 10
	PermissionLevelAdmin PermissionLevel = 100
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL