tordam

A library for peer discovery inside the Tor network
git clone https://git.parazyd.org/tordam
Log | Files | Refs | README | LICENSE

commit 7a697d4ef254930b0eb9f9c7da12af1415ede4fd
parent 03e196797d988717545e5a571aed71e905907f8b
Author: parazyd <parazyd@dyne.org>
Date:   Thu,  7 Dec 2017 19:15:27 +0100

Use a const for ddir's listening address

Diffstat:
Mgo/ddir/ddir.go | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/go/ddir/ddir.go b/go/ddir/ddir.go @@ -10,6 +10,8 @@ import ( "../lib" ) +const ListenAddress = "127.0.0.1:8080" + type nodeStruct struct { Nodetype string Address string @@ -17,7 +19,7 @@ type nodeStruct struct { Signature string } -func parsePost(rw http.ResponseWriter, request *http.Request) { +func handlePost(rw http.ResponseWriter, request *http.Request) { decoder := json.NewDecoder(request.Body) var n nodeStruct @@ -34,9 +36,11 @@ func parsePost(rw http.ResponseWriter, request *http.Request) { if lib.ValidateReq(req) != true { log.Fatalln("Request is not valid.") } + } func main() { - http.HandleFunc("/announce", parsePost) - http.ListenAndServe(":8080", nil) + http.HandleFunc("/announce", handlePost) + http.ListenAndServe(ListenAddress, nil) + log.Println("Listening on", ListenAddress) }