#3342: Fix sanitized address being not IP but hostname after InetSocketAddress#getHostName()
This commit is contained in:
parent
2a716bbc7f
commit
c8e876bfe2
@ -1,5 +1,6 @@
|
|||||||
package net.md_5.bungee.util;
|
package net.md_5.bungee.util;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import java.net.Inet6Address;
|
import java.net.Inet6Address;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
@ -11,7 +12,8 @@ public class AddressUtil
|
|||||||
|
|
||||||
public static String sanitizeAddress(InetSocketAddress addr)
|
public static String sanitizeAddress(InetSocketAddress addr)
|
||||||
{
|
{
|
||||||
String string = addr.getHostString();
|
Preconditions.checkArgument( !addr.isUnresolved(), "Unresolved address" );
|
||||||
|
String string = addr.getAddress().getHostAddress();
|
||||||
|
|
||||||
// Remove IPv6 scope if present
|
// Remove IPv6 scope if present
|
||||||
if ( addr.getAddress() instanceof Inet6Address )
|
if ( addr.getAddress() instanceof Inet6Address )
|
||||||
|
Loading…
Reference in New Issue
Block a user