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

Change the return type of IP.resolve_hostname() to return an array of IPs instead of a single String #2501

Closed
timothyqiu opened this issue Mar 24, 2021 · 1 comment
Milestone

Comments

@timothyqiu
Copy link
Member

Describe the project you are working on

Testing my proxy implementation for Godot

Describe the problem or limitation you are having in your project

When trying to connect HTTPClient to localhost, it fails because the hostname is resolved into an IPv6 address, and the server is listening on an IPv4 address.

The current API, IP.resolve_hostname() and IP.get_resolve_item_address(), only resolves hostname into a single IP address. This is the root cause of my issue and issues like godotengine/godot#36418. This also makes it hard to utilize DNS load balancing.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Change the return type of IP.resolve_hostname() and IP.get_resolve_item_address() from String to Array, and return all the resolved IP addresses.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I made a test implementation at https://github.com/timothyqiu/godot/tree/dns-resolve

After this is implemented, we are then possible to resolve the dual-stack issue.

For backward compatibility, components that depends on the current API can use the first record in the array. (For 3.x, we can even keep the original API, only resolve to multiple IPs internally, so some issues can be resolved for classes like HTTPClient.)

If this enhancement will not be used often, can it be worked around with a few lines of script?

Seems impossible.

Is there a reason why this should be core and not an add-on in the asset library?

Seems impossible.

@Calinou Calinou changed the title Resolve hostname into array of IPs Change the return type of IP.resolve_hostname() to return an array of IPs instead of a single String Mar 24, 2021
@timothyqiu
Copy link
Member Author

Implemented by IP.resolve_hostname_addresses and IP.get_resolve_item_addresses in godotengine/godot#49026

@Calinou Calinou added this to the 4.0 milestone Jun 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants