store

package
v0.0.0-...-188759b Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetKey

func AssetKey(uri string) *datastore.Key

AssetKey creates the datastore key for an asset

func Close

func Close()

Close does the clean-up

func CreateAsset

func CreateAsset(ctx context.Context, as *api.Asset) (string, error)

CreateAsset stores an asset in the Datastore

func CreateGeoLocation

func CreateGeoLocation(ctx context.Context, ip string) error

CreateGeoLocation looks up the IP's geolocation if it is unknown

func CreateMeasurement

func CreateMeasurement(ctx context.Context, m *types.MeasurementDS) error

CreateMeasurement records a link activation

func GeoLocationKey

func GeoLocationKey(ip string) *datastore.Key

GeoLocationKey creates the datastore key for a geolocation

func GetAsset

func GetAsset(ctx context.Context, uri string) (*api.Asset, error)

GetAsset retrieves the asset

Types

type LocationType

type LocationType struct {
	Text        string `xml:",chardata"`
	IP          string `xml:"ip"`
	Host        string `xml:"host"`
	Isp         string `xml:"isp"`
	City        string `xml:"city"`
	Countrycode string `xml:"countrycode"`
	Countryname string `xml:"countryname"`
	Latitude    string `xml:"latitude"`
	Longitude   string `xml:"longitude"`
}

LocationType holds the geo data

func (*LocationType) AsInternal

func (r *LocationType) AsInternal() *types.GeoLocationDS

AsInternal converts the geolocation into the internal DS struct

type LookupResult

type LookupResult struct {
	XMLName xml.Name    `xml:"ip"`
	Text    string      `xml:",chardata"`
	Results ResultsType `xml:"results"`
}

LookupResult is the struct returned by a lookup on geoiplookup.net

type ResultsType

type ResultsType struct {
	XMLName xml.Name     `xml:"results"`
	Text    string       `xml:",chardata"`
	Result  LocationType `xml:"result"`
}

ResultsType container for the location

Jump to

Keyboard shortcuts

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