refactor: spin geoipx off geolocate (#893)

A bunch of packages (including oohelperd) just need the ability to
use MaxMind-like databases. They don't need the additional functionality
implemented by the geolocate package. Such a package, in fact, is
mostly (if not only) needed by the engine package.

Therefore, move code to query MaxMind-like databases to a separate
package, and avoid depending on geolocate in all the packages for
which it's sufficient to use geoipx.

Part of https://github.com/ooni/probe/issues/2240
This commit is contained in:
Simone Basso
2022-08-28 20:00:25 +02:00
committed by GitHub
parent 1e7384d1cc
commit 110a11828b
23 changed files with 228 additions and 215 deletions
+35 -8
View File
@@ -1,20 +1,47 @@
package model
import (
"bytes"
"encoding/json"
"errors"
"net"
"time"
)
//
// Definition of the result of a network measurement.
//
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"net"
"time"
)
const (
// DefaultProbeASN is the default probe ASN as a number.
DefaultProbeASN uint = 0
// DefaultProbeCC is the default probe CC.
DefaultProbeCC = "ZZ"
// DefaultProbeIP is the default probe IP.
DefaultProbeIP = "127.0.0.1"
// DefaultProbeNetworkName is the default probe network name.
DefaultProbeNetworkName = ""
// DefaultResolverASN is the default resolver ASN.
DefaultResolverASN uint = 0
// DefaultResolverIP is the default resolver IP.
DefaultResolverIP = "127.0.0.2"
// DefaultResolverNetworkName is the default resolver network name.
DefaultResolverNetworkName = ""
)
var (
// DefaultProbeASNString is the default probe ASN as a string.
DefaultProbeASNString = fmt.Sprintf("AS%d", DefaultProbeASN)
// DefaultResolverASNString is the default resolver ASN as a string.
DefaultResolverASNString = fmt.Sprintf("AS%d", DefaultResolverASN)
)
// MeasurementTarget is the target of a OONI measurement.