tExpand the nodeStruct struct to hold more information - tordam - A library for peer discovery inside the Tor network HTML git clone https://git.parazyd.org/tordam DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit b8a467ffa6fc0d25e5de40d2f872ce7e360844be DIR parent 98efaf065bf2a9f5e08156b268d41b93bff3739a HTML Author: parazyd <parazyd@dyne.org> Date: Thu, 7 Dec 2017 23:56:55 +0100 Expand the nodeStruct struct to hold more information Diffstat: M go/ddir/ddir.go | 12 ++++++++++++ 1 file changed, 12 insertions(+), 0 deletions(-) --- DIR diff --git a/go/ddir/ddir.go b/go/ddir/ddir.go t@@ -8,6 +8,7 @@ import ( "log" "net/http" "sync" + "time" "../lib" ) t@@ -20,6 +21,10 @@ type nodeStruct struct { Message string Signature string Secret string + Pubkey string + Firstseen int64 + Lastseen int64 + Valid bool } func handlePost(rw http.ResponseWriter, request *http.Request) { t@@ -59,6 +64,11 @@ func handlePost(rw http.ResponseWriter, request *http.Request) { pubkey, err := lib.ParsePubkey(pkey) lib.CheckError(err) + n.Pubkey = string(pkey) + now := time.Now() + n.Firstseen = now.Unix() + n.Lastseen = now.Unix() + if len(req["secret"]) != 88 { // Client did not send a decrypted secret. randString, err := lib.GenRandomASCII(64) t@@ -97,6 +107,8 @@ func handlePost(rw http.ResponseWriter, request *http.Request) { ret := map[string]string{ "secret": "Welcome to the DECODE network!", } + n.Valid = false + jsonVal, err := json.Marshal(ret) lib.CheckError(err)