- 每个连接记录一条日志:协议、端口、来源 IP、用户名、成功/失败、 失败原因(密码错误/IP封禁/中继被拒/发件人伪造/未认证发信等)、 操作摘要、消息数与会话时长 - 管理后台新增「协议日志」页:按协议/状态/IP/用户名/时间筛选, 今日与历史成功/失败统计卡片,分页查看,可手动清理 - 后台每 6 小时自动清理超出 protocol_log_keep_days(默认30天) 的日志;新增 [web] protocol_log_keep_days 配置项 - 修复 POP3 认证既有 bug:handleUSER 丢弃邮箱域名导致 PASS 永远失败 - 新增 store 单测、SMTP/POP3 端到端测试与模板渲染测试
40 lines
983 B
Go
40 lines
983 B
Go
package store
|
|
|
|
import (
|
|
"mail_go/internal/db"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// Stores aggregates all store interfaces for convenient access.
|
|
type Stores struct {
|
|
Users UserStore
|
|
Mails MailStore
|
|
Domains DomainStore
|
|
Attachments AttachmentStore
|
|
Bans BanStore
|
|
Outbound OutboundStore
|
|
ProtocolLogs ProtocolLogStore
|
|
}
|
|
|
|
// NewStores creates a new Stores instance with all GORM-backed implementations.
|
|
func NewStores(database *gorm.DB) *Stores {
|
|
return &Stores{
|
|
Users: newUserStore(database),
|
|
Mails: newMailStore(database),
|
|
Domains: newDomainStore(database),
|
|
Attachments: newAttachmentStore(database),
|
|
Bans: newBanStore(database),
|
|
Outbound: newOutboundStore(database),
|
|
ProtocolLogs: newProtocolLogStore(database),
|
|
}
|
|
}
|
|
|
|
// Ensure models are referenced (prevents unused import errors).
|
|
var _ = db.User{}
|
|
var _ = db.Domain{}
|
|
var _ = db.Message{}
|
|
var _ = db.Attachment{}
|
|
var _ = db.BanEntry{}
|
|
var _ = db.ProtocolLog{}
|