From 3503cb775fb3e61c7a1cecdaba6d9a45a2fb6795 Mon Sep 17 00:00:00 2001 From: aceberg <1502200+aceberg@users.noreply.github.com> Date: Thu, 25 Aug 2022 12:09:55 +0700 Subject: [PATCH] Comments --- src/compare.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/compare.go b/src/compare.go index cd8b3ec..9b1a614 100644 --- a/src/compare.go +++ b/src/compare.go @@ -5,7 +5,7 @@ import ( "log" ) -func host_in_db(host Host, dbHosts []Host) bool { +func host_in_db(host Host, dbHosts []Host) bool { // Check if host is already in DB for _, oneHost := range dbHosts { if host.Ip == oneHost.Ip && host.Mac == oneHost.Mac && host.Hw == oneHost.Hw { oneHost.Date = host.Date @@ -18,15 +18,12 @@ func host_in_db(host Host, dbHosts []Host) bool { } func hosts_compare(foundHosts []Host, dbHosts []Host) { - // fmt.Println("Found hosts:", foundHosts) - // fmt.Println("DB hosts:", dbHosts) - for _, oneHost := range foundHosts { if !(host_in_db(oneHost, dbHosts)) { - oneHost.Now = 1 + oneHost.Now = 1 // Mark host online msg := fmt.Sprintf("UNKNOWN HOST IP: '%s', MAC: '%s', Hw: '%s'", oneHost.Ip, oneHost.Mac, oneHost.Hw) log.Println("WARN:", msg) - shoutr_notify(msg) + shoutr_notify(msg) // Notify through Shoutrrr db_insert(oneHost) } }