add digital ocean & DNS state windows

lists digital ocean droplets
    create a new digital ocean droplet
    knows what needs to be done to get IPv4 and IPv6 to work
    update windows on Show()
    make a window for the state of DNS specific to the hostname

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-12-29 01:36:10 -06:00
parent a84e307c77
commit beb076375e
3 changed files with 11 additions and 21 deletions

1
.gitignore vendored
View File

@ -4,4 +4,5 @@ control-panel-dns
*.swp
/plugins/*
examples/control-panel-digitalocean/control-panel-digitalocean
examples/control-panel-cloudflare/control-panel-cloudflare

View File

@ -92,7 +92,7 @@ func NewDigStatusWindow(p *gui.Node) *digStatus {
ds.ready = false
ds.hidden = true
ds.window = p.NewWindow("DNS Lookup Status")
ds.window = p.NewWindow("DNS Resolver Status")
ds.window.Custom = func () {
ds.hidden = true
ds.window.Hide()

View File

@ -1,29 +1,19 @@
// inspired from:
// https://github.com/mactsouk/opensource.com.git
// and
// https://coderwall.com/p/wohavg/creating-a-simple-tcp-server-in-go
// figures out if your hostname is valid
// then checks if your DNS is setup correctly
package main
import (
"log"
// "net"
"strings"
"go.wit.com/log"
"go.wit.com/shell"
"go.wit.com/control-panel-dns/cloudflare"
"github.com/miekg/dns"
// will try to get this hosts FQDN
"github.com/Showmax/go-fqdn"
)
// will try to get this hosts FQDN
import "github.com/Showmax/go-fqdn"
// this is the king of dns libraries
// import "github.com/miekg/dns"
func getHostname() {
var err error
var s string = "gui.Label == nil"
@ -59,15 +49,15 @@ func getHostname() {
test = hshort + "." + dn
if (me.hostname != test) {
debug(LogInfo, "me.hostname", me.hostname, "does not equal", test)
if (me.hostnameStatus.S != "BROKEN") {
if (me.hostnameStatusOLD.S != "BROKEN") {
debug(LogChange, "me.hostname", me.hostname, "does not equal", test)
me.changed = true
me.hostnameStatus.SetText("BROKEN")
me.hostnameStatusOLD.SetText("BROKEN")
}
} else {
if (me.hostnameStatus.S != "VALID") {
if (me.hostnameStatusOLD.S != "VALID") {
debug(LogChange, "me.hostname", me.hostname, "is valid")
me.hostnameStatus.SetText("VALID")
me.hostnameStatusOLD.SetText("VALID")
me.changed = true
}
// enable the cloudflare button if the provider is cloudflare
@ -140,7 +130,6 @@ func digAAAA(hostname string) []string {
log.Println("digAAAA() RUNNING dnsAAAAlookupDoH(domain)")
ipv6Addresses, _ = dnsAAAAlookupDoH(hostname)
log.Println("digAAAA() has ipv6Addresses =", strings.Join(ipv6Addresses, " "))
log.Printf("digAAAA() IPv6 Addresses for %s:\n", hostname)
for _, addr := range ipv6Addresses {
log.Println(addr)
}