Documentation ¶
Index ¶
- Constants
- Variables
- func SetSettings(ctx context.Context, writer *metadata.AsyncWriter, settings Settings) error
- func StartFakeServer(backend smtp.Backend, addr string) func() error
- func ValidateSettings(settings Settings) (err error)
- type AuthMethod
- type FakeMailBackend
- type Notifier
- type SecurityType
- type ServerPort
- type Settings
- type SettingsFetcher
Constants ¶
View Source
const SettingsKey = "messenger_email"
Variables ¶
View Source
var ErrInvalidEmail = errors.New(`Invalid mail value`)
View Source
var ErrParsingAuthMethod = errors.New(`Invalid auth method`)
View Source
var ErrParsingSecurityType = errors.New(`Invalid security type`)
Functions ¶
func SetSettings ¶
func ValidateSettings ¶
Types ¶
type AuthMethod ¶
type AuthMethod int
const ( AuthMethodNone AuthMethod = 0 AuthMethodPassword AuthMethod = 1 )
func ParseAuthMethod ¶
func ParseAuthMethod(s string) (AuthMethod, error)
func (*AuthMethod) MarshalJSON ¶
func (m *AuthMethod) MarshalJSON() ([]byte, error)
func (*AuthMethod) MergoFromString ¶
func (m *AuthMethod) MergoFromString(s string) error
func (AuthMethod) String ¶
func (m AuthMethod) String() string
type FakeMailBackend ¶
type FakeMailBackend struct { ExpectedUser string ExpectedPassword string Messages []*mail.Message }
func (*FakeMailBackend) NewSession ¶
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
func NewWithCustomSettingsFetcher ¶
func NewWithCustomSettingsFetcher(policy core.Policy, settingsFetcher SettingsFetcher) *Notifier
func (*Notifier) Notify ¶
func (m *Notifier) Notify(n core.Notification, translator translator.Translator) error
implement Notifier TODO: split this function into smaller chunks!!!
type SecurityType ¶
type SecurityType int
const ( SecurityTypeNone SecurityType = 0 SecurityTypeSTARTTLS SecurityType = 1 SecurityTypeTLS SecurityType = 2 )
func ParseSecurityType ¶
func ParseSecurityType(s string) (SecurityType, error)
func (*SecurityType) MarshalJSON ¶
func (t *SecurityType) MarshalJSON() ([]byte, error)
func (*SecurityType) MergoFromString ¶
func (t *SecurityType) MergoFromString(s string) error
func (SecurityType) String ¶
func (t SecurityType) String() string
type ServerPort ¶
type ServerPort int
func (*ServerPort) MergoFromString ¶
func (p *ServerPort) MergoFromString(s string) error
type Settings ¶
type Settings struct { Enabled bool `json:"enabled"` SkipCertCheck bool `json:"skip_cert_check"` Sender string `json:"sender"` Recipients string `json:"recipients"` ServerName string `json:"server_name"` ServerPort ServerPort `json:"server_port"` SecurityType SecurityType `json:"security_type"` AuthMethod AuthMethod `json:"auth_method"` Username stringutil.Sensitive `json:"username,omitempty"` Password stringutil.Sensitive `json:"password,omitempty"` }
type SettingsFetcher ¶
type SettingsFetcher func() (*Settings, *globalsettings.Settings, error)
Click to show internal directories.
Click to hide internal directories.