GeoLock
Geo-blocking is a system that allows certain countries not to tune in to your stream. Is this to be racist? Not at all! Due the lack of international music licensing corporations many stations get legal issues by being able to serve listeners in a certain country where they are not registered.
Allow-/denylist
Cast's GeoLock can operate in two modes.
Allowlist mode will only allow the countries to be tuned in which you specified. Any others will not be able to tune in. If a country is unknown due lack of info it will get blocked too.
Denylist mode will only ban certain countries that you listed. If Cast it unable to get info on the IP it will get treated as a non-blocked one and the listener will gain access.
You can change the behaviour for unknown IPs by using allowUnknown
config.json
If the geolock
tag is not in your config.json file you have to add it. If it is not present it will assume it is disabled.
"geolock":{
"enabled":true,
"mode":"allowlist",
"countryCodes":["BE","FR","GB"],
"maxmindDatabase":"/home/maya/GeoLite2-City.mmdb",
"allowUnknown": false
}
enabled
: This defines if GeoLock is enabled or disabled by setting it to true
or false
mode
: As explained above this can be either allowlist
or denylist
countryCodes
: This has to be a JSON array of ISO 3166-1 alpha-2 codes
maxmindDatabase
: Cast uses the Maxmind GeoLite database to lookup the IP. We are not allowed to distribute these but we provided instructions to add these below. The property has to be an array of the files that have to be loaded. As IPv4 and IPv6 are separate databases multiple files have to be loaded.
allowUnknown
: will allow unknown IPs if you're in allowlist mode
Maxmind GeoLite
We suggest using the maxmind-geolite-mirror
npm module to get the files of the Maxmind website in an easy way that can also be automated.
sudo npm install -g maxmind-geolite-mirror
export MAXMIND_DB_DIR=/home/maya/maxmind/ #Please change this
/usr/local/bin/maxmind-geolite-mirror
Long term solution
Geo-blocking is against Internet freedom. To make the Internet a better and more open place supporting political parties that support a copyright reformation might not be a bad idea. In the European Union the MEP Julia Reda made a point of stopping geo-blocking within member states.
Updated over 6 years ago