[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Handling the server descriptor's contact and family lines



commit 29fad9389f92557e349ffebb32d9cef58b2796c0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Mon Mar 19 09:14:11 2012 -0700

    Handling the server descriptor's contact and family lines
---
 stem/descriptor/server_descriptor.py |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index 8ed9afa..b4030d7 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -119,16 +119,19 @@ class ServerDescriptorV2(Descriptor):
     signing_key_type (str)   - block type of the signing_key, probably "RSA PUBLIC KEY" (*)
     router_sig (str)         - signature for this descriptor (*)
     router_sig_type (str)    - block type of the router_sig, probably "SIGNATURE" (*)
+    contact (str)            - relay's contact information
+    family (list)            - nicknames or fingerprints of relays it has a declared family with (*)
     
     * required fields, others are left as None if undefined
   """
   
   nickname = address = or_port = socks_port = dir_port = None
   average_bandwidth = burst_bandwidth = observed_bandwidth = None
-  platform = tor_version = published = fingerprint = None
-  uptime = onion_key = signing_key = None
+  platform = tor_version = published = fingerprint = uptime = None
+  onion_key = onion_key_type = signing_key = signing_key_type = None
+  router_sig = router_sig_type = contact = None
   hibernating = False
-  unrecognized_entries = []
+  family = unrecognized_entries = []
   
   def __init__(self, contents):
     Descriptor.__init__(self, contents)
@@ -294,6 +297,20 @@ class ServerDescriptorV2(Descriptor):
         
         self.router_sig_type = block_type
         self.router_sig = block_contents
+      elif keyword == "contact":
+        self.contact = value
+      elif keyword == "family":
+        self.family = value.split(" ")
       else:
         unrecognized_entries.append(line)
+  
+  def is_valid(self):
+    """
+    Validates that our content matches our signature.
+    
+    Returns:
+      True if our signature matches our content, False otherwise
+    """
+    
+    raise NotImplementedError # TODO: implement
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits