1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-24 06:09:01 +08:00
nali/internal/ipdb/db.go

25 lines
350 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
default:
return QQIP
}
}