mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2026-01-27 03:25:47 +08:00
增加ip2region库管理
This commit is contained in:
23
pkg/serverconfigs/ip_library.go
Normal file
23
pkg/serverconfigs/ip_library.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package serverconfigs
|
||||
|
||||
import "github.com/iwind/TeaGo/maps"
|
||||
|
||||
// 所有的IP库类型
|
||||
var IPLibraryTypes = []maps.Map{
|
||||
{
|
||||
"name": "ip2region",
|
||||
"code": "ip2region",
|
||||
"description": "一个开源的IP库:https://github.com/lionsoul2014/ip2region",
|
||||
"ext": ".db",
|
||||
},
|
||||
}
|
||||
|
||||
// 根据类型查找IP库
|
||||
func FindIPLibraryWithType(libraryType string) maps.Map {
|
||||
for _, t := range IPLibraryTypes {
|
||||
if t.GetString("code") == libraryType {
|
||||
return t
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user