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 *.swp
/plugins/* /plugins/*
examples/control-panel-digitalocean/control-panel-digitalocean
examples/control-panel-cloudflare/control-panel-cloudflare examples/control-panel-cloudflare/control-panel-cloudflare

View File

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

View File

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