[PATCH] Contrib: remove obsoleted script geo2nginx.pl.

Gena Makhomed gmm at csdoc.com
Thu Apr 5 08:05:12 UTC 2018


On 05.04.2018 10:53, Gena Makhomed wrote:

> # HG changeset patch
> # User Gena Makhomed <gmm at csdoc.com>
> # Date 1522914140 -10800
> #      Thu Apr 05 10:42:20 2018 +0300
> # Node ID 4f14c557c910f88960dbccf6bd3268eb69b31029
> # Parent  d4cc2edb4ff8391d0c7419e91e6fcc988c510654
> Contrib: remove obsoleted script geo2nginx.pl.

In attach original file contrib-convertor.patch
without tabs converted to spaces by mail client.

-- 
Best regards,
  Gena
-------------- next part --------------
# HG changeset patch
# User Gena Makhomed <gmm at csdoc.com>
# Date 1522914140 -10800
#      Thu Apr 05 10:42:20 2018 +0300
# Node ID 4f14c557c910f88960dbccf6bd3268eb69b31029
# Parent  d4cc2edb4ff8391d0c7419e91e6fcc988c510654
Contrib: remove obsoleted script geo2nginx.pl.

GeoLite Legacy Databases no more updated by MaxMind
starting from 01 Apr 2018, see for more details:
https://dev.maxmind.com/geoip/legacy/geolite/

All users need to switch to the GeoLite2 Free Databases,
see https://dev.maxmind.com/geoip/geoip2/geolite2/ fro details.
GeoLite2 Databases has different format and requires different convertor.

diff -r d4cc2edb4ff8 -r 4f14c557c910 contrib/README
--- a/contrib/README	Tue Apr 03 17:38:10 2018 +0300
+++ b/contrib/README	Thu Apr 05 10:42:20 2018 +0300
@@ -1,21 +1,14 @@
 
-geo2nginx.pl 		by Andrei Nigmatulin
+unicode2nginx          by Maxim Dounin
 
-	The perl script to convert CSV geoip database ( free download
-	at http://www.maxmind.com/app/geoip_country ) to format, suitable
-	for use by the ngx_http_geo_module.
+       The perl script to convert unicode mappings ( available
+       at http://www.unicode.org/Public/MAPPINGS/ ) to the nginx
+       configuration file format.
+       Two generated full maps for windows-1251 and koi8-r.
 
 
-unicode2nginx		by Maxim Dounin
+vim                    by Evan Miller
 
-	The perl script to convert unicode mappings ( available
-	at http://www.unicode.org/Public/MAPPINGS/ ) to the nginx
-	configuration file format.
-	Two generated full maps for windows-1251 and koi8-r.
+       Syntax highlighting of nginx configuration for vim, to be
+       placed into ~/.vim/.
 
-
-vim			by Evan Miller
-
-	Syntax highlighting of nginx configuration for vim, to be
-	placed into ~/.vim/.
-
diff -r d4cc2edb4ff8 -r 4f14c557c910 contrib/geo2nginx.pl
--- a/contrib/geo2nginx.pl	Tue Apr 03 17:38:10 2018 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#!/usr/bin/perl -w
-
-# (c) Andrei Nigmatulin, 2005
-#
-# this script provided "as is", without any warranties. use it at your own risk.
-#
-# special thanx to Andrew Sitnikov for perl port
-#
-# this script converts CSV geoip database (free download at http://www.maxmind.com/app/geoip_country)
-# to format, suitable for use with nginx_http_geo module (http://sysoev.ru/nginx)
-#
-# for example, line with ip range
-#
-#   "62.16.68.0","62.16.127.255","1041253376","1041268735","RU","Russian Federation"
-#
-# will be converted to four subnetworks:
-#
-#   62.16.68.0/22 RU;
-#   62.16.72.0/21 RU;
-#   62.16.80.0/20 RU;
-#   62.16.96.0/19 RU;
-
-
-use warnings;
-use strict;
-
-while( <STDIN> ){
-	if (/"[^"]+","[^"]+","([^"]+)","([^"]+)","([^"]+)"/){
-		print_subnets($1, $2, $3);
-	}
-}
-
-sub  print_subnets {
-	my ($a1, $a2, $c) = @_;
-	my $l;
-    while ($a1 <= $a2) {
-		for ($l = 0; ($a1 & (1 << $l)) == 0 && ($a1 + ((1 << ($l + 1)) - 1)) <= $a2; $l++){};
-		print long2ip($a1) . "/" . (32 - $l) . " " . $c . ";\n";
-    	$a1 += (1 << $l);
-	}
-}
-
-sub long2ip {
-	my $ip = shift;
-
-	my $str = 0;
-
-	$str = ($ip & 255);
-
-	$ip >>= 8;
-	$str = ($ip & 255).".$str";
-
-	$ip >>= 8;
-	$str = ($ip & 255).".$str";
-
-	$ip >>= 8;
-	$str = ($ip & 255).".$str";
-}


More information about the nginx-devel mailing list