9 "github.com/mjl-/mox/dns"
10 "github.com/mjl-/mox/dnsbl"
14 ctx := context.Background()
15 resolver := dns.StrictResolver{}
17 // Lookup if ip 127.0.0.2 is in spamhaus blocklist at zone sbl.spamhaus.org.
18 status, explanation, err := dnsbl.Lookup(ctx, slog.Default(), resolver, dns.Domain{ASCII: "sbl.spamhaus.org"}, net.ParseIP("127.0.0.2"))
20 log.Fatalf("dnsbl lookup: %v", err)
23 case dnsbl.StatusTemperr:
24 log.Printf("dnsbl lookup, temporary dns error: %v", err)
25 case dnsbl.StatusPass:
26 log.Printf("dnsbl lookup, ip not listed")
27 case dnsbl.StatusFail:
28 log.Printf("dnsbl lookup, ip listed: %s", explanation)