Fixed IPv6 local host address

pull/154/head
M66B 6 years ago
parent a4ab65cc50
commit 645c843161

@ -270,8 +270,11 @@ public class ServiceSend extends LifecycleService {
InetAddress addr = InetAddress.getByName(ident.host); InetAddress addr = InetAddress.getByName(ident.host);
if (addr instanceof Inet4Address) if (addr instanceof Inet4Address)
haddr = "[" + Inet4Address.getLocalHost().getHostAddress() + "]"; haddr = "[" + Inet4Address.getLocalHost().getHostAddress() + "]";
else else {
haddr = "[IPv6:" + Inet6Address.getLocalHost().getHostAddress() + "]"; // Inet6Address.getLocalHost() will return the IPv6 local host
byte[] LOOPBACK = new byte[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
haddr = "[IPv6:" + Inet6Address.getByAddress("ip6-localhost", LOOPBACK, 0).getHostAddress() + "]";
}
} else } else
haddr = ident.host; haddr = ident.host;

Loading…
Cancel
Save