增加ip获取

This commit is contained in:
ayflying
2025-02-28 14:53:05 +08:00
parent 6765eff93f
commit 45ffdc37fb
11 changed files with 212 additions and 1 deletions

32
service/ip_2_region.go Normal file
View File

@@ -0,0 +1,32 @@
// ================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
type (
IIp2Region interface {
// Load 加载到内存中
//
// @Description: 加载ip2region数据库到内存中。
// @receiver s *sIp2region: sIp2region的实例。
Load()
GetIp(ip string) (res []string)
}
)
var (
localIp2Region IIp2Region
)
func Ip2Region() IIp2Region {
if localIp2Region == nil {
panic("implement not found for interface IIp2Region, forgot register?")
}
return localIp2Region
}
func RegisterIp2Region(i IIp2Region) {
localIp2Region = i
}