getting close to nsupdate
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
9975aefe1e
commit
5d7004ad92
16
gui.go
16
gui.go
|
@ -38,7 +38,7 @@ func addDNSTab(title string) {
|
|||
g2.NewButton("Load 'gocui'", func () {
|
||||
// this set the xterm and mate-terminal window title. maybe works generally?
|
||||
fmt.Println("\033]0;" + title + "blah \007")
|
||||
gui.LoadPlugin("gocui")
|
||||
myGui.LoadToolkit("gocui")
|
||||
})
|
||||
|
||||
g2.NewButton("Network Interfaces", func () {
|
||||
|
@ -59,6 +59,11 @@ func addDNSTab(title string) {
|
|||
}
|
||||
})
|
||||
|
||||
g2.NewButton("Update DNS", func () {
|
||||
log("updateDNS()")
|
||||
updateDNS()
|
||||
})
|
||||
|
||||
g2.NewButton("checkDNS()", func () {
|
||||
checkDNS()
|
||||
})
|
||||
|
@ -139,12 +144,8 @@ func nsupdateGroup(w *gui.Node) {
|
|||
grid.NewLabel("DNS Status =")
|
||||
me.DnsStatus = grid.NewLabel("unknown")
|
||||
|
||||
g.NewButton("Update DNS", func () {
|
||||
log("updateDNS()")
|
||||
updateDNS()
|
||||
me.tab.Margin()
|
||||
me.tab.Pad()
|
||||
grid.Pad()
|
||||
g.NewButton("go-nsupdate", func () {
|
||||
nsupdate()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -194,6 +195,7 @@ func updateDNS() {
|
|||
} else {
|
||||
me.DnsStatus.SetText("BROKEN")
|
||||
log("Need to run go-nsupdate here")
|
||||
nsupdate()
|
||||
}
|
||||
|
||||
user, _ := user.Current()
|
||||
|
|
5
main.go
5
main.go
|
@ -39,13 +39,13 @@ func main() {
|
|||
log("Toolkit = ", args.Toolkit)
|
||||
for i, t := range args.Toolkit {
|
||||
log("trying to load plugin", i, t)
|
||||
gui.LoadPlugin(t)
|
||||
myGui.LoadToolkit(t)
|
||||
}
|
||||
|
||||
// will set all debugging flags
|
||||
gui.SetDebug(true)
|
||||
|
||||
myGui = gui.New()
|
||||
myGui = gui.New().LoadToolkit("gocui")
|
||||
sleep(1)
|
||||
setupControlPanelWindow()
|
||||
sleep(1)
|
||||
|
@ -54,6 +54,7 @@ func main() {
|
|||
gui.DebugWindow()
|
||||
}
|
||||
gui.ShowDebugValues()
|
||||
go gui.Watchdog()
|
||||
|
||||
// forever monitor for network and dns changes
|
||||
checkNetworkChanges()
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
// 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 (
|
||||
"os"
|
||||
)
|
||||
|
||||
// ./go-nsupdate \
|
||||
// --tsig-algorithm=hmac-sha512 \
|
||||
// --tsig-secret="OWh5/ZHIyaz7B8J9m9ZDqZ8448Pke0PTpkYbZmFcOf5a6rEzgmcwrG91u1BHi1/4us+mKKEobDPLw1x6sD+ZJw==" \
|
||||
// -i eno2 farm001.lab.wit.org
|
||||
|
||||
func nsupdate() {
|
||||
var tsigSecret string
|
||||
log(true, "nsupdate() START")
|
||||
cmd := "go-nsupdate --tsig-algorithm=hmac-sha512"
|
||||
tsigSecret = os.Getenv("TIG_SECRET")
|
||||
cmd += " --tig-secret=\"" + tsigSecret + "\""
|
||||
cmd += " -i wlo1 " + me.hostname
|
||||
log(true, "nsupdate() RUN:", cmd)
|
||||
|
||||
for s, t := range me.ipmap {
|
||||
if (t.IsReal()) {
|
||||
if (t.ipv6) {
|
||||
log(true, "nsupdate() found real AAAA =", s, "on iface", t.iface.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue