tReturn the public key as []byte in ValidateReq - 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 8140ae943fd325aba522bf4c586520288d0b702d DIR parent c44b13691b51fd58949f7c3bf60137045edc4150 HTML Author: parazyd <parazyd@dyne.org> Date: Thu, 7 Dec 2017 20:54:44 +0100 Return the public key as []byte in ValidateReq Diffstat: M go/lib/helpers.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- DIR diff --git a/go/lib/helpers.go b/go/lib/helpers.go t@@ -51,17 +51,17 @@ func FetchHSPubkey(addr string) string { } // ValidateReq validates our given request against some checks. -func ValidateReq(req map[string]string) bool { +func ValidateReq(req map[string]string) ([]byte, bool) { // Validate nodetype. if req["nodetype"] != "node" { - return false + return nil, false } // Validate address. re, err := regexp.Compile("^[a-z2-7]{16}\\.onion$") CheckError(err) if len(re.FindString(req["address"])) != 22 { - return false + return nil, false } // Address is valid, we try to fetch its pubkey from a HSDir t@@ -92,7 +92,7 @@ func ValidateReq(req map[string]string) bool { } */ - return true + return []byte(pubkey), true } // HTTPPost sends an HTTP POST request to the given host. It sends data as