From a385734bc948b6cae6c5dd9a5fc48abaca4a040f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 6 Jan 2024 16:59:33 -0600 Subject: all engines running and stable Signed-off-by: Jeff Carr --- net.go | 92 ------------------------------------------------------------------ 1 file changed, 92 deletions(-) (limited to 'net.go') diff --git a/net.go b/net.go index cd988d1..a3ebefd 100644 --- a/net.go +++ b/net.go @@ -9,35 +9,6 @@ import ( "go.wit.com/log" ) -// this doesn't work -/* -func watchNetworkInterfaces() { - // Get list of network interfaces - interfaces, _ := net.Interfaces() - - // Set up a notification channel - notification := make(chan net.Interface) - - log.Log(NET, "watchNet()") - // Start goroutine to watch for changes - go func() { - log.Log(NET, "watchNet() func") - for { - log.Log(NET, "forever loop start") - // Check for changes in each interface - for _, i := range interfaces { - log.Log(NET, "something on i =", i) - if status := i.Flags & net.FlagUp; status != 0 { - notification <- i - log.Log(NET, "something on i =", i) - } - } - log.Log(NET, "forever loop end") - } - }() -} -*/ - func IsIPv6(address string) bool { return strings.Count(address, ":") >= 2 } @@ -62,43 +33,6 @@ func IsReal(ip *net.IP) bool { } } -func renameInterface(i *net.Interface) { - /* - /sbin/ip link set eth1 down - /sbin/ip link set eth1 name eth123 - /sbin/ip link set eth123 up - */ -} - -// Will figure out if an interface was just added -func checkInterface(i net.Interface) { - val, ok := me.ifmap[i.Index] - if ! ok { - log.Info(i.Name, "is a new network interface. The linux kernel index =", i.Index) - me.ifmap[i.Index] = new(IFtype) - me.ifmap[i.Index].gone = false - me.ifmap[i.Index].iface = &i - me.changed = true - if (me.Interfaces != nil) { - me.Interfaces.AddText(i.Name) - me.Interfaces.SetText(i.Name) - } - return - } - me.ifmap[i.Index].gone = false - log.Log(NET, "me.ifmap[i] does exist. Need to compare everything.", i.Index, i.Name, val.iface.Index, val.iface.Name) - if (val.iface.Name != i.Name) { - log.Info(val.iface.Name, "has changed to it's name to", i.Name) - me.ifmap[i.Index].iface = &i - me.changed = true - if (me.Interfaces != nil) { - me.Interfaces.AddText(i.Name) - me.Interfaces.SetText(i.Name) - } - return - } -} - /* These are the real IP address you have been given from DHCP @@ -155,29 +89,3 @@ func checkDNS() (map[string]*IPtype, map[string]*IPtype) { } return ipv6s, ipv4s } - -// delete network interfaces and ip addresses from the gui -func deleteChanges2() bool { - var changed bool = false - for i, t := range me.ifmap { - if (t.gone) { - log.Log(CHANGE, "DELETE int =", i, "name =", t.name, t.iface) - delete(me.ifmap, i) - changed = true - } - t.gone = true - } - for s, t := range me.ipmap { - if (t.gone) { - log.Log(CHANGE, "DELETE name =", s, "IPv4 =", t.ipv4) - log.Log(CHANGE, "DELETE name =", s, "IPv6 =", t.ipv6) - log.Log(CHANGE, "DELETE name =", s, "iface =", t.iface) - log.Log(CHANGE, "DELETE name =", s, "ip =", t.ip) - delete(me.ipmap, s) - changed = true - } - t.gone = true - } - - return changed -} -- cgit v1.2.3