haad/proxychains — pull request #5 by rofl0r (2012-01-24 07:56:31+00:00)
Title: Remote dns

proxychains used to use a lame shell script for dns resolving
this is problematic in multiple ways
- "dig" must be present
- "dig" must be compiled using the same dynamic linker
- launching of an external app can lead to a variety of bugs
- it is slow, since dig has to use TCP for the proxified DNS-lookup
- additionally it uses the slow 4.4.2.2 dns server

with these changes here, the dns lookup will be done on the proxy server using socksv4a extension / socks5 protocol.
to make it possible, a bit of a hack is required: on DNS-lookups pxc returns an ip address from the reserved 224.* range and stores the according dns name in an internal hashtable. this ip is passed to the proxified app, and on further accesses pxc will pass the corresponding dns name to the proxy, which does remote dns lookup.

this is much faster and convenient than the old method.
another advantage is that tor onion urls could be used together with tor.

however there's a drawback: some control-freak application might check the ip returned by the DNS functions and detect an invalid ip, denying to connect to it.
i'm not sure how this can be prevented.

so my suggestion is to tag the current trunk ver 3.1.last and this here ver 4.0 if you're willing to merge.
that way you could still checkout the ver 3.1.last tag for that sort of misbehaving application.
internally the code uses already a 4.0 version number, and a new name for the launcher and the libproxychains4.so, so both versions can coexist.