ip2region

package
v3.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

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 FindIPv4 added in v3.6.0

func FindIPv4(content string) string

func FindIPv6 added in v3.6.0

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 added in v3.6.2

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 added in v3.6.0

func (w *WANIPProvider) HasIPv4Rule() bool

func (*WANIPProvider) HasIPv6Rule added in v3.6.0

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