2023-04-13 07:49:13 -05:00
|
|
|
// 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==" \
|
2023-12-20 15:12:26 -06:00
|
|
|
// -i eno2 farm001.lab.wit.com
|
2023-04-13 07:49:13 -05:00
|
|
|
|
|
|
|
func nsupdate() {
|
|
|
|
var tsigSecret string
|
2023-12-20 03:13:43 -06:00
|
|
|
debug(true, "nsupdate() START")
|
2023-04-13 07:49:13 -05:00
|
|
|
cmd := "go-nsupdate --tsig-algorithm=hmac-sha512"
|
|
|
|
tsigSecret = os.Getenv("TIG_SECRET")
|
|
|
|
cmd += " --tig-secret=\"" + tsigSecret + "\""
|
|
|
|
cmd += " -i wlo1 " + me.hostname
|
2023-12-20 03:13:43 -06:00
|
|
|
debug(true, "nsupdate() RUN:", cmd)
|
2023-04-13 07:49:13 -05:00
|
|
|
|
|
|
|
for s, t := range me.ipmap {
|
|
|
|
if (t.IsReal()) {
|
|
|
|
if (t.ipv6) {
|
2023-12-20 03:13:43 -06:00
|
|
|
debug(true, "nsupdate() found real AAAA =", s, "on iface", t.iface.Name)
|
2023-04-13 07:49:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|