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

Added support unresolved socket addresses #1185

Merged
merged 1 commit into from Oct 6, 2021

Conversation

vtsykun
Copy link
Contributor

@vtsykun vtsykun commented Oct 3, 2021

Currently trying to connect to the tor network causing DNS resolution through the DNS server specified in the network configuration. In this PR added support unresolved socket addresses to support .onion resources

@marci4
Copy link
Collaborator

marci4 commented Oct 4, 2021

Hey,
you should be able to do this with a custom DnsResolver.
See https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/java/org/java_websocket/client/DnsResolver.java and #906

Best regards,
Marcel

@PhilipRoman
Copy link
Collaborator

I think the problem with DnsResolver is that it returns an InetAddress, not an InetSocketAddress.
If I understand correctly, InetAddress doesn't support unresolved addresses, only InetSocketAddress does that (using createUnresolved).

@vtsykun
Copy link
Contributor Author

vtsykun commented Oct 4, 2021

Hey, you should be able to do this with a custom DnsResolver. See https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/java/org/java_websocket/client/DnsResolver.java and #906

Best regards, Marcel

Yes, DnsResolver must return InetAddress, so there is no way to create an unresolved address.
It looks logical that if dnsResolver == null, then it will be created unresolved address. Also there is no BC here

conn = new WebSocketClient(serverUri, httpHeaders) {...}
conn.setDnsResolver(null);

@marci4
Copy link
Collaborator

marci4 commented Oct 4, 2021

My bad.

Changes look good for me, what do you think @PhilipRoman?

@PhilipRoman
Copy link
Collaborator

It's not the most elegant solution, but I think it should be merged.

@marci4 marci4 added this to the Release 1.5.3 milestone Oct 6, 2021
@marci4 marci4 merged commit 1eb2f13 into TooTallNate:master Oct 6, 2021
@vtsykun vtsykun deleted the patch-1 branch October 6, 2021 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants