Documentation ¶
Overview ¶
Package assets contains the embedded assets.
We embed an uncompressed GeoIP database that you can read using the maxminddb-golang library.
Because the database is uncompressed, OONI binaries are larger however this way we avoid:
1. Writing the data on a local cache and continuously checking the cache to check whether it needs to be updated. Therefore, we're reducing the number of disk accesses that we perform for every measurement session.
2. Having to decompress the data and keep it in memory, which would cause more memory to be used by the OONI process: not only the memory consumed by embedding the compressed database, but also the memory consumed by caching the uncompressed bytes in cache.
3. Having the decompress the data each time we use the databases, which is causing high CPU usage.
In short, this reduces the OONI code complexity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var OOMMDBDatabaseBytes []byte
OOMMDBDatabaseBytes contains the bytes of a maxmind database containing both ASN and country information to be opened using maxminddb.FromBytes. We generate these databases using https://github.com/ooni/historical-geoip.
Functions ¶
This section is empty.
Types ¶
type OOMMDBCountryInfo ¶ added in v0.14.0
type OOMMDBCountryInfo struct {
IsoCode string `maxminddb:"iso_code"`
}
OOMMDBCountryInfo contains country information.
type OOMMDBRecord ¶ added in v0.14.0
type OOMMDBRecord struct { // AutonomousSystemNumber is the AS number. AutonomousSystemNumber uint `maxminddb:"autonomous_system_number"` // AutonomousSystemOrganization is the org name. AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"` // Country contains country info. Country OOMMDBCountryInfo `maxminddb:"country"` }
OOMMDBRecord describes the information inside the database.
func OOMMDBLooup ¶ added in v0.14.0
func OOMMDBLooup(r *maxminddb.Reader, ipAddress net.IP) (*OOMMDBRecord, error)
OOMMDBLookup lookups an IP on a MMDB database that has been generated by OONI using https://github.com/ooni/historical-geoip.