about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2020-01-27 20:49:30 +0100
committerEmile <hanemile@protonmail.com>2020-01-27 20:49:30 +0100
commit932efbc49ad77594610616c56099c1da703a952d (patch)
tree6e1e24c2295c534e890ccf6aa9726ebe3b2ec081 /src
parent71bcc1bac69963fd4d016f9eac33b41b7c3e4fb2 (diff)
snake_case → camelCase
Diffstat (limited to 'src')
-rw-r--r--src/http.go4
-rw-r--r--src/main.go8
-rw-r--r--src/ssh.go8
3 files changed, 10 insertions, 10 deletions
diff --git a/src/http.go b/src/http.go
index 86ad3d1..47f0d75 100644
--- a/src/http.go
+++ b/src/http.go
@@ -49,10 +49,10 @@ func indexHandler(w http.ResponseWriter, req *http.Request) {
 func metricsHandler(w http.ResponseWriter, req *http.Request) {
 
 	// return the overall amount of passwords catched
-	fmt.Fprintf(w, "num_passwords %d\n", metrics_num_passwords)
+	fmt.Fprintf(w, "num_passwords %d\n", metricsNumPasswords)
 
 	// return the amount of passwords catched from a given city
-	for k, v := range metrics_city_num {
+	for k, v := range metricsCityNum {
 		fmt.Fprintf(w, "a_metric{city=\"%s\"} %d\n", strings.ToLower(k), v)
 	}
 }
diff --git a/src/main.go b/src/main.go
index 39ddadb..a95834a 100644
--- a/src/main.go
+++ b/src/main.go
@@ -10,14 +10,14 @@ import (
 )
 
 var (
-	metrics_num_passwords int
-	metrics_city_num      map[string]int
-	cities                map[string]location
+	metricsNumPasswords int
+	metricsCityNum      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)
+	metricsCityNum = make(map[string]int)
 
 	// create a cities map mapping a city to a location
 	cities = make(map[string]location)
diff --git a/src/ssh.go b/src/ssh.go
index 71dc12a..3eb426b 100644
--- a/src/ssh.go
+++ b/src/ssh.go
@@ -15,7 +15,7 @@ import (
 func handlePass(ctx ssh.Context, pass string) bool {
 
 	// increase the counter tracking the amount of passwords catched
-	metrics_num_passwords++
+	metricsNumPasswords++
 	log.Printf("%s@%s: '%s'", ctx.User(), ctx.RemoteAddr().String(), pass)
 
 	// get the ip of the remote user
@@ -51,10 +51,10 @@ func handlePass(ctx ssh.Context, pass string) bool {
 
 	// if an entry for the city does not exists yet, create the city
 	// if the city does allready exist, increase it's value by one
-	if metrics_city_num[result.City] == 0 {
-		metrics_city_num[result.City] = 1
+	if metricsCityNum[result.City] == 0 {
+		metricsCityNum[result.City] = 1
 	} else {
-		metrics_city_num[result.City] += 1
+		metricsCityNum[result.City] += 1
 	}
 
 	// if the actual city is not known, create the city