# Directory which contains the exported databases.
our $xt_geoip_db_directory = "/usr/share/xt_geoip/";
+# Create libloc database handle.
+my $db_handle = &init();
+
#
## Tiny function to init the location database.
#
## Function to the the country code of a given address.
#
sub lookup_country_code($$) {
- my ($db_handle, $address) = @_;
+ my ($address) = @_;
# Lookup the given address.
my $country_code = &Location::lookup_country_code($db_handle, $address);
# Function to get all available locations.
sub get_locations() {
- # Create libloc database handle.
- my $db_handle = &init();
-
# Get locations which are stored in the location database.
my @database_locations = &Location::database_countries($db_handle);
# Array to store the flags of the address.
my @flags;
- # Init libloc database handle.
- my $db_handle = &init();
-
# Loop through the hash of possible network flags.
foreach my $flag (keys(%network_flags)) {
# Check if the address has the current flag.