|
|
|
@ -17,6 +17,8 @@
|
|
|
|
|
|
|
|
|
|
package org.apache.dolphinscheduler.remote.utils; |
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.utils.NetUtils; |
|
|
|
|
|
|
|
|
|
import java.net.InetSocketAddress; |
|
|
|
|
|
|
|
|
|
import io.netty.channel.Channel; |
|
|
|
@ -37,7 +39,7 @@ public class ChannelUtils {
|
|
|
|
|
* @return local address |
|
|
|
|
*/ |
|
|
|
|
public static String getLocalAddress(Channel channel) { |
|
|
|
|
return ((InetSocketAddress) channel.localAddress()).getAddress().getHostAddress(); |
|
|
|
|
return NetUtils.getHost(((InetSocketAddress) channel.localAddress()).getAddress()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -47,7 +49,7 @@ public class ChannelUtils {
|
|
|
|
|
* @return remote address |
|
|
|
|
*/ |
|
|
|
|
public static String getRemoteAddress(Channel channel) { |
|
|
|
|
return ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress(); |
|
|
|
|
return NetUtils.getHost(((InetSocketAddress) channel.remoteAddress()).getAddress()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -58,7 +60,7 @@ public class ChannelUtils {
|
|
|
|
|
*/ |
|
|
|
|
public static Host toAddress(Channel channel) { |
|
|
|
|
InetSocketAddress socketAddress = ((InetSocketAddress) channel.remoteAddress()); |
|
|
|
|
return new Host(socketAddress.getAddress().getHostAddress(), socketAddress.getPort()); |
|
|
|
|
return new Host(NetUtils.getHost(socketAddress.getAddress()), socketAddress.getPort()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|