Expected Behavior
It should resolve hostnames (e.g., localhost -> ::0) as the other program does.
Actual Behavior
It now has an unresolved InetAddress.
Steps to Reproduce
- Add
exampleserver = 'some-hostname-that-should-resolve-by-dns:25565' in [servers] section of velocity.toml.
- Try to access the
ServerInfo#getAddress() of exampleserver via any plugins in Velocity.
- We have an unresolved
InetAddress.
Plugin List
Velocity Version
[15:55:57 INFO]: Velocity 3.5.0-SNAPSHOT (git-d11511c1-b584)
[15:55:57 INFO]: Copyright 2018-2026 Velocity Contributors。Velocity 以 GNU 通用公共许可证第三版授权。
[15:55:57 INFO]: PaperMC - GitHub
Additional Information
Ref:
|
public static InetSocketAddress parseAddress(String ip) { |
|
Preconditions.checkNotNull(ip, "ip"); |
|
URI uri = URI.create("tcp://" + ip); |
|
if (uri.getHost() == null) { |
|
throw new IllegalStateException("Invalid hostname/IP " + ip); |
|
} |
|
|
|
int port = uri.getPort() == -1 ? DEFAULT_MINECRAFT_PORT : uri.getPort(); |
|
try { |
|
InetAddress ia = InetAddresses.forUriString(uri.getHost()); |
|
return new InetSocketAddress(ia, port); |
|
} catch (IllegalArgumentException e) { |
|
return InetSocketAddress.createUnresolved(uri.getHost(), port); |
|
} |
|
} |
Why didn't we always resolve the hostname?
Expected Behavior
It should resolve hostnames (e.g.,
localhost->::0) as the other program does.Actual Behavior
It now has an unresolved
InetAddress.Steps to Reproduce
exampleserver = 'some-hostname-that-should-resolve-by-dns:25565'in[servers]section ofvelocity.toml.ServerInfo#getAddress()ofexampleservervia any plugins in Velocity.InetAddress.Plugin List
Velocity Version
[15:55:57 INFO]: Velocity 3.5.0-SNAPSHOT (git-d11511c1-b584)
[15:55:57 INFO]: Copyright 2018-2026 Velocity Contributors。Velocity 以 GNU 通用公共许可证第三版授权。
[15:55:57 INFO]: PaperMC - GitHub
Additional Information
Ref:
Velocity/proxy/src/main/java/com/velocitypowered/proxy/util/AddressUtil.java
Lines 44 to 58 in d11511c
Why didn't we always resolve the hostname?