mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-10 14:27:00 +08:00
feat(hook): Add hook module to help decouple some specific logic (#784)
This commit is contained in:
19
hook/ip_hook.go
Normal file
19
hook/ip_hook.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user