This is a small script for whitelist traffic based on a country. It ilustrates how with ipset chain, you can restrict traffic to a specific country or a list of countries. Basically we are making a chain based from the known county ranges from the site indeny.com .
List of the dependant liberies: Ipset Iptables Git curl