Files
tamabox/.workbuddy/backup/autoban-track-notfound-20260905/static.go
T
2026-09-08 10:10:44 +08:00

129 lines
5.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright 2022 E99p1ant. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package conf
// Build time and commit information.
//
// ⚠️ WARNING: should only be set by "-ldflags".
var (
BuildTime string
BuildCommit = "dev"
)
var (
App struct {
Production bool `ini:"production"`
ExternalURL string `ini:"external_url"`
ICP string `ini:"icp"`
DefaultLang string `ini:"default_lang"` // 站点默认语言(zh-CN/zh-TW/en/ja),留空回退简体中文
UptraceDSN string `ini:"uptrace_dsn"`
QiniuAccessKey string `ini:"qiniu_access_key"`
QiniuAccessSecret string `ini:"qiniu_access_secret"`
AliyunAccessKey string `ini:"aliyun_access_key"`
AliyunAccessKeySecret string `ini:"aliyun_access_key_secret"`
SentryDSN string `ini:"sentry_dsn"`
MaintenanceMode bool `ini:"maintenance_mode"`
ShareBackground string `ini:"share_background"`
FontPath string `ini:"font_path"`
}
Security struct {
EnableTextCensor bool `ini:"enable_text_censor"`
IPBlacklist string `ini:"ip_blacklist"`
IPBlacklistRedirectURL string `ini:"ip_blacklist_redirect_url"`
// TrustProxy 为 true 时信任 CDN 权威客户端头 CF-Connecting-IP / EO-Client-IP
// (以及受信代理设置的 X-Real-IP / X-Forwarded-For);否则一律使用 RemoteAddr,
// 防止客户端伪造 header 绕过速率限制与 IP 黑名单。
TrustProxy bool `ini:"trust_proxy"`
// TrustedProxies 逗号分隔的 IP / CIDR 列表,仅限“你自己的”反向代理/负载均衡基础设施
// (例如本机 nginx 的 127.0.0.1、私有网络 LB)。仅当 TCP 对端落在该清单内时才会解析
// X-Forwarded-For / X-Real-IP。留空则这两个头永不被信任(CDN 权威头 CF-Connecting-IP /
// EO-Client-IP 仍会被采用,前提是源站已被对应 CDN 锁定)。
// 目的:避免维护 Cloudflare / EdgeOne 等上游 CDN 的庞大 CIDR 清单——源站应配合
// Cloudflare Tunnel / Authenticated Origin Pull / 防火墙仅放行 CDN 回源网段锁定,
// 使 CF-Connecting-IP / EO-Client-IP 成为权威客户端 IP。
TrustedProxies string `ini:"trusted_proxies"`
// 自动封禁(fail2ban 风格):检测批量扫描/探测特征后临时封禁来源 IP。
EnableAutoBan bool `ini:"enable_auto_ban"`
BanThresholdSensitive int `ini:"ban_threshold_sensitive"` // 窗口内敏感路径命中次数
BanThreshold404 int `ini:"ban_threshold_404"` // 窗口内 404 次数
BanWindowSeconds int `ini:"ban_window_seconds"` // 统计窗口(秒)
BanDurationMinutes int `ini:"ban_duration_minutes"` // 封禁时长(分钟)
SecurityAlertEmail string `ini:"security_alert_email"` // 触发封禁时告警收件人(留空不发送)
}
Server struct {
Port int `ini:"port"`
Listen string `ini:"listen"` // 绑定监听地址(含端口)。留空则默认 ":port"(监听所有网卡)。
Salt string `ini:"salt"`
XSRFKey string `ini:"xsrf_key"`
}
Database struct {
DSN string
Type string `ini:"type"`
User string `ini:"user"`
Password string `ini:"password"`
Host string `ini:"host"`
Port uint `ini:"port"`
Name string `ini:"name"`
Schema string `ini:"schema"`
DedupeUniqueFields bool `ini:"dedupe_unique_fields"`
}
Redis struct {
Addr string `ini:"addr"`
Password string `ini:"password"`
}
Recaptcha struct {
CaptchaType string `ini:"captcha_type"`
Domain string `ini:"domain"`
SiteKey string `ini:"site_key"`
ServerKey string `ini:"server_key"`
TurnstileStyle bool `ini:"turnstile_style"`
}
Pixel struct {
Host string `ini:"host"`
}
Upload struct {
DefaultAvatarURL string `ini:"default_avatar"`
DefaultBackground string `ini:"default_background"`
DefaultBackgroundImageURL string `ini:"default_qrbackgroundimage"`
AliyunEndpoint string `ini:"aliyun_endpoint"`
AliyunAccessID string `ini:"aliyun_access_id"`
AliyunAccessSecret string `ini:"aliyun_access_secret"`
AliyunBucket string `ini:"aliyun_bucket"`
AliyunBucketCDNHost string `ini:"aliyun_bucket_cdn_host"`
ImageEndpoint string `ini:"image_endpoint"`
ImageAccessID string `ini:"image_access_id"`
ImageAccessSecret string `ini:"image_access_secret"`
ImageBucket string `ini:"image_bucket"`
ImageBucketCDNHost string `ini:"image_bucket_cdn_host"`
}
Mail struct {
Account string `ini:"account"`
Password string `ini:"password"`
Port int `ini:"port"`
SMTP string `ini:"smtp"`
// SkipTLSVerify 跳过 SMTP TLS 证书校验(仅自签名/内网 SMTP 需要,默认 false 校验证书)
SkipTLSVerify bool `ini:"skip_tls_verify"`
}
Service struct {
Backends []struct {
Prefix string `ini:"prefix"`
ForwardURL string `ini:"forward_url"`
}
// TLSInsecureSkipVerify 跳过反向代理到后端服务的 TLS 证书校验
// (仅内网后端使用自签名证书时需要,默认 false 校验证书)
TLSInsecureSkipVerify bool `ini:"tls_insecure_skip_verify"`
}
)