tAllow nodetype of either "node" or "directory". - tordam - A library for peer discovery inside the Tor network
 (HTM) git clone https://git.parazyd.org/tordam
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit eafdb67c13390a504aca9557c7516d0c27d87787
 (DIR) parent 8c47d16505c8f1a164c683ad90db6de7a22d79da
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Mon, 11 Dec 2017 22:21:19 +0100
       
       Allow nodetype of either "node" or "directory".
       
       Diffstat:
         M cmd/dam-dir/main.go                 |       8 ++++++++
         M protocol.md                         |       4 ++--
       
       2 files changed, 10 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/cmd/dam-dir/main.go b/cmd/dam-dir/main.go
       t@@ -86,6 +86,14 @@ func handlePost(rw http.ResponseWriter, request *http.Request) {
                        len(n.Message) == 0 || len(n.Signature) == 0 {
                        return
                }
       +        switch n.Nodetype {
       +        case "node":
       +                log.Println("Client of type:", n.Nodetype)
       +        case "directory":
       +                log.Println("Client of type:", n.Nodetype)
       +        default:
       +                return
       +        }
        
                decSig, err := base64.StdEncoding.DecodeString(n.Signature)
                if err != nil {
 (DIR) diff --git a/protocol.md b/protocol.md
       t@@ -35,7 +35,7 @@ to one or more active directories with the format explained below.
        N.B. The strings shown in this document might not be valid, but they
        represent a correct example.
        
       -* `type` reflects the type of the node (currently just a placeholder)
       +* `type` reflects the type of the node (node/directory)
        * `address` holds the address of the Tor hidden service
        * `message` is the message that has to be signed using the private key
          of this same hidden service.
       t@@ -74,7 +74,7 @@ will then be encoded using base64 and sent back to the client:
        The client will try to decode and decrypt this secret, and send it back
        to the directory to complete its part of the handshake. The POST request
        this time will contain the following data:
       -* `type` reflects the type of the node (currently just a placeholder)
       +* `type` reflects the type of the node (node/directory)
        * `address` holds the address of the Tor hidden service
        * `message` is the decrypted and base64 encoded secret that the server
          had just sent us.