GeoIP2 is a library that helps determine the country where an IP address or a hostname is located. It uses free file-based MaxMind GeoLite2 geolocation databases (Country, Country IPv6, City, and ASN).
A database contains blocks of IP addresses as keys, and countries/cities/ASNs as values. Such a database is more complete and accurate than the data obtained by using reverse DNS lookups.
Flussonic Media Server supports GeoIP2 format of the database, the GeoIP format is no longer supported by Flussonic.
How GeoIP2 data is used in Flussonic Media Server¶
With the GeoIP2 databases, you can allow access to a stream only from certain countries by adding the line like this in the stream's settings:
allowed_countries RU UA KZ;
Using the GeoIP2 database shipped with Flussonic¶
By default, Flussonic uses the GeoIP2 library that comes with Flussonic and contains a single database
GeoLite2 Country. The database is located in the
/opt/flussonic/lib/egeoip2/priv/ directory of the Flussonic server:
The GeoIP2 database in Flussonic is a snapshot available at the time of publication. We are doing our best to update it when possible. If your service requires up-to-date GeoIP2 data, you may purchase a third party database and connect it to Flussonic as described below.
Using a separate GeoIP2 library¶
New releases of GeoIP2 databases come out more often than the releases of Flussonic server, so sometimes the database in
/opt/flussonic/lib/egeoip2/priv/ might become outdated.
Install a separate GeoIP2 library and set up Flussonic to use it. This will let you:
- Use the most recent GeoIP2 data - you'll be able to update the databases as often as you wish, without updating Flussonic.
- Use not only the Country database, but also City or ASN.
To use a separate GeoIP2 library:
- Install GeoIP2 databases (see: Installation and update guide).
- Add the
geoip PATH_TO_DATABASE;option to the Flussonic configuration file, where
PATH_TO_DATABASEis the location of one of the installed GeoIP2 databases:
Now Flussonic will use the specified database to determine geolocation.
If the specified database is unavailable, Flussonic will use the database that was shipped with Flussonic.