netinfo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPInfo

type IPInfo struct {
	IP       string   `json:"ip"`
	Type     string   `json:"type"`
	Location Location `json:"location"`
}

IPInfo represents information about an IP address

type IPInfoError

type IPInfoError struct {
	IP           string `json:"ip"`
	Type         string `json:"type"`
	ErrorMessage string `json:"errorMessage"`
}

IPInfoError represents an error response for IP information

type IPInfosResponse

type IPInfosResponse struct {
	Data []interface{} `json:"data"`
}

IPInfosResponse represents the response for bulk IP info requests

type Location

type Location struct {
	Country    string  `json:"country"`
	Region     string  `json:"region"`
	City       string  `json:"city"`
	Lat        float64 `json:"lat"`
	Lng        float64 `json:"lng"`
	PostalCode string  `json:"postalCode"`
	Timezone   string  `json:"timezone"`
	GeonameID  int     `json:"geonameId"`
}

Location represents the geographic location information

type NetInfo

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

NetInfo is the client for geo information services

func New

func New(options ...Option) (*NetInfo, error)

New creates a new NetInfo client with functional options

func (*NetInfo) GetIPInfo

func (n *NetInfo) GetIPInfo(ctx context.Context, ip string) (*IPInfo, error)

GetIPInfo fetches GeoIP information for a given IP address

func (*NetInfo) GetIPInfos

func (n *NetInfo) GetIPInfos(ctx context.Context, ips []string) ([]interface{}, error)

GetIPInfos fetches GeoIP information for multiple IP addresses

func (*NetInfo) SetErrorHandler

func (n *NetInfo) SetErrorHandler(handler func(error))

SetErrorHandler sets a custom error handler function

type Option

type Option func(*Options)

Option is a functional option for configuring the NetInfo client

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the API key for authentication

func WithBaseURI

func WithBaseURI(uri string) Option

WithBaseURI sets the base URI for the NetInfo service

type Options

type Options struct {
	APIKey  string
	BaseURI string
}

Options represents configuration options for the NetInfo client

Jump to

Keyboard shortcuts

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