Closed tperale closed 1 year ago
Thanks for you PR!
I don't know if there is any reason to not support domain name resolution by default on moproxy.
Just because all my upstream proxies are on localhost and I totally forget the domain name thing :)
Since you are bring this up, I think a better implementation may be keeping the domain name on ProxyServer
struct, and re-resolve it (probably with cache) every time we connect to it so that it can handle IP address change gracefully.
Anyway, I will accept the PR as it since it works on your use case.
Add support for domain name resolution for proxy addresses passed in the proxy list. In some use-cases you need to pass the proxy as a domain name (for instance
proxy.example.com
) instead of providing the IP address.The
to_socket_addrs
method returns an iterator ofOption<SocketAddr>
(for domain name pointing to multiple IP address). I just use the first one.I don't know if there is any reason to not support domain name resolution by default on moproxy.