Move all directory related functionality into paths utils

As per suggestion by @willscott in: https://github.com/OpenObservatory/gooni/pull/9#discussion_r176760264
This commit is contained in:
Arturo Filastò 2018-03-27 15:09:34 +02:00
commit cffb9ea74c
4 changed files with 54 additions and 31 deletions

View file

@ -36,11 +36,6 @@ var legacyGeoipFiles = map[string]string{
"GeoIP.dat": "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz",
}
// GeoIPDir returns the geoip data dir for the given OONI Home
func GeoIPDir(home string) string {
return filepath.Join(home, "geoip")
}
// Download the file to a temporary location
func downloadToTemp(url string) (string, error) {
out, err := ioutil.TempFile(os.TempDir(), "maxmind")