Skip to content

Commit

Permalink
updated readme and added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ameshkov committed Sep 14, 2023
1 parent e04ab5e commit 5de3b07
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions internal/dnsproxy/dnsproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 5de3b07

Please sign in to comment.