Compare commits
No commits in common. "cefe15539fc8f9d96a793c1aeea6e806cfc0944c" and "15d9f9769360b1cb8c748de8ee995030ade5eb35" have entirely different histories.
cefe15539f
...
15d9f97693
66
args.go
66
args.go
|
@ -22,32 +22,62 @@ var NOW log.LogFlag
|
||||||
var INFO log.LogFlag
|
var INFO log.LogFlag
|
||||||
var NET log.LogFlag
|
var NET log.LogFlag
|
||||||
var DNS log.LogFlag
|
var DNS log.LogFlag
|
||||||
var WARN log.LogFlag
|
var PROC log.LogFlag
|
||||||
var SPEW log.LogFlag
|
var SPEW log.LogFlag
|
||||||
var CHANGE log.LogFlag
|
var CHANGE log.LogFlag
|
||||||
var STATUS log.LogFlag
|
var STATUS log.LogFlag
|
||||||
|
|
||||||
func myreg(f *log.LogFlag, b bool, name string, desc string) {
|
|
||||||
f.B = b
|
|
||||||
f.Subsystem = "go.wit.com/control-panels/dns"
|
|
||||||
f.Short = "cpdns"
|
|
||||||
f.Desc = desc
|
|
||||||
f.Name = name
|
|
||||||
f.Register()
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
arg.MustParse(&args)
|
arg.MustParse(&args)
|
||||||
// fmt.Println(args.Foo, args.Bar, args.User)
|
// fmt.Println(args.Foo, args.Bar, args.User)
|
||||||
|
|
||||||
myreg(&NOW, true, "NOW", "temp debugging stuff")
|
NOW.B = false
|
||||||
myreg(&INFO, false, "INFO", "normal debugging stuff")
|
NOW.Name = "NOW"
|
||||||
myreg(&NET, false, "NET", "Network logging")
|
NOW.Subsystem = "cpdns"
|
||||||
myreg(&DNS, false, "DNS", "dnsStatus.update()")
|
NOW.Desc = "temp debugging stuff"
|
||||||
myreg(&WARN, true, "WARN", "bad things")
|
NOW.Register()
|
||||||
myreg(&SPEW, false, "SPEW", "spew stuff")
|
|
||||||
myreg(&CHANGE, true, "CHANGE", "when host or dns change")
|
INFO.B = false
|
||||||
myreg(&STATUS, false, "STATUS", "updateStatus()")
|
INFO.Name = "INFO"
|
||||||
|
INFO.Subsystem = "cpdns"
|
||||||
|
INFO.Desc = "normal debugging stuff"
|
||||||
|
INFO.Register()
|
||||||
|
|
||||||
|
NET.B = false
|
||||||
|
NET.Name = "NET"
|
||||||
|
NET.Subsystem = "cpdns"
|
||||||
|
NET.Desc = "Network logging"
|
||||||
|
NET.Register()
|
||||||
|
|
||||||
|
DNS.B = false
|
||||||
|
DNS.Name = "DNS"
|
||||||
|
DNS.Subsystem = "cpdns"
|
||||||
|
DNS.Desc = "dnsStatus.update()"
|
||||||
|
DNS.Register()
|
||||||
|
|
||||||
|
PROC.B = false
|
||||||
|
PROC.Name = "PROC"
|
||||||
|
PROC.Subsystem = "cpdns"
|
||||||
|
PROC.Desc = "/proc logging"
|
||||||
|
PROC.Register()
|
||||||
|
|
||||||
|
SPEW.B = false
|
||||||
|
SPEW.Name = "SPEW"
|
||||||
|
SPEW.Subsystem = "cpdns"
|
||||||
|
SPEW.Desc = "spew logging"
|
||||||
|
SPEW.Register()
|
||||||
|
|
||||||
|
CHANGE.B = true
|
||||||
|
CHANGE.Name = "CHANGE"
|
||||||
|
CHANGE.Subsystem = "cpdns"
|
||||||
|
CHANGE.Desc = "show droplet state changes"
|
||||||
|
CHANGE.Register()
|
||||||
|
|
||||||
|
STATUS.B = false
|
||||||
|
STATUS.Name = "STATUS"
|
||||||
|
STATUS.Subsystem = "cpdns"
|
||||||
|
STATUS.Desc = "updateStatus()"
|
||||||
|
STATUS.Register()
|
||||||
|
|
||||||
if debugger.ArgDebug() {
|
if debugger.ArgDebug() {
|
||||||
log.Log(true, "INIT() gui debug == true")
|
log.Log(true, "INIT() gui debug == true")
|
||||||
|
|
8
dns.go
8
dns.go
|
@ -40,7 +40,6 @@ 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
|
||||||
|
@ -75,7 +74,6 @@ 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,10 +111,10 @@ func lookupNS(domain string) {
|
||||||
}
|
}
|
||||||
tmp = shell.Chomp(tmp)
|
tmp = shell.Chomp(tmp)
|
||||||
|
|
||||||
if (tmp != me.statusDNS.NSrr.Get()) {
|
if (tmp != me.status.NSrr.Get()) {
|
||||||
me.changed = true
|
me.changed = true
|
||||||
log.Log(CHANGE, "lookupNS() setting changed to me.NSrr =", tmp)
|
log.Log(CHANGE, "lookupNS() setting me.NSrr =", tmp)
|
||||||
me.statusDNS.NSrr.Set(tmp)
|
me.status.NSrr.Set(tmp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
72
fix.go
72
fix.go
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
func fix() bool {
|
func fix() bool {
|
||||||
log.Warn("")
|
log.Warn("")
|
||||||
if ! me.statusDNS.Ready() {
|
if ! me.status.Ready() {
|
||||||
log.Warn("The IPv6 Control Panel is not Ready() yet")
|
log.Warn("The IPv6 Control Panel is not Ready() yet")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -30,77 +30,15 @@ func fix() bool {
|
||||||
log.Warn("You must first figure out why you can't look up IPv6 addresses")
|
log.Warn("You must first figure out why you can't look up IPv6 addresses")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if ! me.statusDNS.IPv4() {
|
if ! me.status.IPv4() {
|
||||||
log.Warn("You do not have real IPv4 addresses. Nothing to fix here")
|
log.Warn("You do not have real IPv4 addresses. Nothing to fix here")
|
||||||
}
|
}
|
||||||
if ! me.statusDNS.IPv6() {
|
if ! me.status.IPv6() {
|
||||||
log.Warn("IPv6 DNS is broken. Check what is broken here")
|
log.Warn("IPv6 DNS is broken. Check what is broken here")
|
||||||
fixIPv6dns()
|
log.Warn("What are my IPv6 addresses?")
|
||||||
|
log.Warn("What are the AAAA resource records in DNS?")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
log.Warn("YOU SHOULD BE IN IPv6 BLISS")
|
log.Warn("YOU SHOULD BE IN IPv6 BLISS")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func fixIPv6dns() {
|
|
||||||
log.Warn("What are my IPv6 addresses?")
|
|
||||||
osAAAA := make(map[string]string)
|
|
||||||
dnsAAAA := make(map[string]string)
|
|
||||||
|
|
||||||
for _, aaaa := range me.statusOS.GetIPv6() {
|
|
||||||
log.Warn("FOUND OS AAAA ip", aaaa)
|
|
||||||
osAAAA[aaaa] = "os"
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Warn("What are the AAAA resource records in DNS?")
|
|
||||||
for _, aaaa := range me.statusDNS.GetIPv6() {
|
|
||||||
log.Warn("FOUND DNS AAAA ip", aaaa)
|
|
||||||
dnsAAAA[aaaa] = "dns"
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove old DNS entries first
|
|
||||||
for aaaa, _ := range dnsAAAA {
|
|
||||||
if osAAAA[aaaa] == "dns" {
|
|
||||||
log.Warn("DNS AAAA is not in OS", aaaa)
|
|
||||||
if deleteFromDNS(aaaa) {
|
|
||||||
log.Warn("Delete AAAA", aaaa, "Worked")
|
|
||||||
} else {
|
|
||||||
log.Warn("Delete AAAA", aaaa, "Failed")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Warn("DNS AAAA is in OS", aaaa)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// now add new DNS entries
|
|
||||||
for aaaa, _ := range osAAAA {
|
|
||||||
if dnsAAAA[aaaa] == "dns" {
|
|
||||||
log.Warn("OS AAAA is in DNS", aaaa)
|
|
||||||
} else {
|
|
||||||
log.Warn("OS AAAA is not in DNS", aaaa)
|
|
||||||
if addToDNS(aaaa) {
|
|
||||||
log.Warn("Add AAAA", aaaa, "Worked")
|
|
||||||
} else {
|
|
||||||
log.Warn("Add AAAA", aaaa, "Failed")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func deleteFromDNS(aaaa string) bool {
|
|
||||||
log.Warn("deleteFromDNS", aaaa)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func addToDNS(aaaa string) bool {
|
|
||||||
log.Warn("TODO: Add this to DNS !!!!", aaaa)
|
|
||||||
log.Warn("what is your API provider?")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func exists(m map[string]bool, s string) bool {
|
|
||||||
if _, ok := m[s]; ok {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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"
|
||||||
|
@ -78,4 +77,3 @@ func fsnotifyNetworkInterfaceChanges() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
46
gui.go
46
gui.go
|
@ -50,7 +50,7 @@ func debugTab(title string) {
|
||||||
})
|
})
|
||||||
|
|
||||||
g2.NewButton("getProcessNameByPort()", func () {
|
g2.NewButton("getProcessNameByPort()", func () {
|
||||||
processName := linuxstatus.GetProcessNameByPort(53)
|
processName := getProcessNameByPort(53)
|
||||||
log.Info("Process with port 53:", processName)
|
log.Info("Process with port 53:", processName)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -70,7 +70,6 @@ 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
|
||||||
|
@ -94,7 +93,6 @@ 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
|
||||||
|
@ -118,7 +116,7 @@ func displayDNS() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
var a []string
|
var a []string
|
||||||
a = append(a, "fixme")
|
a = realA()
|
||||||
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")
|
||||||
|
@ -162,8 +160,8 @@ func mainWindow(title string) {
|
||||||
|
|
||||||
gr = me.window.Box().NewGroup("debugging")
|
gr = me.window.Box().NewGroup("debugging")
|
||||||
gr.NewButton("hostname status", func () {
|
gr.NewButton("hostname status", func () {
|
||||||
if ! me.statusDNS.Ready() {return}
|
if ! me.status.Ready() {return}
|
||||||
me.statusDNS.window.Toggle()
|
me.status.window.Toggle()
|
||||||
})
|
})
|
||||||
|
|
||||||
gr.NewButton("linuxstatus.New()", func () {
|
gr.NewButton("linuxstatus.New()", func () {
|
||||||
|
@ -245,7 +243,7 @@ func statusGrid(n *gui.Node) {
|
||||||
// run everything because something has changed
|
// run everything because something has changed
|
||||||
func updateDNS() {
|
func updateDNS() {
|
||||||
me.digStatus.Update()
|
me.digStatus.Update()
|
||||||
me.statusDNS.Update()
|
me.status.Update()
|
||||||
|
|
||||||
// log.Println("digAAAA()")
|
// log.Println("digAAAA()")
|
||||||
|
|
||||||
|
@ -267,30 +265,28 @@ 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()
|
||||||
// m := missingAAAA()
|
if (m != "") {
|
||||||
// if (m != "") {
|
if (cloudflare.CFdialog.ValueNode != nil) {
|
||||||
// if (cloudflare.CFdialog.ValueNode != nil) {
|
cloudflare.CFdialog.ValueNode.SetText(m)
|
||||||
// cloudflare.CFdialog.ValueNode.SetText(m)
|
}
|
||||||
// }
|
/*
|
||||||
// /*
|
rr := &cloudflare.RRT{
|
||||||
// rr := &cloudflare.RRT{
|
Type: "AAAA",
|
||||||
// Type: "AAAA",
|
Name: me.hostname,
|
||||||
// Name: me.hostname,
|
Ttl: "Auto",
|
||||||
// Ttl: "Auto",
|
Proxied: false,
|
||||||
// Proxied: false,
|
Content: m,
|
||||||
// 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
|
||||||
|
|
|
@ -40,7 +40,6 @@ type hostnameStatus struct {
|
||||||
// what the current IP address your network has given you
|
// what the current IP address your network has given you
|
||||||
currentIPv4 *gadgets.OneLiner
|
currentIPv4 *gadgets.OneLiner
|
||||||
currentIPv6 *gadgets.OneLiner
|
currentIPv6 *gadgets.OneLiner
|
||||||
currentAAAA string
|
|
||||||
|
|
||||||
// what the DNS servers have
|
// what the DNS servers have
|
||||||
NSrr *gadgets.OneLiner
|
NSrr *gadgets.OneLiner
|
||||||
|
@ -280,11 +279,6 @@ func (hs *hostnameStatus) missingAAAA() bool {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (hs *hostnameStatus) GetIPv6() []string {
|
|
||||||
if ! hs.Ready() { return nil}
|
|
||||||
return strings.Split(hs.currentAAAA, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hs *hostnameStatus) updateStatus() {
|
func (hs *hostnameStatus) updateStatus() {
|
||||||
if ! hs.Ready() { return }
|
if ! hs.Ready() { return }
|
||||||
var s string
|
var s string
|
||||||
|
@ -315,7 +309,7 @@ func (hs *hostnameStatus) updateStatus() {
|
||||||
// hs.dnsAction.SetText("DELETE")
|
// hs.dnsAction.SetText("DELETE")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hs.currentAAAA = strings.Join(vals, "\n")
|
hs.set(hs.dnsAAAA, s)
|
||||||
|
|
||||||
vals = lookupDoH(me.statusOS.GetHostname(), "A")
|
vals = lookupDoH(me.statusOS.GetHostname(), "A")
|
||||||
log.Log(STATUS, "IPv4 Addresses for ", me.statusOS.GetHostname(), "=", vals)
|
log.Log(STATUS, "IPv4 Addresses for ", me.statusOS.GetHostname(), "=", vals)
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package linuxstatus
|
package linuxstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/shell"
|
"go.wit.com/shell"
|
||||||
|
|
||||||
|
@ -65,12 +64,6 @@ func (ls *LinuxStatus) setHostShort() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LinuxStatus) GetIPv6() []string {
|
|
||||||
if ! me.Ready() {return nil}
|
|
||||||
tmp := me.workingIPv6.Get()
|
|
||||||
return strings.Split(tmp, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func lookupHostname() {
|
func lookupHostname() {
|
||||||
if ! me.Ready() {return}
|
if ! me.Ready() {return}
|
||||||
var err error
|
var err error
|
||||||
|
|
2
main.go
2
main.go
|
@ -46,7 +46,7 @@ func main() {
|
||||||
setupControlPanelWindow()
|
setupControlPanelWindow()
|
||||||
|
|
||||||
me.digStatus = NewDigStatusWindow(me.myGui)
|
me.digStatus = NewDigStatusWindow(me.myGui)
|
||||||
me.statusDNS = NewHostnameStatusWindow(me.myGui)
|
me.status = NewHostnameStatusWindow(me.myGui)
|
||||||
|
|
||||||
linuxstatus.New()
|
linuxstatus.New()
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
// 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
|
||||||
|
}
|
|
@ -6,6 +6,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ./go-nsupdate \
|
// ./go-nsupdate \
|
||||||
|
@ -13,7 +16,6 @@ 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")
|
||||||
|
@ -31,4 +33,3 @@ func nsupdate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
|
@ -1,4 +1,4 @@
|
||||||
package linuxstatus
|
package main
|
||||||
|
|
||||||
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)
|
||||||
|
|
30
structs.go
30
structs.go
|
@ -15,14 +15,8 @@ import (
|
||||||
var me Host
|
var me Host
|
||||||
|
|
||||||
type Host struct {
|
type Host struct {
|
||||||
myGui *gui.Node // the 'gui' binary tree root node
|
status *hostnameStatus // keeps track of the hostname and it's status
|
||||||
|
|
||||||
window *gadgets.BasicWindow // the main window
|
|
||||||
debug *gadgets.BasicWindow // the debug window
|
|
||||||
|
|
||||||
statusDNS *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
|
||||||
|
@ -36,6 +30,7 @@ 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
|
||||||
|
@ -46,6 +41,17 @@ 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?
|
||||||
DnsAAAA *gadgets.OneLiner // the actual DNS AAAA results
|
DnsAAAA *gadgets.OneLiner // the actual DNS AAAA results
|
||||||
|
@ -55,8 +61,18 @@ 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