apis

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorQueueFull  = errors.New("queue is full")
	ErrorQueueEmpty = errors.New("queue is emtpy")
)
View Source
var ErrTooManyRequests error = fmt.Errorf("error HTTP 429")

Functions

This section is empty.

Types

type IPLocator

type IPLocator struct {

	// API url
	IPAPIUrl string
	// contains filtered or unexported fields
}

PEER LOCALIZER

func NewIPLocator

func NewIPLocator(ctx context.Context, dbCli PostgresDBService, IPAPIUrl string) *IPLocator

func (*IPLocator) CallApi

func (ipLoc *IPLocator) CallApi(ip string) (iPInfo models.IPInfo, delay time.Duration, attemptsLeft int, err error)

func (*IPLocator) Close

func (ipLoc *IPLocator) Close()

func (*IPLocator) LocateIP

func (ipLoc *IPLocator) LocateIP(ip string)

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

func (*IPLocator) Run

func (ipLoc *IPLocator) Run()

Run the necessary routines to locate IPs

type PostgresDBService

type PostgresDBService interface {
	PersistIPInfo(models.IPInfo)
	GetIPInfo(string) (models.IPInfo, error)
	CheckIPRecords(string) (bool, bool, error)
	GetExpiredIPInfo() ([]string, error)
}

DB Interface for PostgresDBService

Jump to

Keyboard shortcuts

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