redsocks
redsocks copied to clipboard
Map addresses back to hostnames
This code provides a basis for mapping IP addresses (so far, only really tested with IPv4, but I think that IPv6 may also work).
See https://github.com/darkk/redsocks/issues/23
This implementation establishes a new subsystem "rdns" (for reverse dns), which can be configured with a path to a fifo. Supplying "ad.dr.e.ss hostname" entries (one per line) will populate a hashtable, from which these mappings can subsequently be looked up by e.g. http-connect.c (or the socksX.c files, but this will require more sophisticated coding to create the appropriate socks messages with hostnames rather than addresses).
The implementation in http-connect has been omitted, as it is not clear to me how to establish a link between the rdns subsystem and the redsocks subsystem to allow calls to get_hostname_for_addr(). Advice on this would be appreciated.
I have updated my branch with a very rudimentary/hackish implementation for http-connect.
I'm sure I have done several things wrong, for instance, using a single hostnames hashtable, even though the rdns subsystem could be instantiated multiple times, etc, etc. But as a proof of concept, it works :-)
I'd appreciate feedback and improvements to get it up to standard for inclusion.