Package io.netty.handler.codec.socks
Class SocksCmdResponse
java.lang.Object
io.netty.handler.codec.socks.SocksMessage
io.netty.handler.codec.socks.SocksResponse
io.netty.handler.codec.socks.SocksCmdResponse
A socks cmd response.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SocksAddressType
private final SocksCmdStatus
private static final byte[]
private final String
private static final byte[]
private static final byte[]
private final int
-
Constructor Summary
ConstructorsConstructorDescriptionSocksCmdResponse
(SocksCmdStatus cmdStatus, SocksAddressType addressType) SocksCmdResponse
(SocksCmdStatus cmdStatus, SocksAddressType addressType, String host, int port) Constructs new response and includes provided host and port as part of it. -
Method Summary
Modifier and TypeMethodDescriptionReturns theSocksAddressType
of thisSocksCmdResponse
Returns theSocksCmdStatus
of thisSocksCmdResponse
void
encodeAsByteBuf
(ByteBuf byteBuf) host()
Returns host that is used as a parameter inSocksCmdType
.int
port()
Returns port that is used as a parameter inSocksCmdType
.Methods inherited from class io.netty.handler.codec.socks.SocksResponse
responseType
Methods inherited from class io.netty.handler.codec.socks.SocksMessage
protocolVersion, type
-
Field Details
-
cmdStatus
-
addressType
-
host
-
port
private final int port -
DOMAIN_ZEROED
private static final byte[] DOMAIN_ZEROED -
IPv4_HOSTNAME_ZEROED
private static final byte[] IPv4_HOSTNAME_ZEROED -
IPv6_HOSTNAME_ZEROED
private static final byte[] IPv6_HOSTNAME_ZEROED
-
-
Constructor Details
-
SocksCmdResponse
-
SocksCmdResponse
public SocksCmdResponse(SocksCmdStatus cmdStatus, SocksAddressType addressType, String host, int port) Constructs new response and includes provided host and port as part of it.- Parameters:
cmdStatus
- status of the responseaddressType
- type of host parameterhost
- host (BND.ADDR field) is address that server used when connecting to the target host. When null a value of 4/8 0x00 octets will be used for IPv4/IPv6 and a single 0x00 byte will be used for domain addressType. Value is converted to ASCII usingIDN.toASCII(String)
.port
- port (BND.PORT field) that the server assigned to connect to the target host- Throws:
NullPointerException
- in case cmdStatus or addressType are missingIllegalArgumentException
- in case host or port cannot be validated- See Also:
-
-
Method Details
-
cmdStatus
Returns theSocksCmdStatus
of thisSocksCmdResponse
- Returns:
- The
SocksCmdStatus
of thisSocksCmdResponse
-
addressType
Returns theSocksAddressType
of thisSocksCmdResponse
- Returns:
- The
SocksAddressType
of thisSocksCmdResponse
-
host
Returns host that is used as a parameter inSocksCmdType
. Host (BND.ADDR field in response) is address that server used when connecting to the target host. This is typically different from address which client uses to connect to the SOCKS server.- Returns:
- host that is used as a parameter in
SocksCmdType
or null when there was no host specified during response construction
-
port
public int port()Returns port that is used as a parameter inSocksCmdType
. Port (BND.PORT field in response) is port that the server assigned to connect to the target host.- Returns:
- port that is used as a parameter in
SocksCmdType
-
encodeAsByteBuf
- Specified by:
encodeAsByteBuf
in classSocksMessage
-