iplibrary

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexBlockLength = 12
)

Variables

View Source
var SharedManager = NewManager()

Functions

This section is empty.

Types

type IP2Region

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

func NewIP2Region

func NewIP2Region(path string) (*IP2Region, error)

func (*IP2Region) MemorySearch

func (this *IP2Region) MemorySearch(ipStr string) (ipInfo *IpInfo, err error)

type IP2RegionLibrary

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

func (*IP2RegionLibrary) Close

func (this *IP2RegionLibrary) Close()

func (*IP2RegionLibrary) Load

func (this *IP2RegionLibrary) Load(dbPath string) error

func (*IP2RegionLibrary) Lookup

func (this *IP2RegionLibrary) Lookup(ip string) (*Result, error)

type IpInfo

type IpInfo struct {
	CityId   int64
	Country  string
	Region   string
	Province string
	City     string
	ISP      string
}

func (IpInfo) String

func (ip IpInfo) String() string

type LibraryInterface

type LibraryInterface interface {
	// 加载数据库文件
	Load(dbPath string) error

	// 查询IP
	Lookup(ip string) (*Result, error)

	// 关闭数据库文件
	Close()
}
var SharedLibrary LibraryInterface

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) Load

func (this *Manager) Load() (LibraryInterface, error)

type Result

type Result struct {
	CityId   int64
	Country  string
	Region   string
	Province string
	City     string
	ISP      string
}

func (*Result) Summary

func (this *Result) Summary() string

type Updater

type Updater struct {
}

Updater IP库更新程序

func NewUpdater

func NewUpdater() *Updater

NewUpdater 获取新对象

func (*Updater) Start

func (this *Updater) Start()

Start 开始更新

Jump to

Keyboard shortcuts

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