From 1191d1548470a7ed1049f1d78de6f17b77e0d36d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 6 Jan 2024 17:51:41 -0600 Subject: [PATCH] purge years of old test code Signed-off-by: Jeff Carr --- bash.go => linuxstatus/old/bash.go | 0 .../old/dynamic-dns-update.go | 0 fsnotify.go => linuxstatus/old/fsnotify.go | 2 + nsupdate.go => linuxstatus/old/nsupdate.go | 5 +- rtnetlink.go => linuxstatus/old/rtnetlink.go | 0 unix.go => linuxstatus/old/unix.go | 0 proc.go => linuxstatus/proc.go | 4 +- net.go | 91 ------------------- 8 files changed, 6 insertions(+), 96 deletions(-) rename bash.go => linuxstatus/old/bash.go (100%) rename dynamic-dns-update.go => linuxstatus/old/dynamic-dns-update.go (100%) rename fsnotify.go => linuxstatus/old/fsnotify.go (99%) rename nsupdate.go => linuxstatus/old/nsupdate.go (97%) rename rtnetlink.go => linuxstatus/old/rtnetlink.go (100%) rename unix.go => linuxstatus/old/unix.go (100%) rename proc.go => linuxstatus/proc.go (97%) delete mode 100644 net.go diff --git a/bash.go b/linuxstatus/old/bash.go similarity index 100% rename from bash.go rename to linuxstatus/old/bash.go diff --git a/dynamic-dns-update.go b/linuxstatus/old/dynamic-dns-update.go similarity index 100% rename from dynamic-dns-update.go rename to linuxstatus/old/dynamic-dns-update.go diff --git a/fsnotify.go b/linuxstatus/old/fsnotify.go similarity index 99% rename from fsnotify.go rename to linuxstatus/old/fsnotify.go index cf38b50..ba40c94 100644 --- a/fsnotify.go +++ b/linuxstatus/old/fsnotify.go @@ -2,6 +2,7 @@ package main // Watches for changes to a directory. Works cross-platform +/* import ( "go.wit.com/log" "github.com/fsnotify/fsnotify" @@ -77,3 +78,4 @@ func fsnotifyNetworkInterfaceChanges() error { } } +*/ diff --git a/nsupdate.go b/linuxstatus/old/nsupdate.go similarity index 97% rename from nsupdate.go rename to linuxstatus/old/nsupdate.go index add2c94..635de4c 100644 --- a/nsupdate.go +++ b/linuxstatus/old/nsupdate.go @@ -6,9 +6,6 @@ package main import ( - "os" - - "go.wit.com/log" ) // ./go-nsupdate \ @@ -16,6 +13,7 @@ import ( // --tsig-secret="OWh5/ZHIyaz7B8J9m9ZDqZ8448Pke0PTpkYbZmFcOf5a6rEzgmcwrG91u1BHi1/4us+mKKEobDPLw1x6sD+ZJw==" \ // -i eno2 farm001.lab.wit.com +/* func nsupdate() { var tsigSecret string log.Log(NET, "nsupdate() START") @@ -33,3 +31,4 @@ func nsupdate() { } } } +*/ diff --git a/rtnetlink.go b/linuxstatus/old/rtnetlink.go similarity index 100% rename from rtnetlink.go rename to linuxstatus/old/rtnetlink.go diff --git a/unix.go b/linuxstatus/old/unix.go similarity index 100% rename from unix.go rename to linuxstatus/old/unix.go diff --git a/proc.go b/linuxstatus/proc.go similarity index 97% rename from proc.go rename to linuxstatus/proc.go index adc8576..b7720e0 100644 --- a/proc.go +++ b/linuxstatus/proc.go @@ -1,4 +1,4 @@ -package main +package linuxstatus import ( "io/ioutil" @@ -10,7 +10,7 @@ import ( "go.wit.com/log" ) -func getProcessNameByPort(port int) string { +func GetProcessNameByPort(port int) string { // Convert port to hex string portHex := strconv.FormatInt(int64(port), 16) diff --git a/net.go b/net.go deleted file mode 100644 index a3ebefd..0000000 --- a/net.go +++ /dev/null @@ -1,91 +0,0 @@ -// This creates a simple hello world window -package main - -import ( - // "log" - "net" - "strings" - - "go.wit.com/log" -) - -func IsIPv6(address string) bool { - return strings.Count(address, ":") >= 2 -} - -func (t *IPtype) IsReal() bool { - if (t.ip.IsPrivate() || t.ip.IsLoopback() || t.ip.IsLinkLocalUnicast()) { - log.Log(NET, "\t\tIP is Real = false") - return false - } else { - log.Log(NET, "\t\tIP is Real = true") - return true - } -} - -func IsReal(ip *net.IP) bool { - if (ip.IsPrivate() || ip.IsLoopback() || ip.IsLinkLocalUnicast()) { - log.Log(NET, "\t\tIP is Real = false") - return false - } else { - log.Log(NET, "\t\tIP is Real = true") - return true - } -} - -/* - These are the real IP address you have been - given from DHCP -*/ -func dhcpAAAA() []string { - var aaaa []string - - for s, t := range me.ipmap { - if (t.IsReal()) { - if (t.ipv6) { - aaaa = append(aaaa, s) - } - } - } - return aaaa -} - -func realA() []string { - var a []string - - for s, t := range me.ipmap { - if (t.IsReal()) { - if (t.ipv4) { - a = append(a, s) - } - } - } - return a -} - -func checkDNS() (map[string]*IPtype, map[string]*IPtype) { - var ipv4s map[string]*IPtype - var ipv6s map[string]*IPtype - - ipv4s = make(map[string]*IPtype) - ipv6s = make(map[string]*IPtype) - - for s, t := range me.ipmap { - i := t.iface - ipt := "IPv4" - if (t.ipv6) { - ipt = "IPv6" - } - if (t.IsReal()) { - log.Info("\tIP is Real ", ipt, i.Index, i.Name, s) - if (t.ipv6) { - ipv6s[s] = t - } else { - ipv4s[s] = t - } - } else { - log.Info("\tIP is not Real", ipt, i.Index, i.Name, s) - } - } - return ipv6s, ipv4s -}