maxmind

package
v0.0.0-...-23d3fd2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrInfo

type AddrInfo struct {
	Country   string
	Continent string
	ASN       uint
}

type Client

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

func NewClient

func NewClient() (*Client, error)

NewClient initializes a new maxmind database client from the embedded database

func (*Client) AddrAS

func (c *Client) AddrAS(addr string) (uint, string, error)

AddrAS takes an IP address string and tries to derive the Autonomous System Number

func (*Client) AddrGeoInfo

func (c *Client) AddrGeoInfo(addr string) (string, string, error)

AddrGeoInfo takes an IP address string and tries to derive the Country ISO code and continent code.

func (*Client) Close

func (c *Client) Close() error

func (*Client) MaddrInfo

func (c *Client) MaddrInfo(ctx context.Context, maddr ma.Multiaddr) (map[string]*AddrInfo, error)

MaddrInfo resolve the give multi address to its corresponding IP addresses (it could be multiple due to protocols like dnsaddr) and returns a map of the form IP-address -> Country ISO code.

Jump to

Keyboard shortcuts

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