summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-03-29 15:51:50 -0500
committerDan McGee <dan@archlinux.org>2013-03-29 15:51:50 -0500
commit133d16f91f3d296e188d910f609128d854e65823 (patch)
tree9abca8b568c7d62e56e53df0d596f60caa8747b1
parentb8ee7b1ee281b45b245fb454228b8ad847c56200 (diff)
Add IP family lookup to CheckLocation model
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mirrors/models.py b/mirrors/models.py
index e41f6b22..b0da5616 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -136,6 +136,15 @@ class CheckLocation(models.Model):
families = [x[0] for x in info]
return families[0]
+ @property
+ def ip_version(self):
+ '''Returns integer '4' or '6'.'''
+ if self.family == socket.AF_INET6:
+ return 6
+ if self.family == socket.AF_INET:
+ return 4
+ return None
+
class MirrorLog(models.Model):
url = models.ForeignKey(MirrorUrl, related_name="logs")