notify

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package notify 提供面板通知渠道的统一抽象

Index

Constants

View Source
const (
	EncryptionNone     = "none"
	EncryptionSSL      = "ssl"
	EncryptionSTARTTLS = "starttls"
)

SMTP 加密方式

View Source
const (
	TypeSMTP = "smtp"
)

通知渠道类型

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Subject string
	Body    string // HTML 正文
}

Message 通知消息

type Notifier

type Notifier interface {
	Send(ctx context.Context, msg *Message) error
}

Notifier 通知渠道

func New

func New(typ string, config json.RawMessage) (Notifier, error)

New 按渠道类型构造通知器,config 为渠道的 JSON 配置

func NewSMTP

func NewSMTP(config json.RawMessage) (Notifier, error)

NewSMTP 构造 SMTP 通知器

type SMTPConfig

type SMTPConfig struct {
	Host       string   `json:"host"`
	Port       int      `json:"port"`
	Encryption string   `json:"encryption"` // none / ssl / starttls
	Username   string   `json:"username"`
	Password   string   `json:"password"`
	From       string   `json:"from"`
	FromName   string   `json:"from_name"`
	To         []string `json:"to"`
	SkipVerify bool     `json:"skip_verify"`
}

SMTPConfig SMTP 渠道配置

Jump to

Keyboard shortcuts

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