[mirrorbrain-commits] r8268 - in /trunk/mb: mb.py mb/asn.py mb/geoip.py mb/util.py

From: <poeml_at_mirrorbrain.org>
Date: Sun, 01 Apr 2012 00:12:39 -0000
Author: poeml
Date: Sun Apr  1 02:12:39 2012
New Revision: 8268

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8268&view=rev
Log:
mb update:
- set ipv6Only flag 
mb.geoip module: 
- look for geoip IPv6 databases (not used yet)

Modified:
    trunk/mb/mb.py
    trunk/mb/mb/asn.py
    trunk/mb/mb/geoip.py
    trunk/mb/mb/util.py

Modified: trunk/mb/mb.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb.py?rev=8268&r1=8267&r2=8268&view=diff
==============================================================================
--- trunk/mb/mb.py	(original)
+++ trunk/mb/mb.py	Sun Apr  1 02:12:39 2012
_at_@ -424,6 +424,13 @@
                 continue
 
 
+            if res:
+                if mirror.ipv6Only != res.ipv6Only():
+                    print '%s: updating ipv6Only flag (%s -> %s)' \
+                        % (mirror.identifier, mirror.ipv6Only, res.ipv6Only())
+                    if not opts.dry_run:
+                        mirror.ipv6Only = res.ipv6Only()
+
             if opts.prefix and res:
                 if mirror.prefix != res.prefix:
                     print '%s: updating network prefix (%s -> %s)' \

Modified: trunk/mb/mb/asn.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb/asn.py?rev=8268&r1=8267&r2=8268&view=diff
==============================================================================
--- trunk/mb/mb/asn.py	(original)
+++ trunk/mb/mb/asn.py	Sun Apr  1 02:12:39 2012
_at_@ -48,6 +48,8 @@
         if ip6s: a.ip6 = ip6s[0]
         
 
+    if not a.ip:
+        return a
     query = """SELECT pfx, asn \
                    FROM pfx2asn \
                    WHERE pfx >>= ip4r('%s') \

Modified: trunk/mb/mb/geoip.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb/geoip.py?rev=8268&r1=8267&r2=8268&view=diff
==============================================================================
--- trunk/mb/mb/geoip.py	(original)
+++ trunk/mb/mb/geoip.py	Sun Apr  1 02:12:39 2012
_at_@ -16,6 +16,15 @@
 for i in databases:
     if os.path.exists(i):
         database = i
+        break
+databases6 = ['/var/lib/GeoIP/GeoIPv6.dat.updated', 
+             '/var/lib/GeoIP/GeoIPv6.dat', 
+             '/usr/share/GeoIP/GeoIPv6.dat.updated', 
+             '/usr/share/GeoIP/GeoIPv6.dat', 
+             ]
+for i in databases6:
+    if os.path.exists(i):
+        database6 = i
         break
 
 

Modified: trunk/mb/mb/util.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb/util.py?rev=8268&r1=8267&r2=8268&view=diff
==============================================================================
--- trunk/mb/mb/util.py	(original)
+++ trunk/mb/mb/util.py	Sun Apr  1 02:12:39 2012
_at_@ -24,6 +24,11 @@
         self.ip6 = None
         self.asn = None
         self.prefix = None
+    def ipv6Only(self):
+        if self.ip6 and not self.ip:
+            return True
+        else:
+            return False
     def __str__(self):
         r = '%s (%s AS%s)' % (self.ip, self.prefix, self.asn)
         if self.ip6:




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Sun Apr 01 2012 - 00:12:40 GMT

This archive was generated by hypermail 2.3.0 : Sun Apr 01 2012 - 00:17:02 GMT