config

package
v0.0.0-...-8217dc8 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeConfig

type BridgeConfig struct {
	UsernameTemplate    string `yaml:"username_template"`
	DisplaynameTemplate string `yaml:"displayname_template"`
	CommunityTemplate   string `yaml:"community_template"`
	SpaceTemplate       string `yaml:"space_template"`

	ConnectionTimeout     int  `yaml:"connection_timeout"`
	FetchMessageOnTimeout bool `yaml:"fetch_message_on_timeout"`
	DeliveryReceipts      bool `yaml:"delivery_receipts"`
	MaxConnectionAttempts int  `yaml:"max_connection_attempts"`
	ConnectionRetryDelay  int  `yaml:"connection_retry_delay"`
	ReportConnectionRetry bool `yaml:"report_connection_retry"`
	AggressiveReconnect   bool `yaml:"aggressive_reconnect"`
	ChatListWait          int  `yaml:"chat_list_wait"`
	PortalSyncWait        int  `yaml:"portal_sync_wait"`
	UserMessageBuffer     int  `yaml:"user_message_buffer"`
	PortalMessageBuffer   int  `yaml:"portal_message_buffer"`

	CallNotices struct {
		Start bool `yaml:"start"`
		End   bool `yaml:"end"`
	} `yaml:"call_notices"`

	InitialChatSync      int   `yaml:"initial_chat_sync_count"`
	InitialHistoryFill   int   `yaml:"initial_history_fill_count"`
	HistoryDisableNotifs bool  `yaml:"initial_history_disable_notifications"`
	RecoverChatSync      int   `yaml:"recovery_chat_sync_count"`
	RecoverHistory       bool  `yaml:"recovery_history_backfill"`
	ChatMetaSync         bool  `yaml:"chat_meta_sync"`
	UserAvatarSync       bool  `yaml:"user_avatar_sync"`
	BridgeMatrixLeave    bool  `yaml:"bridge_matrix_leave"`
	SyncChatMaxAge       int64 `yaml:"sync_max_chat_age"`

	SyncWithCustomPuppets bool   `yaml:"sync_with_custom_puppets"`
	SyncDirectChatList    bool   `yaml:"sync_direct_chat_list"`
	DefaultBridgeReceipts bool   `yaml:"default_bridge_receipts"`
	DefaultBridgePresence bool   `yaml:"default_bridge_presence"`
	LoginSharedSecret     string `yaml:"login_shared_secret"`

	InviteOwnPuppetForBackfilling bool   `yaml:"invite_own_puppet_for_backfilling"`
	PrivateChatPortalMeta         bool   `yaml:"private_chat_portal_meta"`
	BridgeNotices                 bool   `yaml:"bridge_notices"`
	ResendBridgeInfo              bool   `yaml:"resend_bridge_info"`
	MuteBridging                  bool   `yaml:"mute_bridging"`
	ArchiveTag                    string `yaml:"archive_tag"`
	PinnedTag                     string `yaml:"pinned_tag"`
	TagOnlyOnCreate               bool   `yaml:"tag_only_on_create"`
	MarkReadOnlyOnCreate          bool   `yaml:"mark_read_only_on_create"`

	WhatsappThumbnail bool `yaml:"whatsapp_thumbnail"`

	AllowUserInvite bool `yaml:"allow_user_invite"`

	CommandPrefix string `yaml:"command_prefix"`

	Encryption struct {
		Allow   bool `yaml:"allow"`
		Default bool `yaml:"default"`

		KeySharing struct {
			Allow               bool `yaml:"allow"`
			RequireCrossSigning bool `yaml:"require_cross_signing"`
			RequireVerification bool `yaml:"require_verification"`
		} `yaml:"key_sharing"`
	} `yaml:"encryption"`

	Permissions PermissionConfig `yaml:"permissions"`

	Relaybot RelaybotConfig `yaml:"relaybot"`
	// contains filtered or unexported fields
}

func (BridgeConfig) EnableCommunities

func (bc BridgeConfig) EnableCommunities() bool

func (BridgeConfig) EnableSpaces

func (bc BridgeConfig) EnableSpaces() bool

func (BridgeConfig) FormatCommunity

func (bc BridgeConfig) FormatCommunity(localpart, server string) string

