bridgeconfig

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MPL-2.0 Imports: 14 Imported by: 22

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 dbutil.Config `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"`
	AsyncTransactions bool `yaml:"async_transactions"`
}

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    zeroconfig.Config `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(matcher string) *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 EncryptionConfig

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

	PlaintextMentions bool `yaml:"plaintext_mentions"`

	DeleteKeys struct {
		DeleteOutboundOnAck       bool `yaml:"delete_outbound_on_ack"`
		DontStoreOutbound         bool `yaml:"dont_store_outbound"`
		RatchetOnDecrypt          bool `yaml:"ratchet_on_decrypt"`
		DeleteFullyUsedOnDecrypt  bool `yaml:"delete_fully_used_on_decrypt"`
		DeletePrevOnNewSession    bool `yaml:"delete_prev_on_new_session"`
		DeleteOnDeviceDelete      bool `yaml:"delete_on_device_delete"`
		PeriodicallyDeleteExpired bool `yaml:"periodically_delete_expired"`
	} `yaml:"delete_keys"`

	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"`

	PublicAddress string `yaml:"public_address,omitempty"`

	Software HomeserverSoftware `yaml:"software"`

	StatusEndpoint                string `yaml:"status_endpoint"`
	MessageSendCheckpointEndpoint string `yaml:"message_send_checkpoint_endpoint"`

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

type HomeserverSoftware added in v0.12.1

type HomeserverSoftware string
const (
	SoftwareStandard HomeserverSoftware = "standard"
	SoftwareAsmux    HomeserverSoftware = "asmux"
	SoftwareHungry   HomeserverSoftware = "hungry"
)

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