ip

package
v0.0.0-...-1bf96ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IndexLen 索引长度
	IndexLen = 7
	// RedirectMode1 国家的类型, 指向另一个指向
	RedirectMode1 = 0x01
	// RedirectMode2 国家的类型, 指向一个指向
	RedirectMode2 = 0x02
)

Variables

View Source
var IPData fileData

IPData IP库的数据

View Source
var Service_IP string

Functions

func GetAccessLogByIp

func GetAccessLogByIp(accessLogs []*waf.WafAccessLogDto)

func GetAccessLogMapByIp

func GetAccessLogMapByIp(accessLogs []*waf.WafAccessLogMapDto)

func GetClientIp

func GetClientIp() (string, error)

func GetIpAddr

func GetIpAddr(ips []string) map[string]ResultQQwry

func GetOnline

func GetOnline() ([]byte, error)

GetOnline get data from online server

func GetServerIp

func GetServerIp(serverIpUrl string) string

func InitIP

func InitIP()

Types

type QQwry

type QQwry struct {
	Data   *fileData
	Offset int64
}

QQwry 纯真ip库

func NewQQwry

func NewQQwry() QQwry

NewQQwry 新建 qqwry 类型

func (*QQwry) Find

func (q *QQwry) Find(ip string) (res ResultQQwry)

Find ip地址查询对应归属地信息

func (*QQwry) ReadData

func (q *QQwry) ReadData(num int, offset ...int64) (rs []byte)

ReadData 从文件中读取数据

func (*QQwry) SetOffset

func (q *QQwry) SetOffset(offset int64)

SetOffset 设置偏移量

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response 向客户端返回数据的

type ResultQQwry

type ResultQQwry struct {
	IP      string `json:"ip"`
	Country string `json:"country"`
	Area    string `json:"area"`
}

ResultQQwry 归属地信息

func GetOnlyIpAddr

func GetOnlyIpAddr(ip string) ResultQQwry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL