diff --git a/README.md b/README.md index 5d27481..b794837 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,18 @@ sudo sniproxy \ --drop-rule=example.net ``` +### Drop DNS queries + +You may want to emulate the situation when DNS queries to specific domains are +dropped. Use `--dns-drop-rule` option to do this: + +```shell +sudo sniproxy \ + --dns-redirect-ipv4-to=1.2.3.4 \ + --dns-drop-rule=example.net \ + --dns-drop-rule=example.com +``` + ### Throttle connections If you need to emulate slow network, use `bandwidth-rate` to set the desired diff --git a/internal/dnsproxy/dnsproxy.go b/internal/dnsproxy/dnsproxy.go index 6d65afa..efde3b1 100644 --- a/internal/dnsproxy/dnsproxy.go +++ b/internal/dnsproxy/dnsproxy.go @@ -92,6 +92,7 @@ func (d *DNSProxy) requestHandler(p *proxy.Proxy, ctx *proxy.DNSContext) (err er if filter.MatchWildcards(domainName, d.dropRules) { // Return empty response, effectively "dropping" the query. ctx.Res = nil + log.Info("dnsproxy: dropping DNS query for %s %s", dns.Type(qType), qName) return nil }