diff --git a/LICENSE.txt b/LICENSE.txt index 741c1ea51..9ee382af2 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -207,7 +207,7 @@ Applications: FatCow icons: See licenses/LICENSE-FatCowIcons.txt GeoIP Data: - Copyright (c) 2008 MaxMind, Inc. All Rights Reserved. + This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/ See licenses/LICENSE-GeoIP.txt Router Console and I2PSnark themes: diff --git a/build.xml b/build.xml index 6caac7170..07073e1a3 100644 --- a/build.xml +++ b/build.xml @@ -1121,7 +1121,9 @@ - + + + @@ -1137,6 +1139,7 @@ + diff --git a/installer/resources/geoipv6-extras.csv b/installer/resources/geoipv6-extras.csv new file mode 100644 index 000000000..414882684 --- /dev/null +++ b/installer/resources/geoipv6-extras.csv @@ -0,0 +1,9 @@ +# Local geoIPv6 additions +# Format: from IP,to IP,,,country code[,"country name"] +#### +# common tunnel brokers +2001:5c0:1000:a::,2001:5c0:1000:a::,,,X1,"Freenet6 anonymous" +2001:5c0:1000:b::,2001:5c0:1000:b::,,,X2,"Freenet6 authenticated" +2001:5c0:1100::,2001:5c0:11ff:ffff:ffff:ffff:ffff:ffff,,,X3,"Freenet6 delegated" +# other interesting addresses +2002::,2002:ffff:ffff:ffff:ffff:ffff:ffff:ffff,,,X4,"IPv4 compatibility" diff --git a/installer/resources/geoipv6.dat.gz b/installer/resources/geoipv6.dat.gz new file mode 100644 index 000000000..fe9273dd3 Binary files /dev/null and b/installer/resources/geoipv6.dat.gz differ diff --git a/installer/resources/makegeoipv6.sh b/installer/resources/makegeoipv6.sh new file mode 100755 index 000000000..390e4ed4b --- /dev/null +++ b/installer/resources/makegeoipv6.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# Fetch the latest file from Maxmind, merge with +# our additions, and compress. +# + +FILE1=GeoIPv6.csv.gz +FILE2=geoipv6-extras.csv +FILEOUT=geoipv6.dat.gz + +rm -f $FILE1 $FILEOUT +wget http://geolite.maxmind.com/download/geoip/database/$FILE1 +if [ "$?" -ne "0" ] +then + echo 'Cannot fetch' + exit 1 +fi +java -cp ../../build/i2p.jar:../../build/router.jar net.i2p.router.transport.GeoIPv6 $FILE1 $FILE2 $FILEOUT +exit $? diff --git a/licenses/LICENSE-GeoIP.txt b/licenses/LICENSE-GeoIP.txt index 6f5b0713d..0c91833ef 100644 --- a/licenses/LICENSE-GeoIP.txt +++ b/licenses/LICENSE-GeoIP.txt @@ -1,32 +1,8 @@ -OPEN DATA LICENSE (GeoLite Country and GeoLite City databases) +The GeoLite databases are distributed under the +Creative Commons Attribution-ShareAlike 3.0 Unported License +http://creativecommons.org/licenses/by-sa/3.0/ . +The attribution requirement may be met by including the following in +all advertising and documentation mentioning features of or use of this database: -Copyright (c) 2008 MaxMind, Inc. All Rights Reserved. - -All advertising materials and documentation mentioning features or use of -this database must display the following acknowledgment: "This product includes GeoLite data created by MaxMind, available from -http://maxmind.com/" - -Redistribution and use with or without modification, are permitted provided -that the following conditions are met: -1. Redistributions must retain the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other -materials provided with the distribution. -2. All advertising materials and documentation mentioning features or use of -this database must display the following acknowledgement: -"This product includes GeoLite data created by MaxMind, available from -http://maxmind.com/" -3. "MaxMind" may not be used to endorse or promote products derived from this -database without specific prior written permission. - -THIS DATABASE IS PROVIDED BY MAXMIND, INC ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL MAXMIND BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -DATABASE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +http://www.maxmind.com/" diff --git a/router/java/src/net/i2p/router/transport/GeoIPv6.java b/router/java/src/net/i2p/router/transport/GeoIPv6.java index 93affec88..36e443c08 100644 --- a/router/java/src/net/i2p/router/transport/GeoIPv6.java +++ b/router/java/src/net/i2p/router/transport/GeoIPv6.java @@ -151,7 +151,9 @@ class GeoIPv6 { int count = 0; InputStream in = null; try { - in = new FileInputStream(geoFile); + in = new BufferedInputStream(new FileInputStream(geoFile)); + if (geoFile.getName().endsWith(".gz")) + in = new GZIPInputStream(in); String buf = null; BufferedReader br = new BufferedReader(new InputStreamReader(in, "ISO-8859-1")); while ((buf = br.readLine()) != null) { @@ -314,6 +316,13 @@ class GeoIPv6 { return rv; } + /** + * Merge and compress CSV files to I2P compressed format + * + * GeoIP infile1.csv[.gz] [infile2.csv[.gz]...] outfile.dat.gz + * + * Used to create the file for distribution, do not comment out + */ public static void main(String args[]) { if (args.length < 2) { System.err.println("Usage: GeoIP infile1.csv [infile2.csv...] outfile.dat.gz");