Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace hardcoded 1.1.1.1 dns server with resolve.conf parsing #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SuperSandro2000
Copy link

I am not fully sure if it works because neither before nor after I could see a connection to 1.1.1.1 in tcpdump.

@alexflint
Copy link
Member

This looks good. Sorry about duplications in the experiments dir - I've left that code around for now while the project is in early stage development, but will drop it soon. The code there can be ignored as none of it gets called from any of the code that makes up the actual httptap binary.

Probably the reason you can't see this in tcpdump is that if you make an ordinary hostname-to-IP-address dns request (A or AAAA) then httptap will use the standard library resolver, which already has the logic for reading nsswitch.conf and resolv.conf. You have to make a DNS request other than a straightforward hostname-to-IP-address in order to hit this code. For example:

httptap -- dig -t txt google.com

You may also find the --verbose option helpful in this kind of situation:

$ httptap --verbose -- dig -t txt google.com
[...]
read a UDP packet with 51 bytes
got dns request for google.com. (TXT)
proxying TXT request to upstream DNS server...
got answer from upstream dns server with 12 answers
responding to DNS request with 995 bytes...
done responding to DNS request (sent 995 bytes)

I'll pull your code down at my end and test it at my end. It looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants