feat(hook): Add hook module to help decouple some specific logic (#784)

This commit is contained in:
Shui
2025-11-08 20:02:30 -05:00
committed by GitHub
parent 52b0bfe1d2
commit 631fb62d21
12 changed files with 466 additions and 35 deletions

19
hook/ip_hook.go Normal file
View File

@@ -0,0 +1,19 @@
package hook
import "github.com/rs/zerolog/log"
type IpResult struct {
Err error
IP string
}
func (r *IpResult) Error() error {
return r.Err
}
func (r *IpResult) GetResult() string {
if r.Err != nil {
log.Printf("⚠️ 执行GetIP时出错: %v", r.Err)
}
return r.IP
}