ip2region

package
v3.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPv4Rule = `([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})`
)

Variables

This section is empty.

Functions

func IPInfo

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

func Initialize

func Initialize() (err error)

func IsInitialized

func IsInitialized() bool

func Register

func Register(p *WANIPProvider) (err error)

func SetDictFile

func SetDictFile(f string)

func Stringify

func Stringify(info ip2region.IpInfo) string

func Unregister

func Unregister(names ...string)

Types

type WANIP

type WANIP struct {
	IPv4      string
	IPv6      string
	QueryTime time.Time
}

func GetWANIP

func GetWANIP(noCaches ...bool) (wanIP WANIP, err error)

type WANIPProvider

type WANIPProvider struct {
	Name        string
	Description string
	URL         string
	Method      string
	IP4Rule     string
	IP6Rule     string

	Disabled bool
	// contains filtered or unexported fields
}

func Get

func Get(name string) *WANIPProvider

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