summaryrefslogtreecommitdiff
path: root/dns.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-02-18 23:37:11 -0600
committerJeff Carr <[email protected]>2023-02-18 23:37:11 -0600
commit7ad38cdf6c3fdb7bc7f0c36ed2c1c63426a3b906 (patch)
tree5e4fc79919546fdd0ea34fd67be4001d504f446c /dns.go
parent3959b6c328fc335475f2e9df8aaabbc9a1ca7c43 (diff)
v0.0.2 next step: acutally try to nsupdate
upto the point where DNS update is next. start displaying real AAAA & naming buttons add RFC 2136 defining nsupdate. Vixie et al in 1997 Personal thansk to Paul for meeting with me some years back ready to pull DNS records starting a checkDNS() function dampen output. actually track IPs poll every 2 seconds (netlink is not the right thing here) ready to start looking for changes screw everything about logging. I hate log.whatthefuck*(){} Do you know what I don't care about? log() You shouldn't care either. Ignore it until you need it that is what logging is for. building something that works. So, here you go. a damn log() function in one place Also, because I'm annoyed today sleep() and exit() Because, when I want you to sleep or exit, I don't want to go to the top of a file and declare stupid shit related to nanoseconds or add "import os.Exit" or whatever the hell stop wasting my time. life is short. if he sit tunnelbroker down add IsRealIP() and IsIPv6() need a netlink function to trigger on changes (nope) put the gui plugin's in the debian package for now set the window title build a .deb package Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'dns.go')
-rw-r--r--dns.go65
1 files changed, 44 insertions, 21 deletions
diff --git a/dns.go b/dns.go
index 017ffce..14b6683 100644
--- a/dns.go
+++ b/dns.go
@@ -5,28 +5,10 @@
package main
import (
-// "os"
-// "os/exec"
- "log"
"net"
-// "git.wit.org/wit/gui"
-// "github.com/davecgh/go-spew/spew"
)
-type IPtype struct {
- // IP string
- IPv4 bool
- IPv6 bool
- LinkLocal bool
-}
-
-type Host struct {
- Name string
- domainname string
- hostname string
- fqdn string
- ips map[string]*IPtype
-}
+var dnsTTL int = 3600; // Recheck DNS is working every TTL (in seconds)
/*
Check a bunch of things. If they don't work right, then things are not correctly configured
@@ -43,9 +25,50 @@ func (h *Host) verifyETC() bool {
func (h *Host) updateIPs(host string) {
ips, err := net.LookupIP(host)
if err != nil {
- log.Fatal(err)
+ exit(err)
}
for _, ip := range ips {
- log.Println(host, ip)
+ log(host, ip)
+ }
+}
+
+func (h *Host) setIPv4(ipv4s map[string]*IPtype) {
+ for ip, t := range ipv4s {
+ log("IPv4", ip, t)
}
}
+
+func (h *Host) checkDNS() {
+ var ip4 bool = false
+ var ip6 bool = false
+
+ for s, t := range h.ipmap {
+ i := t.iface
+ ipt := "IPv4"
+ if (t.ipv6) {
+ ipt = "IPv6"
+ }
+ if (! t.IsReal()) {
+ log(args.VerboseDNS, "\tIP is not Real", ipt, i.Index, i.Name, s)
+ continue
+ }
+
+ log(args.VerboseDNS, "\tIP is Real ", ipt, i.Index, i.Name, s)
+ if (t.ipv6) {
+ ip6 = true
+ } else {
+ ip4 = true
+ }
+ }
+
+ if (ip4 == true) {
+ log(args.VerboseDNS, "IPv4 should work. Wow. You actually have a real IPv4 address")
+ } else {
+ log(args.VerboseDNS, "IPv4 is broken. (be nice and setup ipv4-only.wit.com)")
+ }
+ if (ip6 == true) {
+ log(args.VerboseDNS, "IPv6 should be working. Need to test it here.")
+ } else {
+ log(args.VerboseDNS, "IPv6 is broken. Need to fix it here.")
+ }
+}