Blob Blame History Raw
diff -urNp --minimal --exclude-from=/home/mdomsch/excludes /home/mdomsch/cvs/fedora-extras/python-GeoIP/devel/GeoIP-Python-1.2.4/ChangeLog python/ChangeLog
--- /home/mdomsch/cvs/fedora-extras/python-GeoIP/devel/GeoIP-Python-1.2.4/ChangeLog	2008-12-16 07:22:45.000000000 -0600
+++ python/ChangeLog	2009-08-30 21:21:59.000000000 -0500
@@ -1,5 +1,10 @@
+	* Add IPv6 glue *** needs libGeoIP 1.4.7 ***
+		country_code_by_name_v6	
+		country_name_by_name_v6
+		country_code_by_addr_v6
+		country_name_by_addr_v6 ( Boris Zentner )
 1.2.4	2008-12-16
-	* Add charset and set_charset methods , as well as 
+	* Add charset and set_charset methods, as well as 
 		the new attributes GeoIP.GEOIP_CHARSET_ISO_8859_1 and
 		GeoIP.GEOIP_CHARSET_UTF8 ( Boris Zentner )
 	* Add test_city_charset.py script showing howto use
diff -urNp --minimal --exclude-from=/home/mdomsch/excludes /home/mdomsch/cvs/fedora-extras/python-GeoIP/devel/GeoIP-Python-1.2.4/py_GeoIP.c python/py_GeoIP.c
--- /home/mdomsch/cvs/fedora-extras/python-GeoIP/devel/GeoIP-Python-1.2.4/py_GeoIP.c	2009-08-30 14:05:06.000000000 -0500
+++ python/py_GeoIP.c	2009-08-30 21:21:59.000000000 -0500
@@ -83,6 +83,50 @@ GeoIP_GeoIP_dealloc(PyObject* self)
   PyObject_Del(self);
 }
 
+static PyObject * GeoIP_country_code_by_name_v6_Py(PyObject *self, PyObject *args) {
+  char * name;
+  const char * retval;
+  GeoIP_GeoIPObject* GeoIP = (GeoIP_GeoIPObject*)self;
+  if (!PyArg_ParseTuple(args, "s", &name)) {
+    return NULL;
+  }
+  retval = GeoIP_country_code_by_name_v6(GeoIP->gi, name);
+  return Py_BuildValue("s", retval);
+}
+
+static PyObject * GeoIP_country_name_by_name_v6_Py(PyObject *self, PyObject *args) {
+  char * name;
+  const char * retval;
+  GeoIP_GeoIPObject* GeoIP = (GeoIP_GeoIPObject*)self;
+  if (!PyArg_ParseTuple(args, "s", &name)) {
+    return NULL;
+  }
+  retval = GeoIP_country_name_by_name_v6(GeoIP->gi, name);
+  return Py_BuildValue("s", retval);
+}
+
+static PyObject * GeoIP_country_code_by_addr_v6_Py(PyObject *self, PyObject *args) {
+  char * name;
+  const char * retval;
+  GeoIP_GeoIPObject* GeoIP = (GeoIP_GeoIPObject*)self;
+  if (!PyArg_ParseTuple(args, "s", &name)) {
+    return NULL;
+  }
+  retval = GeoIP_country_code_by_addr_v6(GeoIP->gi, name);
+  return Py_BuildValue("s", retval);
+}
+
+static PyObject * GeoIP_country_name_by_addr_v6_Py(PyObject *self, PyObject *args) {
+  char * name;
+  const char * retval;
+  GeoIP_GeoIPObject* GeoIP = (GeoIP_GeoIPObject*)self;
+  if (!PyArg_ParseTuple(args, "s", &name)) {
+    return NULL;
+  }
+  retval = GeoIP_country_name_by_addr_v6(GeoIP->gi, name);
+  return Py_BuildValue("s", retval);
+}
+
 static PyObject * GeoIP_country_code_by_name_Py(PyObject *self, PyObject *args) {
   char * name;
   const char * retval;
@@ -343,6 +387,10 @@ static PyMethodDef GeoIP_Object_methods[
   {"charset", GeoIP_charset_Py, 1, "Return the current charset ( either GEOIP_CHARSET_ISO_8859_1 or GEOIP_CHARSET_UTF8 )"},
   {"set_charset", GeoIP_set_charset_Py, 1, "Set the charset for city records"},
   {"last_netmask", GeoIP_last_netmask_Py, 1, "return the netmask depth of the last lookup"},
+  {"country_code_by_name_v6", GeoIP_country_code_by_name_v6_Py, 1, "Lookup IPv6 Country Code By Name"},
+  {"country_name_by_name_v6", GeoIP_country_name_by_name_v6_Py, 1, "Lookup IPv6 Country Name By Name"},
+  {"country_code_by_addr_v6", GeoIP_country_code_by_addr_v6_Py, 1, "Lookup IPv6 Country Code By IP Address"},
+  {"country_name_by_addr_v6", GeoIP_country_name_by_addr_v6_Py, 1, "Lookup IPv6 Country Name By IP Address"},
   {NULL, NULL, 0, NULL}
 };
 
diff -urNp --minimal --exclude-from=/home/mdomsch/excludes /home/mdomsch/cvs/fedora-extras/python-GeoIP/devel/GeoIP-Python-1.2.4/test.py python/test.py
--- /home/mdomsch/cvs/fedora-extras/python-GeoIP/devel/GeoIP-Python-1.2.4/test.py	2008-12-16 07:22:45.000000000 -0600
+++ python/test.py	2009-08-30 21:21:59.000000000 -0500
@@ -4,7 +4,7 @@ import GeoIP
 
 #gi = GeoIP.new(GeoIP.GEOIP_STANDARD)
 gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)
-#gi = GeoIP.open("/usr/local/share/GeoIP/GeoIP.data",GeoIP.GEOIP_STANDARD)
+#gi = GeoIP.open("/usr/local/share/GeoIP/GeoIP.dat",GeoIP.GEOIP_STANDARD)
 
 print gi.country_code_by_name("yahoo.com")
 print gi.last_netmask()
diff -urNp --minimal --exclude-from=/home/mdomsch/excludes /home/mdomsch/cvs/fedora-extras/python-GeoIP/devel/GeoIP-Python-1.2.4/test_v6.py python/test_v6.py
--- /home/mdomsch/cvs/fedora-extras/python-GeoIP/devel/GeoIP-Python-1.2.4/test_v6.py	1969-12-31 18:00:00.000000000 -0600
+++ python/test_v6.py	2009-08-30 21:21:59.000000000 -0500
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+
+import GeoIP
+
+#gi = GeoIP.new(GeoIP.GEOIP_STANDARD)
+#gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)
+gi = GeoIP.open("/usr/local/share/GeoIP/GeoIPv6.dat",GeoIP.GEOIP_STANDARD)
+
+print gi.country_code_by_name_v6("ipv6.google.com")
+print gi.country_name_by_name_v6("ipv6.google.com")
+print gi.country_code_by_addr_v6("2001:4860:0:1001::68")
+print gi.country_name_by_addr_v6("2001:4860:0:1001::68")
+