summaryrefslogtreecommitdiffstats
path: root/mirrors
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-03-29 21:51:50 +0100
committerDan McGee <dan@archlinux.org>2013-03-29 21:51:50 +0100
commit133d16f91f3d296e188d910f609128d854e65823 (patch)
tree9abca8b568c7d62e56e53df0d596f60caa8747b1 /mirrors
parentb8ee7b1ee281b45b245fb454228b8ad847c56200 (diff)
downloadarchweb-133d16f91f3d296e188d910f609128d854e65823.tar.gz
archweb-133d16f91f3d296e188d910f609128d854e65823.tar.xz
Add IP family lookup to CheckLocation model
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mirrors/models.py b/mirrors/models.py
index e41f6b2..b0da561 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")