You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has come up a few times now: mitmproxy currently just opens asyncio sockets with the unresolved hostnames. Python's stdlib will then use libc's getaddrinfo, which always includes /etc/hosts. This can be very annoying, see e.g. #6737. We want a way to teach mitmproxy to use a custom DNS server.
Proposal
Implement an async getaddrinfo method that resolves a hostname using a custom DNS server. This could be done in either Python or Rust in mitmproxy-rs. My first best guess would be to go with https://docs.rs/hickory-resolver/latest/hickory_resolver/ in Rust.
Write an addon that defines a dns_server option and monkeypatches/replaces the current event loop's getaddrinfo to use our custom implementation if dns_server is set.
Ideally we start with a PR that does just the first part + tests before getting to part two.
The text was updated successfully, but these errors were encountered:
…er that opens UDP socket to send DNS queries for hostname resolution. Running into troubles getting UDP socket and DNS server to communicate, leading to timeout issues. Some help with this would be greatly appreciated :)
Problem Description
This has come up a few times now: mitmproxy currently just opens asyncio sockets with the unresolved hostnames. Python's stdlib will then use libc's getaddrinfo, which always includes /etc/hosts. This can be very annoying, see e.g. #6737. We want a way to teach mitmproxy to use a custom DNS server.
Proposal
getaddrinfo
method that resolves a hostname using a custom DNS server. This could be done in either Python or Rust in mitmproxy-rs. My first best guess would be to go with https://docs.rs/hickory-resolver/latest/hickory_resolver/ in Rust.dns_server
option and monkeypatches/replaces the current event loop'sgetaddrinfo
to use our custom implementation ifdns_server
is set.Ideally we start with a PR that does just the first part + tests before getting to part two.
The text was updated successfully, but these errors were encountered: