Small fixes and log beautification,

master
Uriel Fanelli 2023-08-10 21:18:12 +02:00
parent e6e6b90201
commit 9cb1141012
2 changed files with 5 additions and 4 deletions

View File

@ -115,13 +115,14 @@ func isActive(bridgeip string) bool {
} }
// just in case it doesn't stops alone // just in case it doesn't stops alone
defer pinger.Stop() defer pinger.Stop()
pinger.Count = 3 pinger.Count = 5
pinger.Interval = time.Duration(100 * time.Millisecond) pinger.Interval = time.Duration(10 * time.Millisecond)
pinger.Timeout = time.Duration(1 * time.Second) pinger.Timeout = time.Duration(1 * time.Second)
pinger.Run() // blocks until finished pinger.Run() // blocks until finished
stats := pinger.Statistics() stats := pinger.Statistics()
log.Println("Ping results for: ", bridgeip) log.Println("Ping results for: ", bridgeip)
log.Printf("%d packet sent, %d packet recv", pinger.Count, stats.PacketsRecv) log.Printf("%d packet sent, %d packet recv\n", pinger.Count, stats.PacketsRecv)
log.Println("IsACTIVE: ", stats.PacketsRecv == pinger.Count)
return stats.PacketsRecv == pinger.Count return stats.PacketsRecv == pinger.Count

View File

@ -8,5 +8,5 @@
"ExistingInterface": "eth0", "ExistingInterface": "eth0",
"BridgeIpCIDR": "10.0.1.1/24" "BridgeIpCIDR": "10.0.1.1/24"
}, },
"debug": false "debug": true
} }