apis

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ModuleName string = "PEER-LOCALIZER"

	Log = logrus.WithField(
		"module", ModuleName,
	)

	TooManyRequestError = "error HTTP 429"
)

Functions

This section is empty.

Types

type IpApiMessage

type IpApiMessage struct {
	Query       string  `json:"query"`
	Status      string  `json:"status"`
	Country     string  `json:"country"`
	CountryCode string  `json:"countryCode"`
	Region      string  `json:"region"`
	RegionName  string  `json:"regionName"`
	City        string  `json:"city"`
	Zip         string  `json:"zip"`
	Lat         float64 `json:"lat"`
	Lon         float64 `json:"lon"`
	Timezone    string  `json:"timezone"`
	Isp         string  `json:"isp"`
	Org         string  `json:"org"`
	As          string  `json:"as"`
}

IP-API message structure

type PeerLocalizer

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

func NewPeerLocalizer

func NewPeerLocalizer(ctx context.Context, cacheSize int) PeerLocalizer

func (*PeerLocalizer) Close

func (c *PeerLocalizer) Close()

func (*PeerLocalizer) LocateIP

func (c *PeerLocalizer) LocateIP(ip string) (IpApiMessage, error)

LocateIP is an externa request that any module could do to identify an IP

func (*PeerLocalizer) Run

func (c *PeerLocalizer) Run()

Run the necessary routines to locate the IPs

Jump to

Keyboard shortcuts

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