upto the point where DNS update is next. RFC 2136

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-02-18 22:05:27 -06:00
parent 98a94c67ff
commit a75ea97b63
5 changed files with 92 additions and 14 deletions

View File

@ -34,3 +34,26 @@ deb:
netlink:
GO111MODULE="off" go get -v -u github.com/vishvananda/netlink
####### MODULE STUFF DOWN HERE
#
# What again is the 'right' way to do this?
# It seems like it changes from year to year. This is better than 'vendor/' (that was a terrible hack)
# maybe it's settled down finally. Use GO111MODULE="off" when you are developing. (?)
# When you are ready to release, version this and all the packages correctly. (?)
#
# At least, that is what I'm going to try to do as of Feb 18 2023.
#
build-with-custom-go.mod:
go build -modfile=local.go.mod ./...
# module <yourname>
# go 1.18
# require (
# github.com/versent/saml2aws/v2 v2.35.0
# )
# replace github.com/versent/saml2aws/v2 v2.35.0 => github.com/marcottedan/saml2aws/v2 master
# replace github.com/versent/saml2aws/v2 => /Users/dmarcotte/git/saml2aws/

2
debian/control vendored
View File

@ -4,6 +4,6 @@ Package: control-panel-dns
Maintainer: Jeff Carr <jcarr@wit.com>
Architecture: amd64
Depends:
Recommends: libgtk-3-0
Recommends: libgtk-3-0, ddclient, ddupdate
Description: a control panel for DNS and IPv6 settings
Goals: show the settings, validate & update DNS

23
gui.go
View File

@ -33,14 +33,12 @@ func initGUI() {
func addDNSTab(window *gui.Node, title string) {
var newNode, g, g2, tb *gui.Node
var err error
var name string
newNode = window.NewTab(title)
log("addDemoTab() newNode.Dump")
newNode.Dump()
g = newNode.NewGroup("group 1")
g = newNode.NewGroup("junk")
dd := g.NewDropdown("demoCombo2")
dd.AddDropdownName("more 1")
dd.AddDropdownName("more 2")
@ -51,21 +49,18 @@ func addDNSTab(window *gui.Node, title string) {
log("text =", s)
}
g.NewLabel("UID =")
g.NewButton("hello", func () {
log("world")
})
g2 = newNode.NewGroup("group 2")
g2 = newNode.NewGroup("Real Stuff")
tb = g2.NewTextbox("tb")
log("tb =", tb.GetText())
tb.OnChanged = func(*gui.Node) {
s := tb.GetText()
log("text =", s)
}
g2.NewButton("hello", func () {
log("world")
})
g2.NewButton("scanInterfaces()", func () {
scanInterfaces()
})
g2.NewButton("dump Host.ifmap", func () {
for i, t := range me.ifmap {
log("int =", i, "name =", t.name, t.iface)
@ -74,15 +69,17 @@ func addDNSTab(window *gui.Node, title string) {
g2.NewButton("checkDNS()", func () {
me.checkDNS()
})
g2.NewButton("os.Hostname()", func () {
name, err = os.Hostname()
log("name =", name, err)
g2.NewButton("getHostname()", func () {
getHostname()
})
g2.NewButton("os.User()", func () {
user, _ := user.Current()
spew.Dump(user)
log("os.Getuid =", os.Getuid())
})
g2.NewButton("Example_listLink()", func () {
Example_listLink()
})
g2.NewButton("Escalate()", func () {
Escalate()
})

45
hostname.go Normal file
View File

@ -0,0 +1,45 @@
// inspired from:
// https://github.com/mactsouk/opensource.com.git
// and
// https://coderwall.com/p/wohavg/creating-a-simple-tcp-server-in-go
package main
// import "net"
// 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"
// dnssec IPv6 socket library
import "git.wit.org/jcarr/dnssecsocket"
func getHostname() {
var err error
me.fqdn, err = fqdn.FqdnHostname()
if (err != nil) {
log("FQDN hostname error =", err)
exit()
return
}
log("FQDN hostname is", me.fqdn)
var aaaa []string
aaaa = getAAAA(me.fqdn)
log("AAAA =", aaaa)
}
func getAAAA(s string) []string {
// lookup the IP address from DNS
dnsRR := dnssecsocket.Dnstrace(s, "AAAA")
log(args.VerboseDNS, SPEW, dnsRR)
if (dnsRR == nil) {
return nil
}
ipaddr1 := dns.Field(dnsRR, 1)
ipaddr2 := dns.Field(dnsRR, 2)
log("ipaddr", ipaddr1, ipaddr2)
return []string{ipaddr1, ipaddr2}
}

13
unix.go
View File

@ -51,3 +51,16 @@ func dumpIPs(host string) {
log(host, ip)
}
}
/*
check if ddclient is installed, working, and/or configured
https://github.com/ddclient/ddclient
*/
func ddclient() {
}
/*
check if ddupdate is installed, working, and/or configured
*/
func ddupdate() {
}