com.alipay.remoting.util
Class RemotingUtil

java.lang.Object
  extended by com.alipay.remoting.util.RemotingUtil

public class RemotingUtil
extends Object

Some utilities for remoting.


Constructor Summary
RemotingUtil()
           
 
Method Summary
static String parseLocalAddress(io.netty.channel.Channel channel)
          Parse the local address of the channel.
static String parseLocalIP(io.netty.channel.Channel channel)
          Parse the local host ip of the channel.
static int parseLocalPort(io.netty.channel.Channel channel)
          Parse the local host port of the channel.
static String parseRemoteAddress(io.netty.channel.Channel channel)
          Parse the remote address of the channel.
static String parseRemoteHostName(io.netty.channel.Channel channel)
          Parse the remote hostname of the channel.
static String parseRemoteIP(io.netty.channel.Channel channel)
          Parse the remote host ip of the channel.
static int parseRemotePort(io.netty.channel.Channel channel)
          Parse the remote host port of the channel.
static String parseSocketAddressToHostIp(SocketAddress socketAddress)
          Parse the host ip of socket address.
static String parseSocketAddressToString(SocketAddress socketAddress)
          Parse the socket address, omit the leading "/" if present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotingUtil

public RemotingUtil()
Method Detail

parseRemoteAddress

public static String parseRemoteAddress(io.netty.channel.Channel channel)
Parse the remote address of the channel.

Parameters:
channel -
Returns:

parseLocalAddress

public static String parseLocalAddress(io.netty.channel.Channel channel)
Parse the local address of the channel.

Parameters:
channel -
Returns:

parseRemoteIP

public static String parseRemoteIP(io.netty.channel.Channel channel)
Parse the remote host ip of the channel.

Parameters:
channel -
Returns:

parseRemoteHostName

public static String parseRemoteHostName(io.netty.channel.Channel channel)
Parse the remote hostname of the channel. Note: take care to use this method, for a reverse name lookup takes uncertain time in InetAddress.getHostName().

Parameters:
channel -
Returns:

parseLocalIP

public static String parseLocalIP(io.netty.channel.Channel channel)
Parse the local host ip of the channel.

Parameters:
channel -
Returns:

parseRemotePort

public static int parseRemotePort(io.netty.channel.Channel channel)
Parse the remote host port of the channel.

Parameters:
channel -
Returns:
int

parseLocalPort

public static int parseLocalPort(io.netty.channel.Channel channel)
Parse the local host port of the channel.

Parameters:
channel -
Returns:
int

parseSocketAddressToString

public static String parseSocketAddressToString(SocketAddress socketAddress)
Parse the socket address, omit the leading "/" if present. e.g.1 /127.0.0.1:1234 -> 127.0.0.1:1234 e.g.2 sofatest-2.stack.alipay.net/10.209.155.54:12200 -> 10.209.155.54:12200

Parameters:
socketAddress -
Returns:
String

parseSocketAddressToHostIp

public static String parseSocketAddressToHostIp(SocketAddress socketAddress)
Parse the host ip of socket address. e.g. /127.0.0.1:1234 -> 127.0.0.1

Parameters:
socketAddress -
Returns:
String


Copyright © 2018. All rights reserved.