Merge pull request #1 from ryanchapman/master

merge
Added example upstart script
uncommented normal exit stanza

any_proxy does indeed return an error under these conditions
Merge remote-tracking branch 'upstream/master'
Added option to perform reverse lookups of destination IPs

Upstream proxies may require the hostname for CONNECT requests.
A local DNS server can be configured to provide a reverse lookup
of the forward lookup cache. As a rough example, in bind9, an
authoritative in-addr.arpa zone can be created and updated using
a combination of tcpdump|sed|nsupdate such as:
(echo server 127.0.0.1;tcpdump -pnnlvi any "udp port 53" 2>/dev/null|sed -une 's/\([^ ]\+\) A \([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)/\nupdate add \5.\4.\3.\2.in-addr.arpa 86400 ptr \1\n\n/g;s/^[^\n]*\n//;s/\n\n[^\n]*$/\nshow\n/;s/\n\n[^\n]*\n/\n/gp')|nsupdate -v -k /etc/bind/Kin-addr.arpa.+157+10867.private
Added sleep to upstart script to prevent spawning too fast
Added a simplistic memory cache of reverse lookups for performance

Even with a local DNS server, lookups for every single request were
causing excessive CPU load and poor performance.
Reverse lookups of destination IP addresses are cached indefinitely
in a hashmap. Cache expiry is not yet implemented, but a simple
timeout would probably suffice - even if the entire cache was flushed
periodically.
Added size limited cache with expiry for reverse lookups

Reverse lookup cache Won't grow indefinitely, FIFO queue of limited
size only allocated if -h option selected. Records also expire
after 1 hour.
Merge pull request #18 from tmackay/master

Added option for reverse lookups