tRename handshake validation functions. - 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 fa9e1a189c8a8f09abce98feefb6ad863ddb58ff DIR parent 6ae6d0a4a59118debcf2c4d15c169ce24ab639b2 HTML Author: parazyd <parazyd@dyne.org> Date: Wed, 13 Dec 2017 01:10:20 +0100 Rename handshake validation functions. This commit renames ValidateFirst to ValidateFirstHandshake and ValidateSecond to ValidateSecondHandshake to bring more clarity. Diffstat: M cmd/dam-dir/main.go | 4 ++-- M pkg/damlib/validate.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) --- DIR diff --git a/cmd/dam-dir/main.go b/cmd/dam-dir/main.go t@@ -99,7 +99,7 @@ func handlePost(rw http.ResponseWriter, request *http.Request) { // First handshake if len(n.Message) != 88 && len(n.Secret) != 88 { - valid, msg := lib.ValidateFirst(req) + valid, msg := lib.ValidateFirstHandshake(req) ret = map[string]string{"secret": msg} if valid { log.Printf("%s: 1/2 handshake valid.\n", n.Address) t@@ -121,7 +121,7 @@ func handlePost(rw http.ResponseWriter, request *http.Request) { // Second handshake if len(req["secret"]) == 88 && len(req["message"]) == 88 { - valid, msg := lib.ValidateSecond(req) + valid, msg := lib.ValidateSecondHandshake(req) ret = map[string]string{"secret": msg} if valid { log.Printf("%s: 2/2 handshake valid.\n", n.Address) DIR diff --git a/pkg/damlib/validate.go b/pkg/damlib/validate.go t@@ -53,7 +53,7 @@ func sanityCheck(req map[string]string, handshake int) (bool, string) { return true, "" } -// ValidateFirst validates the first incoming handshake. +// ValidateFirstHandshake validates the first incoming handshake. // It first calls sanityCheck to validate it's actually working with proper // data. // Next, it will look if the node is already found in redis. If so, it will t@@ -68,7 +68,7 @@ func sanityCheck(req map[string]string, handshake int) (bool, string) { // boolean value. // On any failure, the function will return false, and produce an according // string which is to be considered as an error message. -func ValidateFirst(req map[string]string) (bool, string) { +func ValidateFirstHandshake(req map[string]string) (bool, string) { sane, what := sanityCheck(req, 1) if !(sane) { return false, what t@@ -156,7 +156,7 @@ func ValidateFirst(req map[string]string) (bool, string) { return true, encryptedEncodedSecret } -// ValidateSecond validates the second part of the handshake. +// ValidateSecondHandshake validates the second part of the handshake. // First basic sanity checks are performed to ensure we are working with valid // data. // Next, the according public key will be retrieved from redis. If no key is t@@ -169,7 +169,7 @@ func ValidateFirst(req map[string]string) (bool, string) { // function will return true, and a welcome message. Upon failure, the function // will return false, and an according string which is to be considered an error // message. -func ValidateSecond(req map[string]string) (bool, string) { +func ValidateSecondHandshake(req map[string]string) (bool, string) { sane, what := sanityCheck(req, 2) if !(sane) { return false, what