I am trying to write a piece of go code that will trigger an expensive function. Right now the expensive function is triggered in an interval of a five seconds.
The thing is, that it only needs to be triggered, only if the state of connections in NetworkManager of linux has changed. For example from connecting to router x (the coffeeshop wifi), it connected to router y (my phones hotspot).
Is there a way to receive an event (similar to how one can get notified about file system change using inotify) for network connection changes?