1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-23 05:39:03 +08:00
nali/internal/ipdb/db.go

27 lines
402 B
Go
Raw Normal View History

2020-07-17 09:05:25 +08:00
package ipdb
2020-07-17 12:12:04 +08:00
import (
"os"
"strings"
)
2020-07-17 09:50:06 +08:00
// ip db interface
2020-07-17 09:05:25 +08:00
type IPDB interface {
Find(ip string) string
}
2020-07-17 12:12:04 +08:00
func GetIPDBType() IPDBType {
dbname := os.Getenv("NALI_DB")
dbname = strings.ToLower(dbname)
switch dbname {
case "geo", "geoip", "geoip2":
return GEOIP2
case "chunzhen", "qqip", "qqwry":
return QQIP
2020-07-21 06:19:52 +08:00
case "ipip", "ipipfree", "ipip.net":
return IPIP
2020-07-17 12:12:04 +08:00
default:
return QQIP
}
}