|
|
|
@ -4,6 +4,7 @@ import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"net"
|
|
|
|
|
"os"
|
|
|
|
|
"strconv"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
envChecks "git.ruekov.eu/ruakij/routingtabletowg/lib/environmentchecks"
|
|
|
|
@ -20,6 +21,7 @@ var envRequired = []string{
|
|
|
|
|
var envDefaults = map[string]string{
|
|
|
|
|
"IPV6_FORMAT": "fc12::%02x%02x:%02x%02x/%d",
|
|
|
|
|
"FILTER_PREFIX": "100.100",
|
|
|
|
|
"RECHECK_INTERVAL": "300",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
@ -46,6 +48,12 @@ func main() {
|
|
|
|
|
|
|
|
|
|
filterPrefix := os.Getenv("FILTER_PREFIX")
|
|
|
|
|
|
|
|
|
|
checkIntervalStr := os.Getenv("RECHECK_INTERVAL")
|
|
|
|
|
checkIntervalSec, err := strconv.Atoi(checkIntervalStr)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logger.Error.Fatalf("Couldn't read RECHECK_INTERVAL '%s': %s", checkIntervalStr, err)
|
|
|
|
|
}
|
|
|
|
|
checkInterval := time.Second * time.Duration(checkIntervalSec)
|
|
|
|
|
|
|
|
|
|
// Get the IPv4 address of the interface
|
|
|
|
|
addrs, err := netlink.AddrList(netInterface, netlink.FAMILY_V4)
|
|
|
|
@ -138,8 +146,8 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Sleep for 300 seconds before running the loop again
|
|
|
|
|
time.Sleep(time.Second * 300)
|
|
|
|
|
// Sleep for x seconds before running the loop again
|
|
|
|
|
time.Sleep(checkInterval)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|