gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [ascension] 16/57: fixed special cases with GNS2DNS


From: gnunet
Subject: [GNUnet-SVN] [ascension] 16/57: fixed special cases with GNS2DNS
Date: Sat, 13 Apr 2019 13:32:13 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository ascension.

commit c2f3a08680a45772c37cf1069138690dbd124767
Author: rexxnor <address@hidden>
AuthorDate: Tue Oct 9 12:47:15 2018 +0200

    fixed special cases with GNS2DNS
---
 gnsmigrator/gnsmigrator.py | 50 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 47 insertions(+), 3 deletions(-)

diff --git a/gnsmigrator/gnsmigrator.py b/gnsmigrator/gnsmigrator.py
index 4a366c8..4684b4e 100644
--- a/gnsmigrator/gnsmigrator.py
+++ b/gnsmigrator/gnsmigrator.py
@@ -16,6 +16,12 @@ Options:
 """
 
 # imports
+from ctypes import c_size_t
+from ctypes import c_uint32
+from ctypes import c_uint64
+from ctypes import c_void_p
+from enum import Enum
+from dataclasses import dataclass
 import multiprocessing
 import queue
 import sys
@@ -32,6 +38,26 @@ GNUNET_NAMESTORE_COMMAND = 'gnunet-namestore'
 GNUNET_GNS_COMMAND = 'gnunet-gns'
 GNUNET_ARM_COMMAND = 'gnunet-arm'
 
+class GNUnetGNSRecordFlags(Enum):
+    """
+    Flags that can be set for a record.
+    """
+    GNUNET_GNSRECORD_RF_NONE = 0
+    GNUNET_GNSRECORD_RF_PRIVATE = 2
+    GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION = 8
+    GNUNET_GNSRECORD_RF_SHADOW_RECORD = 16
+
address@hidden
+class GNUnetGNSRecordData():
+    """
+    Representation of a GNS Record in python
+    """
+    data: c_void_p
+    expiration_time: c_uint64
+    data_size: c_size_t
+    record_type: c_uint32
+    flags: GNUnetGNSRecordFlags
+
 class BaseMigrator():
     """
     Base class for migration
@@ -186,10 +212,21 @@ class BaseMigrator():
             if dnsname_str != '@':
                 # Special case for the GNS2DNS case
                 if rtype_str == 'NS':
+                    if str(value)[-1] == ".":
+                        dnsresolver = str(value)[:-1]
+                    else:
+                        dnsresolver = "%s.%s" % (value, domain)
+                        dnsresolver = str(value)[:-1]
+
+                    if dnsname_str[-1] == ".":
+                        dnsname_str = dnsname_str[:-1]
+
+                    if domain[-1] == ".":
+                        domain = domain[:-1]
 
                     # if no resolver is specified, choose the FQDN nameserver 
from zone
-                    if not dnsresolver:
-                        dnsresolver = value[:-1]
+                    #if not dnsresolver:
+                    #    dnsresolver = value[:-1]
 
                     pkey_lookup = 
subprocess.Popen([GNUNET_ZONE_CREATION_COMMAND, '-d'],
                                                    stdout=subprocess.PIPE)
@@ -331,7 +368,14 @@ class TLDMigrator(BaseMigrator):
                     break
                 # execute thing to run on item
                 dnsname, ttl, authns = record
-                authns = str(authns)[:-1]
+                if str(authns)[:-1] == ".":
+                    authns = str(authns)[:-1]
+                else:
+                    authns = "%s.%s" % (authns, zonename)
+
+                # building gns record struct
+                #GNUnetGNSRecordData()
+
                 subprocess.run([GNUNET_NAMESTORE_COMMAND,
                                 '-z', zonename,
                                 '-a', '-n', str(dnsname),

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]