diff options
author | Dan McGee <dan@archlinux.org> | 2013-03-29 15:51:50 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-03-29 15:51:50 -0500 |
commit | 133d16f91f3d296e188d910f609128d854e65823 (patch) | |
tree | 9abca8b568c7d62e56e53df0d596f60caa8747b1 /mirrors/models.py | |
parent | b8ee7b1ee281b45b245fb454228b8ad847c56200 (diff) |
Add IP family lookup to CheckLocation model
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/models.py')
-rw-r--r-- | mirrors/models.py | 9 |
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") |