From 5645231c498048dd4a1e4b097437a6f4c63cd022 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 28 Mar 2023 08:53:51 -0500 Subject: [PATCH] remove places the app could exit Signed-off-by: Jeff Carr --- bash.go | 1 + dns.go | 2 +- fsnotify.go | 6 +++-- gui.go | 4 ++++ he-ipv6-tunnel.sh | 57 ----------------------------------------------- hostname.go | 1 - log.go | 1 + main.go | 2 -- rtnetlink.go | 3 ++- unix.go | 3 ++- 10 files changed, 15 insertions(+), 65 deletions(-) delete mode 100755 he-ipv6-tunnel.sh diff --git a/bash.go b/bash.go index 6daacec..2f4b8ca 100644 --- a/bash.go +++ b/bash.go @@ -53,6 +53,7 @@ func test() error { func mainBash() { if err := test(); err != nil { + log(logError, "exit in mainBash()") exit(err) } } diff --git a/dns.go b/dns.go index 4c32936..8b89681 100644 --- a/dns.go +++ b/dns.go @@ -23,7 +23,7 @@ func (h *Host) verifyETC() bool { func (h *Host) updateIPs(host string) { ips, err := net.LookupIP(host) if err != nil { - exit(err) + log(logError, "updateIPs failed", err) } for _, ip := range ips { log(host, ip) diff --git a/fsnotify.go b/fsnotify.go index 814c9c7..cff67b7 100644 --- a/fsnotify.go +++ b/fsnotify.go @@ -13,7 +13,8 @@ func watchSysClassNet() { // Create new watcher. watcher, err := fsnotify.NewWatcher() if err != nil { - exit(err) + log(logError, "watchSysClassNet() failed:", err) + return } defer watcher.Close() @@ -41,7 +42,8 @@ func watchSysClassNet() { // Add a path. err = watcher.Add("/tmp") if err != nil { - exit(err) + log(logError, "watchSysClassNet() watcher.Add() failed:", err) + return } // Block main goroutine forever. diff --git a/gui.go b/gui.go index eb02fd6..05f52c4 100644 --- a/gui.go +++ b/gui.go @@ -135,6 +135,7 @@ func nsupdateGroup(w *gui.Node) { me.DnsStatus = grid.NewLabel("unknown") g.NewButton("Update DNS", func () { + log("updateDNS()") updateDNS() me.tab.Margin() me.tab.Pad() @@ -160,7 +161,9 @@ func updateDNS() { h = "unknown.lab.wit.org" // h = "hpdevone.lab.wit.org" } + log("dnsAAAA()()") aaaa = dnsAAAA(h) + log("dnsAAAA()()") log(SPEW, me) if (aaaa == nil) { log("There are no DNS AAAA records for hostname: ", h) @@ -194,4 +197,5 @@ func updateDNS() { if (me.uid != nil) { me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")") } + log("updateDNS() END") } diff --git a/he-ipv6-tunnel.sh b/he-ipv6-tunnel.sh deleted file mode 100755 index bc95429..0000000 --- a/he-ipv6-tunnel.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -x - -## Tunnel ID: 818143 -# Creation Date:Feb 12, 2023 -# Description: -# IPv6 Tunnel Endpoints -# Server IPv4 Address:184.105.253.14 -# Server IPv6 Address:2001:470:1f10:2a::1/64 -# Client IPv4 Address:74.87.91.117 -# Client IPv6 Address:2001:470:1f10:2a::2/64 -# Routed IPv6 Prefixes -# Routed /64:2001:470:1f11:2a::/64 -# Routed /48:Assign /48 -# DNS Resolvers -# Anycast IPv6 Caching Nameserver:2001:470:20::2 -# Anycast IPv4 Caching Nameserver:74.82.42.42 -# DNS over HTTPS / DNS over TLS:ordns.he.net -# rDNS DelegationsEdit -# rDNS Delegated NS1: -# rDNS Delegated NS2: -# rDNS Delegated NS3: -# rDNS Delegated NS4: -# rDNS Delegated NS5: - -# ifconfig sit0 up -# ifconfig sit0 inet6 tunnel ::184.105.253.14 -# ifconfig sit1 up -# ifconfig sit1 inet6 add 2001:470:1f10:2a::2/64 -# route -A inet6 add ::/0 dev sit1 - -if [ "$1" = "down" ]; then - ip tunnel del he-ipv6 - rmmod sit - exit -fi - -if [ "$1" = "ping" ]; then - ping -c 3 2001:470:1f10:13d::1 - exit -fi - -modprobe ipv6 -ip tunnel add he-ipv6 mode sit remote 184.105.253.14 local 40.132.180.131 ttl 255 -ip link set he-ipv6 up -ip addr add 2001:470:1f10:13d::2/64 dev he-ipv6 -ip route add ::/0 dev he-ipv6 -ip -f inet6 addr -ifconfig he-ipv6 mtu 1460 - - -# old attempt from the something or pabtz hotel -# modprobe ipv6 -# ip tunnel add he-ipv6 mode sit remote 184.105.253.14 local 74.87.91.117 ttl 255 -# ip link set he-ipv6 up -# ip addr add 2001:470:1f10:2a::2/64 dev he-ipv6 -# ip route add ::/0 dev he-ipv6 -# ip -f inet6 addr diff --git a/hostname.go b/hostname.go index f035511..b4b0d42 100644 --- a/hostname.go +++ b/hostname.go @@ -22,7 +22,6 @@ func getHostname() { s, err = fqdn.FqdnHostname() if (err != nil) { log("FQDN hostname error =", err) - exit() return } if (me.fqdn != nil) { diff --git a/log.go b/log.go index 19a1d3d..aa67acf 100644 --- a/log.go +++ b/log.go @@ -25,5 +25,6 @@ func sleep(a ...any) { } func exit(a ...any) { + log(logError, "got to log() exit") witlog.Exit(a...) } diff --git a/main.go b/main.go index 00f5a3b..6eb15c3 100644 --- a/main.go +++ b/main.go @@ -33,10 +33,8 @@ func main() { sleep(.3) sleep(.2) sleep("done scanning net") - // exit("done scanning net") // Example_listLink() - // exit() log("Toolkit = ", args.Toolkit) // gui.InitPlugins([]string{"andlabs"}) diff --git a/rtnetlink.go b/rtnetlink.go index 83d2c34..4185c99 100644 --- a/rtnetlink.go +++ b/rtnetlink.go @@ -9,7 +9,8 @@ func Example_listLink() { // Dial a connection to the rtnetlink socket conn, err := rtnetlink.Dial(nil) if err != nil { - exit(err) + log(logError, "Example_listLink() failed", err) + return } defer conn.Close() diff --git a/unix.go b/unix.go index a8eb28b..09635d8 100644 --- a/unix.go +++ b/unix.go @@ -24,6 +24,7 @@ func Escalate() { cmd.Stderr = os.Stderr err := cmd.Run() if err != nil { + log(logError, "exit in Escalate()") exit(err) } } @@ -45,7 +46,7 @@ func DumpPublicDNSZone(zone string) { func dumpIPs(host string) { ips, err := net.LookupIP(host) if err != nil { - exit(err) + log(logError, "dumpIPs() failed:", err) } for _, ip := range ips { log(host, ip)