summaryrefslogtreecommitdiff
path: root/nsupdate.go
blob: add2c94246487632c119b8252fb385fd668b189d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 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.wit.com/log"
)

//	./go-nsupdate \
//		--tsig-algorithm=hmac-sha512 \
//		--tsig-secret="OWh5/ZHIyaz7B8J9m9ZDqZ8448Pke0PTpkYbZmFcOf5a6rEzgmcwrG91u1BHi1/4us+mKKEobDPLw1x6sD+ZJw==" \
//		-i eno2 farm001.lab.wit.com

func nsupdate() {
	var tsigSecret string
	log.Log(NET, "nsupdate() START")
	cmd := "go-nsupdate --tsig-algorithm=hmac-sha512"
	tsigSecret = os.Getenv("TIG_SECRET")
	cmd += " --tig-secret=\"" + tsigSecret + "\""
	cmd += " -i wlo1 " + me.statusOS.GetHostname()
	log.Log(NET, "nsupdate() RUN:", cmd)

	for s, t := range me.ipmap {
		if (t.IsReal()) {
			if (t.ipv6) {
				log.Log(NET, "nsupdate() found real AAAA =", s, "on iface", t.iface.Name)
			}
		}
	}
}