utils

package
v3.0.0-beta.1+incompat... Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ResultTimestamp = "2006-01-02T150405.999999999Z0700"

ResultTimestamp is a windows friendly timestamp

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath(home string) string

ConfigPath returns the default path to the config file

func DBDir

func DBDir(home string, name string) string

DBDir returns the database dir for the given name

func DownloadGeoIPDatabaseFiles

func DownloadGeoIPDatabaseFiles(dir string) error

DownloadGeoIPDatabaseFiles into the target directory

func DownloadLegacyGeoIPDatabaseFiles

func DownloadLegacyGeoIPDatabaseFiles(dir string) error

DownloadLegacyGeoIPDatabaseFiles into the target directory

func GeoIPDir

func GeoIPDir(home string) string

GeoIPDir returns the geoip data dir for the given OONI Home

func GetOONIHome

func GetOONIHome() (string, error)

GetOONIHome returns the path to the OONI Home

func IPLookup

func IPLookup() (string, error)

IPLookup gets the users IP address from a IP lookup service

func MakeResultsDir

func MakeResultsDir(home string, name string, ts time.Time) (string, error)

MakeResultsDir creates and returns a directory for the result

func RequiredDirs

func RequiredDirs(home string) []string

RequiredDirs returns the required ooni home directories

Types

type LocationInfo

type LocationInfo struct {
	IP          string
	ASN         uint
	NetworkName string
	CountryCode string
}

LocationInfo contains location information

func GeoIPLookup

func GeoIPLookup(dbPath string) (*LocationInfo, error)

GeoIPLookup does a geoip lookup and returns location information

func LookupLocation

func LookupLocation(dbPath string, ipStr string) (LocationInfo, error)

LookupLocation resolves an IP to a location according to the Maxmind DB

Directories

Path Synopsis
Package strcase converts strings to snake_case or CamelCase
Package strcase converts strings to snake_case or CamelCase

Jump to

Keyboard shortcuts

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