mirror of
https://github.com/zu1k/nali.git
synced 2025-01-22 21:29:02 +08:00
31 lines
461 B
Go
31 lines
461 B
Go
package db
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// ip database type
|
|
type IPDBType int
|
|
|
|
const (
|
|
GEOIP2 = iota // geoip2
|
|
QQIP // chunzhen
|
|
IPIP // ipip.net
|
|
)
|
|
|
|
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
|
|
}
|
|
}
|