Skip to content

Instantly share code, notes, and snippets.

@jelu
Created April 25, 2017 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jelu/ad8fd5d19bc43451e7f4fa3ae30ca9f4 to your computer and use it in GitHub Desktop.
Save jelu/ad8fd5d19bc43451e7f4fa3ae30ca9f4 to your computer and use it in GitHub Desktop.
Want to see what all RIPE Atlas probes are querying right now?
package main
import (
"log"
"github.com/DNS-OARC/ripeatlas"
"github.com/DNS-OARC/ripeatlas/measurement/dns"
)
func print(r *dns.Result) {
if r != nil {
m, _ := r.UnpackAbuf()
if m != nil && len(m.Question) > 0 {
log.Println(m.Question[0].Name)
}
}
}
func main() {
a := ripeatlas.Atlaser(ripeatlas.NewStream())
c, _ := a.MeasurementResults(ripeatlas.Params{"type": "dns"})
for r := range c {
print(r.DnsResult())
for _, s := range r.DnsResultsets() {
print(s.Result())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment