linode

package
v0.0.0-...-266a499 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShortName   = "linode"
	FullName    = "Linode"
	HostType    = "hosting"
	SourceURL   = "-"
	DownloadURL = "https://geoip.linode.com/"
)

Variables

This section is empty.

Functions

func IsIPv4

func IsIPv4(address string) bool

func IsIPv6

func IsIPv6(address string) bool

Types

type CSVEntry

type CSVEntry struct {
	Prefix     string `csv:"ip_prefix,omitempty"`
	Alpha2Code string `csv:"alpha2code,omitempty"`
	Region     string `csv:"region,omitempty"`
	City       string `csv:"city,omitempty"`
	PostalCode string `csv:"postal_code,omitempty"`
}

type Doc

type Doc struct {
	LastModified time.Time
	ETag         string
	Records      []Record
}

type Entry

type Entry struct {
	Prefix     string `csv:"ip_prefix,omitempty"`
	Alpha2Code string `csv:"alpha2code,omitempty"`
	Region     string `csv:"region,omitempty"`
	City       string `csv:"city,omitempty"`
	PostalCode string `csv:"postal_code,omitempty"`
}

type Linode

type Linode struct {
	Client      *retryablehttp.Client
	DownloadURL string
}

func New

func New() Linode

func (*Linode) Fetch

func (a *Linode) Fetch() (doc Doc, err error)

func (*Linode) FetchData

func (a *Linode) FetchData() (data []byte, headers http.Header, status int, err error)

type Record

type Record struct {
	Prefix     netip.Prefix
	PrefixText string `csv:"ip_prefix,omitempty"`
	Alpha2Code string `csv:"alpha2code,omitempty"`
	Region     string `csv:"region,omitempty"`
	City       string `csv:"city,omitempty"`
	PostalCode string `csv:"postal_code,omitempty"`
}

prefix, alpha2code, region, city, postal_code

func Parse

func Parse(data []byte) (records []Record, err error)

Jump to

Keyboard shortcuts

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