mirror of
https://github.com/zu1k/nali.git
synced 2025-01-23 05:39:03 +08:00
27 lines
402 B
Go
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
|
|
}
|
|
}
|