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

27 lines
402 B
Go

package ipdb
import (
"os"
"strings"
)
// ip db interface
type IPDB interface {
Find(ip string) string
}
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
case "ipip", "ipipfree", "ipip.net":
return IPIP
default:
return QQIP
}
}