summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mirrors/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mirrors/models.py b/mirrors/models.py
index c205fef..07ac1e6 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -129,6 +129,13 @@ class CheckLocation(models.Model):
def __unicode__(self):
return self.hostname
+ @property
+ def family(self):
+ info = socket.getaddrinfo(self.source_ip, None, 0, 0, 0,
+ socket.AI_NUMERICHOST)
+ families = [x[0] for x in info]
+ return families[0]
+
class MirrorLog(models.Model):
url = models.ForeignKey(MirrorUrl, related_name="logs")