-
Notifications
You must be signed in to change notification settings - Fork 281
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
Accept hostnames for tcp:, tcp-listen:, udp:, udp-listen: #56
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Anders Kaseorg <[email protected]>
4b11dbe
to
a92d4af
Compare
pub fn resolve_addr( | ||
addr_str: &str, | ||
) -> impl Future<Item = SocketAddr, Error = Box<dyn std::error::Error + 'static>> { | ||
// TODO: resolve asynchronously |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really needed to be resolved at connecting time, not just once at argument parsing time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is: when running websocat as a daemon, it shouldn’t need to be restarted just because a remote DNS name changed. Additionally, one might want to point websocat at a service using DNS load balancing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tardiness in DNS reply may not only delay establishing a new connection, but also suspend all unrelated neighbour connections - websocat is mostly single-threaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, until we get async DNS, that’s a tradeoff. But this design allows the user to make that tradeoff. They can always choose to provide an IP address, or to install a local caching resolver (which will do the job much better than we would—sharing the cache between all apps on the system, respecting TTLs, and so on).
.to_socket_addrs() | ||
.and_then(|mut addrs| { | ||
addrs | ||
.next() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No happy eyeballs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a welcome extension.
Note: I remember doing similar change (but more elaborate, supporting multiple addresses and fast fallback) in "websocket_lowlevel" branch where websocat 2.0 is cooking. Maybe it's worth backporting it to websocat 1... |
00113dc
to
9ab5e4a
Compare
No description provided.