- 新增 internal/security/ipinfo:基于 projectdiscovery/cdncheck v1.3.0 (离线指纹、零外部请求)识别来源 IP 归属,识别失败折叠为展示标签, 不中断告警链路 - autoban 告警回调注入归属识别;告警邮件新增「网络归属」行, 命中 CDN/代理网络时提示「封禁可能无法拦截真实来源」 - 新增邮件模板渲染回归测试 internal/mail/mail_alert_test.go - dev/s3stub:webp(cgo) 本地类型检查桩,替换 s3.go 做全模块编译验证, 生产 Linux 构建不受影响;dev/overlay.json 指向该桩 - go mod tidy 顺带升级共享依赖(lipgloss/xid/testify 等), 全模块类型检查与相关包测试通过
32 lines
1.2 KiB
Go
32 lines
1.2 KiB
Go
// s3_stub.go 是 internal/storage/s3.go 的本地编译桩:s3.go 依赖 cgo 库
|
|
// chai2010/webp(需要 libwebp + C 工具链),Windows 沙箱无此环境。
|
|
// 通过 `go build -overlay=dev/overlay.json` 用本文件替换 s3.go,做全模块类型检查。
|
|
// 符号覆盖 = s3.go 中被包内其他文件(oss.go 引用 isSupportedImage)与
|
|
// 包外调用方(route/user、route/question、route/chat 等)引用的全部标识符。
|
|
// 桩仅在类型检查时生效,不会被真正调用;生产构建在 Linux(cgo + libwebp)下不受影响。
|
|
package storage
|
|
|
|
import (
|
|
"io"
|
|
"mime/multipart"
|
|
)
|
|
|
|
// MaxUploadBytes 与真实实现保持一致(8MB 单图上限,bodylimit 中间件依赖此值语义)。
|
|
const MaxUploadBytes = 8 * 1024 * 1024
|
|
|
|
func UploadPictureToS3(file multipart.File, fileHeader *multipart.FileHeader) (string, error) {
|
|
return "", nil
|
|
}
|
|
|
|
func UploadAvatarToS3(file multipart.File, fileHeader *multipart.FileHeader) (string, error) {
|
|
return "", nil
|
|
}
|
|
|
|
func UploadBackgroundToS3(file multipart.File, fileHeader *multipart.FileHeader) (string, error) {
|
|
return "", nil
|
|
}
|
|
|
|
func ConvertStaticImageToWebP(r io.Reader) ([]byte, error) { return nil, nil }
|
|
|
|
func isSupportedImage(data []byte) bool { return true }
|