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"
|
2024-01-03 19:33:13 -06:00
|
|
|
|
|
|
|
"go.wit.com/log"
|
2023-04-13 07:49:13 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// ./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
|
2024-01-03 19:33:13 -06:00
|
|
|
log.Log(NET, "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
|
2024-01-03 19:33:13 -06:00
|
|
|
log.Log(NET, "nsupdate() RUN:", cmd)
|
2023-04-13 07:49:13 -05:00
|
|
|
|
|
|
|
for s, t := range me.ipmap {
|
|
|
|
if (t.IsReal()) {
|
|
|
|
if (t.ipv6) {
|
2024-01-03 19:33:13 -06:00
|
|
|
log.Log(NET, "nsupdate() found real AAAA =", s, "on iface", t.iface.Name)
|
2023-04-13 07:49:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|