i2c

package
v0.0.0-...-b7cc281 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendAllRIRSubnets

func AppendAllRIRSubnets(mmdb *maxminddb.Reader, entries map[string]string, rirFiles []string, isIPv4Only, lowercase bool, includeCountries, excludeCountries map[string]struct{}) error

AppendAllRIRSubnets uses RIR entries to add missing records to the MaxMind database

func CountrySliceToMap

func CountrySliceToMap(cc []string) (countries map[string]struct{})

CountrySliceToMap converts a slice to a map for faster lookups

func GetDBReader

func GetDBReader(filename string) (*maxminddb.Reader, error)

GetDBReader opens the mmdb file

func GetMMDBFile

func GetMMDBFile(dir, license string) (filename string, err error)

GetMMDBFile extracts the mmdb file. The provided directory serves as a working directory and is intended to be used with a directory created using ioutil.TempDir

func GetMMDBSubnets

func GetMMDBSubnets(mmdb *maxminddb.Reader, entries map[string]string, isIPv4Only, lowercase bool, includeCountries, excludeCountries map[string]struct{}) error

GetMMDBSubnets extracts subnets from the given MaxMind database

func GetRIRFiles

func GetRIRFiles(dir string) (filenames []string, err error)

GetRIRFiles downloads all RIR files concurrently and returns the list of downloaded files. The provided directory serves as a working directory and is intended to be used with a directory created using ioutil.TempDir

func WriteI2C

func WriteI2C(entries map[string]string, outfile, tmpDir string) (err error)

WriteI2C writes the IP-to-coutnry mappings to file

Types

type Record

type Record struct {
	Country struct {
		IsoCode string `maxminddb:"iso_code"`
	} `maxminddb:"country"`
	RegisteredCountry struct {
		IsoCode string `maxminddb:"iso_code"`
	} `maxminddb:"registered_country"`
	IsAnonymousProxy    bool `maxminddb:"is_anonymous_proxy"`
	IsSatelliteProvider bool `maxminddb:"is_satellite_provider"`
}

Record describes a MaxMind DB record entry with only Country fields

Jump to

Keyboard shortcuts

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