Compare commits
No commits in common. "5e9f1591cab5602ac9d9f6e6a24f83ba5dc86126" and "cefe15539fc8f9d96a793c1aeea6e806cfc0944c" have entirely different histories.
5e9f1591ca
...
cefe15539f
75
fix.go
75
fix.go
|
@ -3,113 +3,98 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/cloudflare"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func fix() bool {
|
func fix() bool {
|
||||||
log.Log(CHANGE, "")
|
log.Warn("")
|
||||||
if ! me.statusDNS.Ready() {
|
if ! me.statusDNS.Ready() {
|
||||||
log.Log(CHANGE, "The IPv6 Control Panel is not Ready() yet")
|
log.Warn("The IPv6 Control Panel is not Ready() yet")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if me.statusOS.ValidHostname() {
|
if me.statusOS.ValidHostname() {
|
||||||
log.Log(CHANGE, "GOOD Your hostname is VALID:", me.statusOS.GetHostname())
|
log.Warn("Your hostname is VALID:", me.statusOS.GetHostname())
|
||||||
} else {
|
} else {
|
||||||
log.Log(CHANGE, "You must first fix your hostname:", me.statusOS.GetHostname())
|
log.Warn("You must first fix your hostname:", me.statusOS.GetHostname())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if me.digStatus.IPv4() {
|
if me.digStatus.IPv4() {
|
||||||
log.Log(CHANGE, "GOOD IPv4 addresses are resolving")
|
log.Warn("IPv4 addresses are resolving")
|
||||||
} else {
|
} else {
|
||||||
log.Log(CHANGE, "You must first figure out why you can't look up IPv4 addresses")
|
log.Warn("You must first figure out why you can't look up IPv4 addresses")
|
||||||
log.Log(CHANGE, "Are you on the internet at all?")
|
log.Warn("Are you on the internet at all?")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if me.digStatus.IPv6() {
|
if me.digStatus.IPv6() {
|
||||||
log.Log(CHANGE, "GOOD IPv6 addresses are resolving")
|
log.Warn("IPv6 addresses are resolving")
|
||||||
} else {
|
} else {
|
||||||
log.Log(CHANGE, "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.statusDNS.IPv4() {
|
||||||
log.Log(CHANGE, "OK 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.statusDNS.IPv6() {
|
||||||
log.Log(CHANGE, "IPv6 DNS is broken. Check what is broken here")
|
log.Warn("IPv6 DNS is broken. Check what is broken here")
|
||||||
if fixIPv6dns() {
|
fixIPv6dns()
|
||||||
log.Log(CHANGE, "IPv6 DNS Repair is underway")
|
return false
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
log.Log(CHANGE, "GOOD YOU SHOULD BE IN IPv6 BLISS")
|
log.Warn("YOU SHOULD BE IN IPv6 BLISS")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func fixIPv6dns() bool {
|
func fixIPv6dns() {
|
||||||
log.Log(INFO, "What are my IPv6 addresses?")
|
log.Warn("What are my IPv6 addresses?")
|
||||||
var broken bool = false
|
|
||||||
osAAAA := make(map[string]string)
|
osAAAA := make(map[string]string)
|
||||||
dnsAAAA := make(map[string]string)
|
dnsAAAA := make(map[string]string)
|
||||||
|
|
||||||
for _, aaaa := range me.statusOS.GetIPv6() {
|
for _, aaaa := range me.statusOS.GetIPv6() {
|
||||||
log.Log(INFO, "FOUND OS AAAA ip", aaaa)
|
log.Warn("FOUND OS AAAA ip", aaaa)
|
||||||
osAAAA[aaaa] = "os"
|
osAAAA[aaaa] = "os"
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Log(INFO, "What are the AAAA resource records in DNS?")
|
log.Warn("What are the AAAA resource records in DNS?")
|
||||||
for _, aaaa := range me.statusDNS.GetIPv6() {
|
for _, aaaa := range me.statusDNS.GetIPv6() {
|
||||||
log.Log(INFO, "FOUND DNS AAAA ip", aaaa)
|
log.Warn("FOUND DNS AAAA ip", aaaa)
|
||||||
dnsAAAA[aaaa] = "dns"
|
dnsAAAA[aaaa] = "dns"
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove old DNS entries first
|
// remove old DNS entries first
|
||||||
for aaaa, _ := range dnsAAAA {
|
for aaaa, _ := range dnsAAAA {
|
||||||
if osAAAA[aaaa] == "dns" {
|
if osAAAA[aaaa] == "dns" {
|
||||||
log.Log(INFO, "DNS AAAA is not in OS", aaaa)
|
log.Warn("DNS AAAA is not in OS", aaaa)
|
||||||
broken = true
|
|
||||||
if deleteFromDNS(aaaa) {
|
if deleteFromDNS(aaaa) {
|
||||||
log.Log(INFO, "Delete AAAA", aaaa, "Worked")
|
log.Warn("Delete AAAA", aaaa, "Worked")
|
||||||
} else {
|
} else {
|
||||||
log.Log(INFO, "Delete AAAA", aaaa, "Failed")
|
log.Warn("Delete AAAA", aaaa, "Failed")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Log(INFO, "DNS AAAA is in OS", aaaa)
|
log.Warn("DNS AAAA is in OS", aaaa)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now add new DNS entries
|
// now add new DNS entries
|
||||||
for aaaa, _ := range osAAAA {
|
for aaaa, _ := range osAAAA {
|
||||||
if dnsAAAA[aaaa] == "dns" {
|
if dnsAAAA[aaaa] == "dns" {
|
||||||
log.Log(INFO, "OS AAAA is in DNS", aaaa)
|
log.Warn("OS AAAA is in DNS", aaaa)
|
||||||
} else {
|
} else {
|
||||||
broken = true
|
log.Warn("OS AAAA is not in DNS", aaaa)
|
||||||
log.Log(INFO, "OS AAAA is not in DNS", aaaa)
|
|
||||||
if addToDNS(aaaa) {
|
if addToDNS(aaaa) {
|
||||||
log.Log(INFO, "Add AAAA", aaaa, "Worked")
|
log.Warn("Add AAAA", aaaa, "Worked")
|
||||||
} else {
|
} else {
|
||||||
log.Log(INFO, "Add AAAA", aaaa, "Failed")
|
log.Warn("Add AAAA", aaaa, "Failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if anything doesn't match, return false
|
|
||||||
return broken
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteFromDNS(aaaa string) bool {
|
func deleteFromDNS(aaaa string) bool {
|
||||||
log.Log(CHANGE, "deleteFromDNS", aaaa)
|
log.Warn("deleteFromDNS", aaaa)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func addToDNS(aaaa string) bool {
|
func addToDNS(aaaa string) bool {
|
||||||
log.Log(CHANGE, "TODO: Add this to DNS !!!!", aaaa)
|
log.Warn("TODO: Add this to DNS !!!!", aaaa)
|
||||||
api := me.statusDNS.API()
|
log.Warn("what is your API provider?")
|
||||||
log.Log(CHANGE, "what is your API provider?", api)
|
|
||||||
if api == "cloudflare" {
|
|
||||||
log.Log(CHANGE, "Let's try an ADD via the Cloudflare API")
|
|
||||||
hostname := me.statusOS.GetHostname()
|
|
||||||
return cloudflare.Create("wit.com", hostname, aaaa)
|
|
||||||
}
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
gui.go
5
gui.go
|
@ -193,10 +193,7 @@ func mainWindow(title string) {
|
||||||
me.digStatus.window.Toggle()
|
me.digStatus.window.Toggle()
|
||||||
})
|
})
|
||||||
gr.NewButton("cloudflare wit.com", func () {
|
gr.NewButton("cloudflare wit.com", func () {
|
||||||
if me.witcom != nil {
|
cloudflare.CreateRR(me.myGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06")
|
||||||
me.witcom.Toggle()
|
|
||||||
}
|
|
||||||
me.witcom = cloudflare.CreateRR(me.myGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06")
|
|
||||||
})
|
})
|
||||||
gr.NewButton("Debug", func () {
|
gr.NewButton("Debug", func () {
|
||||||
me.debug.Toggle()
|
me.debug.Toggle()
|
||||||
|
|
|
@ -29,7 +29,6 @@ func myreg(f *log.LogFlag, b bool, name string, desc string) {
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
myreg(&NOW, true, "NOW", "temp debugging stuff")
|
myreg(&NOW, true, "NOW", "temp debugging stuff")
|
||||||
myreg(&INFO, false, "INFO", "normal debugging stuff")
|
|
||||||
myreg(&NET, false, "NET", "Network Logging")
|
myreg(&NET, false, "NET", "Network Logging")
|
||||||
myreg(&DNS, false, "DNS", "dnsStatus.update()")
|
myreg(&DNS, false, "DNS", "dnsStatus.update()")
|
||||||
myreg(&PROC, false, "PROC", "/proc logging")
|
myreg(&PROC, false, "PROC", "/proc logging")
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui/gui"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/gui/gadgets"
|
||||||
// "go.wit.com/gui/cloudflare"
|
|
||||||
"go.wit.com/control-panels/dns/linuxstatus"
|
"go.wit.com/control-panels/dns/linuxstatus"
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
|
@ -58,7 +57,6 @@ type Host struct {
|
||||||
|
|
||||||
statusIPv6 *gadgets.OneLiner
|
statusIPv6 *gadgets.OneLiner
|
||||||
digStatusButton *gui.Node
|
digStatusButton *gui.Node
|
||||||
witcom *gadgets.BasicWindow
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type IPtype struct {
|
type IPtype struct {
|
||||||
|
|
Loading…
Reference in New Issue