diff options
author | Emile <hanemile@protonmail.com> | 2020-01-27 20:13:15 +0100 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2020-01-27 20:13:15 +0100 |
commit | 651f15d9b8bde1b024f97a42e92634afdc1eeda7 (patch) | |
tree | c6dfb94751084d720559c04563b35d31ae9f074a /main.go | |
parent | 7be2a6d747a767d016b976de60ce2bb21d3a5203 (diff) |
moved the source into an own folder
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/main.go b/main.go deleted file mode 100644 index 74f8f51..0000000 --- a/main.go +++ /dev/null @@ -1,49 +0,0 @@ -package main - -import ( - "log" - "net/http" - - "github.com/gliderlabs/ssh" - "github.com/gorilla/mux" -) - -var ( - metrics_num_passwords int - metrics_city_num map[string]int - cities map[string]location -) - -func main() { - - // create a map mapping a city to an amount of hits - metrics_city_num = make(map[string]int) - - // create a cities map mapping a city to a location - cities = make(map[string]location) - - // start the ssh server - log.Println("Starting SSH listener") - go func() { - listenErr := ssh.ListenAndServe(":2222", nil, ssh.PasswordAuth(handlePass)) - if listenErr != nil { - log.Fatalln(listenErr.Error()) - } - }() - - // start the http server logging the metrics - log.Println("Starting HTTP metrics listener") - - r := mux.NewRouter() - r.HandleFunc("/", indexHandler) - r.HandleFunc("/metrics", metricsHandler) - r.HandleFunc("/locations", locationHandlerEndpoint) - - // start the http server exposing the metrics and the locations - listenErr := http.ListenAndServe(":8084", r) - - // handle potential errors - if listenErr != nil { - log.Fatalln(listenErr.Error()) - } -} |