Versions in this module Expand all Collapse all v0 v0.0.2 Dec 30, 2024 Changes in this version + var ErrConfigInvalid = fmt.Errorf("invalid notification configuration") + var ErrConfigNotFound = fmt.Errorf("notification configuration not found") + var ErrNotEnabled = fmt.Errorf("notification is not enabled") + var ErrNotificationFailed = fmt.Errorf("notification failed to send") + func NewCommand() *cobra.Command + func ValidateConfig(cfg *Config) error + type Config struct + EmailFrom string + EmailTo string + Enabled bool + SMTPPass string + SMTPPort int + SMTPServer string + SMTPUser string + Type string + WebhookURL string + type ConfigError struct + Field string + Message string + func (e *ConfigError) Error() string + type ConfigManager struct + func NewConfigManager() *ConfigManager + func (cm *ConfigManager) BackupConfig() error + func (cm *ConfigManager) DeleteConfig() error + func (cm *ConfigManager) LoadConfig() (*Config, error) + func (cm *ConfigManager) RestoreConfig() error + func (cm *ConfigManager) SaveConfig(cfg Config) error + type ConfigValidator interface + Validate func() error + type EmailNotifier struct + From string + Password string + Port int + Server string + To string + Username string + func NewEmailNotifier(config Config) *EmailNotifier + func (e *EmailNotifier) Send(event LoginEvent) error + func (e *EmailNotifier) Test() error + type LoginEvent struct + Hostname string + IP string + Location string + Timestamp time.Time + Type string + User string + type Notifier interface + Send func(event LoginEvent) error + Test func() error + type NotifyType int + const NotifyTypeEmail + const NotifyTypeWebhook + type ValidationError struct + Errors []ConfigError + func (e *ValidationError) AddError(field, message string) + func (e *ValidationError) Error() string + func (e *ValidationError) HasErrors() bool + type WebhookNotifier struct + URL string + func NewWebhookNotifier(url string) *WebhookNotifier + func (w *WebhookNotifier) Send(event LoginEvent) error + func (w *WebhookNotifier) Test() error