-
-
Save miekg/5f19c9f114b4764017963a323ba7345e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"github.com/miekg/dns" | |
) | |
// host(1) port(2) TTL(3) | |
func main() { | |
fmt.Fprintf(os.Stderr, "%s host port TTL", os.Args[0]) | |
s := fmt.Sprintf(". %s IN SRV 0 0 %s %s", os.Args[3], os.Args[2], os.Args[1]) | |
srv, err := dns.NewRR(s) | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Printf("Send HC update for %s", srv) | |
m := new(dns.Msg) | |
m.SetQuestion("example.com.", dns.TypeSRV) | |
m.Extra = []dns.RR{srv} | |
resp, err := dns.Exchange(m, ":1053") | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Printf("%s\n", resp) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment