maxmind

package
v0.0.0-...-cc45bd3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 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 {
	Continent string
	Country   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) AddrContinent

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

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

func (*Client) AddrCountry

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

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

func (*Client) AddrCountryContinent

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

AddrCountryContinent takes an IP address string and tries to derive the Country ISO code plus 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