digitalocean

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: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DigitaloceanDownloadURL = "https://www.digitalocean.com/geo/google.csv"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVEntry

type CSVEntry struct {
	Network     string `csv:"network,omitempty"`
	CountryCode string `csv:"countrycode,omitempty"`
	CityCode    string `csv:"citycode,omitempty"`
	CityName    string `csv:"cityname,omitempty"`
	ZipCode     string `csv:"zipcode,omitempty"`
}

type DigitalOcean

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

func New

func New() DigitalOcean

func (*DigitalOcean) Fetch

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

func (*DigitalOcean) FetchData

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

type Doc

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

type Entry

type Entry struct {
	Network     string `csv:"network,omitempty"`
	CountryCode string `csv:"countrycode,omitempty"`
	CityCode    string `csv:"citycode,omitempty"`
	CityName    string `csv:"cityname,omitempty"`
	ZipCode     string `csv:"zipcode,omitempty"`
}

type Record

type Record struct {
	Network     netip.Prefix
	NetworkText string `csv:"network,omitempty"`
	CountryCode string `csv:"countrycode,omitempty"`
	CityCode    string `csv:"citycode,omitempty"`
	CityName    string `csv:"cityname,omitempty"`
	ZipCode     string `csv:"zipcode,omitempty"`
}

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