ip2region

package
v4.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: AGPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	IPv4Rule = `((?:(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9]))`
	IPv6Rule = `` /* 1211-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func ClearZero added in v4.2.2

func ClearZero(info *ip2region.IpInfo)

func FindIPv4

func FindIPv4(content string) string

func FindIPv6

func FindIPv6(content string) string

func IPInfo

func IPInfo(ip string) (info ip2region.IpInfo, err error)

func IsInitialized

func IsInitialized() bool

func Register

func Register(p *WANIPProvider) (err error)

func SetDictFile

func SetDictFile(f string)

func SetInstance

func SetInstance(newInstance *ip2region.Ip2Region)

func Stringify

func Stringify(info ip2region.IpInfo) string

func Unregister

func Unregister(names ...string)

Types

type WANIP

type WANIP struct {
	IP        string
	QueryTime time.Time
}

func GetWANIP

func GetWANIP(cachedSeconds float64, ipVers ...int) (wanIP WANIP, err error)

type WANIPProvider

type WANIPProvider struct {
	Name        string
	Description string
	URL         string
	Method      string
	IP4Rule     string // 如果是IPv4规则,此项可以为空
	IP6Rule     string // 如果是IPv6规则,此项不能为空(“=”代表整个body数据)

	Disabled bool
	// contains filtered or unexported fields
}

func Get

func Get(name string) *WANIPProvider

func (*WANIPProvider) HasIPv4Rule

func (w *WANIPProvider) HasIPv4Rule() bool

func (*WANIPProvider) HasIPv6Rule

func (w *WANIPProvider) HasIPv6Rule() bool

type WANIPProviders

type WANIPProviders map[string]*WANIPProvider

func (*WANIPProviders) Reload

func (w *WANIPProviders) Reload() error

Jump to

Keyboard shortcuts

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