update @ record as well

This commit is contained in:
Viktor Barzin 2024-12-02 21:50:44 +00:00
parent 5ae9422083
commit a475de6923
2 changed files with 8 additions and 3 deletions

View file

@ -192,7 +192,7 @@ func run() error {
if publicDNSIp.Equal(dynamicDNSIp) { if publicDNSIp.Equal(dynamicDNSIp) {
glog.Infof("IPs of dyndns and current ip match, nothing to do: current=%s, dyndns=%s", publicDNSIp, dynamicDNSIp) glog.Infof("IPs of dyndns and current ip match, nothing to do: current=%s, dyndns=%s", publicDNSIp, dynamicDNSIp)
// return nil return nil
} }
// Send notification as glue records can't be modified programatically for godaddy :/ // Send notification as glue records can't be modified programatically for godaddy :/
defer notifyForIPChange(publicDNSIp, dynamicDNSIp) defer notifyForIPChange(publicDNSIp, dynamicDNSIp)

View file

@ -57,8 +57,13 @@ func UpdatePublicIPViaTechnitiumAPI(newIp net.IP, username string, password stri
if err != nil { if err != nil {
return errors.Wrap(err, "failed to get technitium token") return errors.Wrap(err, "failed to get technitium token")
} }
for _, ns := range []string{"ns1", "ns2"} { for _, ns := range []string{"ns1", "ns2", "@"} {
nsRecordName := ns + ".viktorbarzin.me" nsRecordName := ""
if ns == "@" {
nsRecordName = "viktorbarzin.me."
} else {
nsRecordName = ns + ".viktorbarzin.me"
}
currIpStr, err := getRecordValue(token, nsRecordName, "A") currIpStr, err := getRecordValue(token, nsRecordName, "A")
if err != nil { if err != nil {
return errors.Wrap(err, "failed to get A record for ns server") return errors.Wrap(err, "failed to get A record for ns server")