Created
September 9, 2015 20:48
-
-
Save nathan-osman/688770de6e53a1844c3e to your computer and use it in GitHub Desktop.
Update a DNS record via an HTTP GET request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile for the current platform with: | |
// go build dnsupdate.go | |
// Cross-compile for Windows with: | |
// GOOS=windows GOARCH=amd64 go build dnsupdate.go | |
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
// Replace [...] with the correct token for your DNS entry | |
const updateURL = "https://freedns.afraid.org/dynamic/update.php?[...]" | |
func main() { | |
fmt.Println("Updating private DNS entry...") | |
if _, err := http.Get(updateURL); err != nil { | |
fmt.Println(err.Error()) | |
} else { | |
fmt.Println("Private DNS entry updated!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment