Open
Conversation
Entries written to the designated input pipe are parsed as if it were a hosts file,
although only the first hostname per line is used.
As long as the fifo is held open, the contents of the mapping will remain intact.
Should the fifo be closed, the mapping will be cleared. This allows simple management
of the size of the hostname cache, simply by closing and reopening the fifo periodically.
A sample rdns config stanza would look something like:
rdns {
fifo = "/tmp/redsocks_dns.fifo";
}
This prevent duplicate functions being declared if rdns.h is included by another file
Only works for http-connect upstream at the moment.
Author
|
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. |
7fa694d to
5df6a30
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 #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.