restrict v6

This commit is contained in:
tamakyi
2026-10-18 22:18:21 +08:00
parent d14d26df17
commit bd81398a06
18 changed files with 621 additions and 10 deletions
+16
View File
@@ -113,6 +113,22 @@ func SendSecurityAlertMail(ip, provider string, proxied bool, samplePaths []stri
return sendTemplateMail(conf.Security.SecurityAlertEmail, "【狼的提问箱】检测到疑似批量扫描,已自动封禁 IP", templates.FS, "mail/security-alert.html", params)
}
// SendAbuseAlertMail 发送「某箱主收到集中举报」的阈值告警。
//
// 与 SendSecurityAlertMail 共用 conf.Security.SecurityAlertEmail 收件人,不新增配置项。
// 邮件只给计数与下一步命令,不贴举报内容原文:邮件可能被转发/归档,贴原文等于把挂人内容
// 又复制了一份出去;要看内容请用 reports --domain。
func SendAbuseAlertMail(domain, name string, count24, count7d int64) error {
params := map[string]string{
"domain": domain,
"name": name,
"count24": fmt.Sprintf("%d", count24),
"count7d": fmt.Sprintf("%d", count7d),
"time": time.Now().Format("2006-01-02 15:04:05"),
}
return sendTemplateMail(conf.Security.SecurityAlertEmail, "【狼的提问箱】某箱主收到集中举报", templates.FS, "mail/abuse-alert.html", params)
}
func sendTemplateMail(email, title string, templateFS embed.FS, templatePath string, params map[string]string) error {
var content bytes.Buffer
t, err := template.ParseFS(templateFS, templatePath)