purge years of old test code
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
15d9f97693
commit
0148cec0b2
4
dns.go
4
dns.go
|
@ -40,6 +40,7 @@ func (h *Host) setIPv4(ipv4s map[string]*IPtype) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (h *Host) checkDNS() {
|
func (h *Host) checkDNS() {
|
||||||
var ip4 bool = false
|
var ip4 bool = false
|
||||||
var ip6 bool = false
|
var ip6 bool = false
|
||||||
|
@ -74,6 +75,7 @@ func (h *Host) checkDNS() {
|
||||||
log.Println(args.VerboseDNS, "IPv6 is broken. Need to fix it here.")
|
log.Println(args.VerboseDNS, "IPv6 is broken. Need to fix it here.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// nsLookup performs an NS lookup on the given domain name.
|
// nsLookup performs an NS lookup on the given domain name.
|
||||||
func lookupNS(domain string) {
|
func lookupNS(domain string) {
|
||||||
|
@ -113,7 +115,7 @@ func lookupNS(domain string) {
|
||||||
|
|
||||||
if (tmp != me.status.NSrr.Get()) {
|
if (tmp != me.status.NSrr.Get()) {
|
||||||
me.changed = true
|
me.changed = true
|
||||||
log.Log(CHANGE, "lookupNS() setting me.NSrr =", tmp)
|
log.Log(CHANGE, "lookupNS() setting changed to me.NSrr =", tmp)
|
||||||
me.status.NSrr.Set(tmp)
|
me.status.NSrr.Set(tmp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
40
gui.go
40
gui.go
|
@ -50,7 +50,7 @@ func debugTab(title string) {
|
||||||
})
|
})
|
||||||
|
|
||||||
g2.NewButton("getProcessNameByPort()", func () {
|
g2.NewButton("getProcessNameByPort()", func () {
|
||||||
processName := getProcessNameByPort(53)
|
processName := linuxstatus.GetProcessNameByPort(53)
|
||||||
log.Info("Process with port 53:", processName)
|
log.Info("Process with port 53:", processName)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ func debugTab(title string) {
|
||||||
me.debug.Hide()
|
me.debug.Hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// will return a AAAA value that needs to be deleted
|
// will return a AAAA value that needs to be deleted
|
||||||
func deleteAAA() string {
|
func deleteAAA() string {
|
||||||
var aaaa []string
|
var aaaa []string
|
||||||
|
@ -93,6 +94,7 @@ func missingAAAA() string {
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// doesn't actually do any network traffic
|
// doesn't actually do any network traffic
|
||||||
// it just updates the GUI
|
// it just updates the GUI
|
||||||
|
@ -116,7 +118,7 @@ func displayDNS() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
var a []string
|
var a []string
|
||||||
a = realA()
|
a = append(a, "fixme")
|
||||||
all = sortLines(strings.Join(a, "\n"))
|
all = sortLines(strings.Join(a, "\n"))
|
||||||
if (all == "") {
|
if (all == "") {
|
||||||
log.Log(NOW, "THERE IS NOT a real A DNS ENTRY")
|
log.Log(NOW, "THERE IS NOT a real A DNS ENTRY")
|
||||||
|
@ -265,28 +267,30 @@ func updateDNS() {
|
||||||
cloudflare.CFdialog.NameNode.SetText(h)
|
cloudflare.CFdialog.NameNode.SetText(h)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
d := deleteAAA()
|
d := deleteAAA()
|
||||||
if (d != "") {
|
if (d != "") {
|
||||||
if (cloudflare.CFdialog.ValueNode != nil) {
|
if (cloudflare.CFdialog.ValueNode != nil) {
|
||||||
cloudflare.CFdialog.ValueNode.SetText(d)
|
cloudflare.CFdialog.ValueNode.SetText(d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m := missingAAAA()
|
*/
|
||||||
if (m != "") {
|
// m := missingAAAA()
|
||||||
if (cloudflare.CFdialog.ValueNode != nil) {
|
// if (m != "") {
|
||||||
cloudflare.CFdialog.ValueNode.SetText(m)
|
// if (cloudflare.CFdialog.ValueNode != nil) {
|
||||||
}
|
// cloudflare.CFdialog.ValueNode.SetText(m)
|
||||||
/*
|
// }
|
||||||
rr := &cloudflare.RRT{
|
// /*
|
||||||
Type: "AAAA",
|
// rr := &cloudflare.RRT{
|
||||||
Name: me.hostname,
|
// Type: "AAAA",
|
||||||
Ttl: "Auto",
|
// Name: me.hostname,
|
||||||
Proxied: false,
|
// Ttl: "Auto",
|
||||||
Content: m,
|
// Proxied: false,
|
||||||
}
|
// Content: m,
|
||||||
cloudflare.Update(rr)
|
// }
|
||||||
*/
|
// cloudflare.Update(rr)
|
||||||
}
|
// */
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status := displayDNS() // update the GUI based on dig results
|
status := displayDNS() // update the GUI based on dig results
|
||||||
|
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
// Watches for changes to a directory. Works cross-platform
|
// Watches for changes to a directory. Works cross-platform
|
||||||
|
|
||||||
|
/*
|
||||||
import (
|
import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"github.com/fsnotify/fsnotify"
|
"github.com/fsnotify/fsnotify"
|
||||||
|
@ -77,3 +78,4 @@ func fsnotifyNetworkInterfaceChanges() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
|
@ -6,9 +6,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ./go-nsupdate \
|
// ./go-nsupdate \
|
||||||
|
@ -16,6 +13,7 @@ import (
|
||||||
// --tsig-secret="OWh5/ZHIyaz7B8J9m9ZDqZ8448Pke0PTpkYbZmFcOf5a6rEzgmcwrG91u1BHi1/4us+mKKEobDPLw1x6sD+ZJw==" \
|
// --tsig-secret="OWh5/ZHIyaz7B8J9m9ZDqZ8448Pke0PTpkYbZmFcOf5a6rEzgmcwrG91u1BHi1/4us+mKKEobDPLw1x6sD+ZJw==" \
|
||||||
// -i eno2 farm001.lab.wit.com
|
// -i eno2 farm001.lab.wit.com
|
||||||
|
|
||||||
|
/*
|
||||||
func nsupdate() {
|
func nsupdate() {
|
||||||
var tsigSecret string
|
var tsigSecret string
|
||||||
log.Log(NET, "nsupdate() START")
|
log.Log(NET, "nsupdate() START")
|
||||||
|
@ -33,3 +31,4 @@ func nsupdate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package linuxstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -10,7 +10,7 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getProcessNameByPort(port int) string {
|
func GetProcessNameByPort(port int) string {
|
||||||
// Convert port to hex string
|
// Convert port to hex string
|
||||||
portHex := strconv.FormatInt(int64(port), 16)
|
portHex := strconv.FormatInt(int64(port), 16)
|
||||||
|
|
91
net.go
91
net.go
|
@ -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
|
|
||||||
}
|
|
27
structs.go
27
structs.go
|
@ -15,8 +15,14 @@ import (
|
||||||
var me Host
|
var me Host
|
||||||
|
|
||||||
type Host struct {
|
type Host struct {
|
||||||
|
myGui *gui.Node // the 'gui' binary tree root node
|
||||||
|
|
||||||
|
window *gadgets.BasicWindow // the main window
|
||||||
|
debug *gadgets.BasicWindow // the debug window
|
||||||
|
|
||||||
status *hostnameStatus // keeps track of the hostname and it's status
|
status *hostnameStatus // keeps track of the hostname and it's status
|
||||||
statusOS *linuxstatus.LinuxStatus // what the Linux OS sees
|
statusOS *linuxstatus.LinuxStatus // what the Linux OS sees
|
||||||
|
digStatus *digStatus // window of the results of DNS lookups
|
||||||
|
|
||||||
hostnameStatus *gui.Node // a summary for the user of where things are
|
hostnameStatus *gui.Node // a summary for the user of where things are
|
||||||
hostname *gadgets.OneLiner // the hostname grabbed from gadget.linuxStatus
|
hostname *gadgets.OneLiner // the hostname grabbed from gadget.linuxStatus
|
||||||
|
@ -30,7 +36,6 @@ type Host struct {
|
||||||
localSleep time.Duration
|
localSleep time.Duration
|
||||||
|
|
||||||
changed bool // set to true if things changed
|
changed bool // set to true if things changed
|
||||||
user string // name of the user
|
|
||||||
|
|
||||||
ipmap map[string]*IPtype // the current ip addresses
|
ipmap map[string]*IPtype // the current ip addresses
|
||||||
dnsmap map[string]*IPtype // the current dns addresses
|
dnsmap map[string]*IPtype // the current dns addresses
|
||||||
|
@ -41,16 +46,6 @@ type Host struct {
|
||||||
ipv4s map[string]dns.RR
|
ipv4s map[string]dns.RR
|
||||||
ipv6s map[string]dns.RR
|
ipv6s map[string]dns.RR
|
||||||
|
|
||||||
window *gadgets.BasicWindow // the main window
|
|
||||||
debug *gadgets.BasicWindow // more attempts to debug the DNS state
|
|
||||||
|
|
||||||
tab *gui.Node // the main dns tab
|
|
||||||
notes *gui.Node // using this to put notes here
|
|
||||||
|
|
||||||
// local OS settings, network interfaces, etc
|
|
||||||
// fqdn *gui.Node // display the full hostname
|
|
||||||
// Interfaces *gui.Node // Interfaces
|
|
||||||
// LocalSpeedActual *gui.Node // the time it takes to check each network interface
|
|
||||||
|
|
||||||
// DNS stuff
|
// DNS stuff
|
||||||
DnsAPI *gui.Node // what DNS API to use?
|
DnsAPI *gui.Node // what DNS API to use?
|
||||||
|
@ -61,18 +56,8 @@ type Host struct {
|
||||||
DnsSpeedActual *gui.Node // the last actual duration
|
DnsSpeedActual *gui.Node // the last actual duration
|
||||||
DnsSpeedLast string // the last state 'FAST', 'OK', etc
|
DnsSpeedLast string // the last state 'FAST', 'OK', etc
|
||||||
|
|
||||||
// fix *gui.Node // button for the user to click
|
|
||||||
// fixProc *gui.Node // button for the user to click
|
|
||||||
|
|
||||||
// mainStatus *gui.Node // group for the main display of stuff
|
|
||||||
// cloudflareB *gui.Node // cloudflare button
|
|
||||||
|
|
||||||
digStatus *digStatus
|
|
||||||
statusIPv6 *gadgets.OneLiner
|
statusIPv6 *gadgets.OneLiner
|
||||||
digStatusButton *gui.Node
|
digStatusButton *gui.Node
|
||||||
|
|
||||||
myDebug *gui.Node
|
|
||||||
myGui *gui.Node
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type IPtype struct {
|
type IPtype struct {
|
||||||
|
|
Loading…
Reference in New Issue