From c5651a2da6dd9f85f37f74fcc756285bf8998eaa Mon Sep 17 00:00:00 2001 From: Emile Date: Mon, 27 Jan 2020 20:27:49 +0100 Subject: fmt / imports --- src/http.go | 10 ++++++++-- src/ssh.go | 13 ++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/http.go b/src/http.go index 7aac0c7..86ad3d1 100644 --- a/src/http.go +++ b/src/http.go @@ -1,5 +1,11 @@ package main +import ( + "fmt" + "net/http" + "strings" +) + // locationHandlerEndpoint handles requests to the /locations endpoint // This is used by the grafana worldmap plugin to find out where to draw the // fancy circles @@ -23,7 +29,7 @@ func locationHandlerEndpoint(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "\"name\": \"%s\"", v.name) // close the object (this handles the trailing comma problem) - if i == len(cities) - 1 { + if i == len(cities)-1 { fmt.Fprintf(w, "}") } else { fmt.Fprintf(w, "},") @@ -49,4 +55,4 @@ func metricsHandler(w http.ResponseWriter, req *http.Request) { for k, v := range metrics_city_num { fmt.Fprintf(w, "a_metric{city=\"%s\"} %d\n", strings.ToLower(k), v) } -} \ No newline at end of file +} diff --git a/src/ssh.go b/src/ssh.go index fbbfc9c..71dc12a 100644 --- a/src/ssh.go +++ b/src/ssh.go @@ -1,5 +1,16 @@ package main +import ( + "encoding/json" + "fmt" + "io/ioutil" + "log" + "net/http" + "strings" + + "github.com/gliderlabs/ssh" +) + // Handling incoming SSH connections func handlePass(ctx ssh.Context, pass string) bool { @@ -60,4 +71,4 @@ func handlePass(ctx ssh.Context, pass string) bool { } return false -} \ No newline at end of file +} -- cgit 1.4.1