paulchakravarti/dnslib — pull request #3 by andreif (2013-07-28 14:14:10+00:00)
Title: Add options to UDP proxy for helping in making doctests and dig diffs

I use them with the following script
```py
# ~/digdiff.py
import commands
import difflib
import sys

args = sys.argv[1:] or ['+short ietf.org -t A']
dns_req = ' '.join(args)

r1 = commands.getoutput('dig @0.0.0.0 -p 8053 ' + dns_req)
r2 = commands.getoutput('dig @0.0.0.0 -p 8054 ' + dns_req)

for line in difflib.unified_diff(r1.split('\n'), r2.split('\n')):
print line
```
Run it
```sh
# start first proxy
$ python server/udp_proxy.py --dns=ns0.ietf.org --port=8053

# start second proxy
$ python server/udp_proxy.py --dns=ns0.ietf.org --port=8054 --dnslib=1

# check dig diff
$ python ~/digdiff.py +short ietf.org -t A
```