diff options
Diffstat (limited to 'gnunet/gnsrecord.py')
-rw-r--r-- | gnunet/gnsrecord.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gnunet/gnsrecord.py b/gnunet/gnsrecord.py index 1cb0d72..e9774c4 100644 --- a/gnunet/gnsrecord.py +++ b/gnunet/gnsrecord.py | |||
@@ -1,7 +1,7 @@ | |||
1 | import datetime | 1 | import datetime |
2 | 2 | ||
3 | 3 | ||
4 | dns_types = { | 4 | DNS_TYPES = { |
5 | "A": 1, | 5 | "A": 1, |
6 | "NS": 2, | 6 | "NS": 2, |
7 | "CNAME": 5, | 7 | "CNAME": 5, |
@@ -13,7 +13,7 @@ dns_types = { | |||
13 | "TLSA": 52} | 13 | "TLSA": 52} |
14 | 14 | ||
15 | 15 | ||
16 | gns_types = { | 16 | GNS_TYPES = { |
17 | "PKEY": 65536, | 17 | "PKEY": 65536, |
18 | "NICK": 65537, | 18 | "NICK": 65537, |
19 | "LEHO": 65538, | 19 | "LEHO": 65538, |
@@ -21,14 +21,15 @@ gns_types = { | |||
21 | "GNS2DNS": 65540} | 21 | "GNS2DNS": 65540} |
22 | 22 | ||
23 | 23 | ||
24 | types = dict(list(dns_types.items()) + list(gns_types.items())) | 24 | TYPES = dict(DNS_TYPES.items()) |
25 | TYPES.update(GNS_TYPES.items()) | ||
25 | 26 | ||
26 | 27 | ||
27 | class Data: | 28 | class Data: |
28 | def __init__(self, record_type, data, expiration_time=None, private=None, pending=None, shadow=None): | 29 | def __init__(self, record_type, data, expiration_time=None, private=None, pending=None, shadow=None): |
29 | self.record_type = str(record_type) | 30 | self.record_type = str(record_type) |
30 | if record_type not in types: | 31 | if record_type not in TYPES: |
31 | raise ValueError("'record_type' must be one of %s" % types) | 32 | raise ValueError("'record_type' must be one of %s" % TYPES) |
32 | # self.data = bytearray(data) | 33 | # self.data = bytearray(data) |
33 | self.data = str(data) | 34 | self.data = str(data) |
34 | if expiration_time is not None and not isinstance(expiration_time, datetime.datetime) or isinstance(expiration_time, datetime.timedelta): | 35 | if expiration_time is not None and not isinstance(expiration_time, datetime.datetime) or isinstance(expiration_time, datetime.timedelta): |