2021-08-02 12:01:25 +08:00
|
|
|
package dbif
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/zu1k/nali/pkg/cdn"
|
|
|
|
"github.com/zu1k/nali/pkg/geoip"
|
2022-05-17 13:35:48 +08:00
|
|
|
"github.com/zu1k/nali/pkg/ip2location"
|
2022-02-20 11:28:25 +08:00
|
|
|
"github.com/zu1k/nali/pkg/ip2region"
|
2021-08-02 12:01:25 +08:00
|
|
|
"github.com/zu1k/nali/pkg/ipip"
|
|
|
|
"github.com/zu1k/nali/pkg/qqwry"
|
|
|
|
"github.com/zu1k/nali/pkg/zxipv6wry"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QueryType uint
|
|
|
|
|
|
|
|
const (
|
|
|
|
TypeIPv4 = iota
|
|
|
|
TypeIPv6
|
|
|
|
TypeDomain
|
|
|
|
)
|
|
|
|
|
|
|
|
type DB interface {
|
|
|
|
Find(query string, params ...string) (result fmt.Stringer, err error)
|
2023-05-20 17:53:43 +08:00
|
|
|
Name() string
|
2021-08-02 12:01:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
2022-03-02 12:34:11 +08:00
|
|
|
_ DB = &qqwry.QQwry{}
|
|
|
|
_ DB = &zxipv6wry.ZXwry{}
|
|
|
|
_ DB = &ipip.IPIPFree{}
|
|
|
|
_ DB = &geoip.GeoIP{}
|
|
|
|
_ DB = &ip2region.Ip2Region{}
|
2022-05-24 15:16:48 +08:00
|
|
|
_ DB = &ip2location.IP2Location{}
|
2022-03-02 12:34:11 +08:00
|
|
|
_ DB = &cdn.CDN{}
|
2021-08-02 12:01:25 +08:00
|
|
|
)
|