Skip to content

Accept hostnames for tcp:, tcp-listen:, udp:, udp-listen: - #56

Open
andersk wants to merge 1 commit into
vi:masterfrom
andersk:net-hostnames
Open

Accept hostnames for tcp:, tcp-listen:, udp:, udp-listen:#56
andersk wants to merge 1 commit into
vi:masterfrom
andersk:net-hostnames

Conversation

@andersk

@andersk andersk commented Sep 25, 2019

Copy link
Copy Markdown

No description provided.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Comment thread src/net_peer.rs
pub fn resolve_addr(
addr_str: &str,
) -> impl Future<Item = SocketAddr, Error = Box<dyn std::error::Error + 'static>> {
// TODO: resolve asynchronously

Copy link
Copy Markdown
Owner

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?

Copy link
Copy Markdown
Author

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.

Copy link
Copy Markdown
Owner

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.

@andersk andersk Sep 25, 2019

Copy link
Copy Markdown
Author

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).

Comment thread src/net_peer.rs
.to_socket_addrs()
.and_then(|mut addrs| {
addrs
.next()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

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.

@vi

vi commented Sep 25, 2019

Copy link
Copy Markdown
Owner

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...

@vi
vi force-pushed the master branch 2 times, most recently from 00113dc to 9ab5e4a Compare May 17, 2022 21:20
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