func (BridgeConfig) FormatDisplayname

func (bc BridgeConfig) FormatDisplayname(contact pulsesms.Contact) (string, int8)

func (BridgeConfig) FormatSpace

func (bc BridgeConfig) FormatSpace(localpart, server string) string

func (BridgeConfig) FormatUsername

func (bc BridgeConfig) FormatUsername(userID string) string

func (*BridgeConfig) UnmarshalYAML

func (bc *BridgeConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type CommunityTemplateArgs

type CommunityTemplateArgs struct {
	Localpart string
	Server    string
}

type Config

type Config struct {
	Homeserver struct {
		Address string `yaml:"address"`
		Domain  string `yaml:"domain"`
		Asmux   bool   `yaml:"asmux"`
	} `yaml:"homeserver"`

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

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

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

		StateStore string `yaml:"state_store_path,omitempty"`

		Provisioning struct {
			Prefix       string `yaml:"prefix"`
			SharedSecret string `yaml:"shared_secret"`
		} `yaml:"provisioning"`

		ID  string `yaml:"id"`
		Bot struct {
			Username    string `yaml:"username"`
			Displayname string `yaml:"displayname"`
			Avatar      string `yaml:"avatar"`
		} `yaml:"bot"`

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

	Metrics struct {
		Enabled bool   `yaml:"enabled"`
		Listen  string `yaml:"listen"`
	} `yaml:"metrics"`

	WhatsApp struct {
		OSName      string `yaml:"os_name"`
		BrowserName string `yaml:"browser_name"`
	} `yaml:"whatsapp"`

	Bridge BridgeConfig `yaml:"bridge"`

	Logging appservice.LogConfig `yaml:"logging"`
}

func Load

func Load(path string) (*Config, error)

func (*Config) CanDoublePuppet

func (config *Config) CanDoublePuppet(userID id.UserID) bool

func (*Config) GetRegistration

func (config *Config) GetRegistration() (*appservice.Registration, error)

func (*Config) MakeAppService

func (config *Config) MakeAppService() (*appservice.AppService, error)

func (*Config) NewRegistration

func (config *Config) NewRegistration() (*appservice.Registration, error)

func (*Config) Save

func (config *Config) Save(path string) error

type PermissionConfig

type PermissionConfig map[string]PermissionLevel

func (PermissionConfig) GetPermissionLevel

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

func (PermissionConfig) IsAdmin

func (pc PermissionConfig) IsAdmin(userID id.UserID) bool

func (PermissionConfig) IsRelaybotWhitelisted

func (pc PermissionConfig) IsRelaybotWhitelisted(userID id.UserID) bool

func (PermissionConfig) IsWhitelisted

func (pc PermissionConfig) IsWhitelisted(userID id.UserID) bool

func (*PermissionConfig) MarshalYAML

func (pc *PermissionConfig) MarshalYAML() (interface{}, error)

func (*PermissionConfig) UnmarshalYAML

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

type PermissionLevel

type PermissionLevel int
const (
	PermissionLevelDefault  PermissionLevel = 0
	PermissionLevelRelaybot PermissionLevel = 5
	PermissionLevelUser     PermissionLevel = 10
	PermissionLevelAdmin    PermissionLevel = 100
)

type RelaybotConfig

type RelaybotConfig struct {
	Enabled        bool        `yaml:"enabled"`
	ManagementRoom id.RoomID   `yaml:"management"`
	InviteUsers    []id.UserID `yaml:"invites"`

	MessageFormats map[event.MessageType]string `yaml:"message_formats"`
	// contains filtered or unexported fields
}

func (*RelaybotConfig) FormatMessage

func (rc *RelaybotConfig) FormatMessage(content *event.MessageEventContent, sender id.UserID, member *event.MemberEventContent) (string, error)

func (*RelaybotConfig) UnmarshalYAML

func (rc *RelaybotConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type Sender

type Sender struct {
	UserID id.UserID
	*event.MemberEventContent
}

type SpaceTemplateArgs

type SpaceTemplateArgs struct {
	Localpart string
	Server    string
}

type UsernameTemplateArgs

type UsernameTemplateArgs struct {
	UserID id.UserID
}

Jump to

Keyboard shortcuts

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