public class Socks5LogicHandler extends AbstractSocksLogicHandler
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
GSS_CONTEXT
The Java GSS-API context attribute key.
|
private static java.lang.String |
GSS_TOKEN
Last GSS token received attribute key.
|
private static java.lang.String |
HANDSHAKE_STEP
The current step in the handshake attribute key.
|
private static org.slf4j.Logger |
LOGGER |
private static java.lang.String |
SELECTED_AUTH_METHOD
The selected authentication method attribute key.
|
request| Constructor and Description |
|---|
Socks5LogicHandler(ProxyIoSession proxyIoSession) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeSession(java.lang.String message)
Closes the session.
|
void |
doHandshake(IoFilter.NextFilter nextFilter)
Performs the handshake process.
|
private IoBuffer |
encodeAuthenticationPacket(SocksProxyRequest request)
Encodes the authentication packet for supported authentication methods.
|
private IoBuffer |
encodeGSSAPIAuthenticationPacket(SocksProxyRequest request)
Encodes the authentication packet for supported authentication methods.
|
private IoBuffer |
encodeInitialGreetingPacket(SocksProxyRequest request)
Encodes the initial greeting packet.
|
private IoBuffer |
encodeProxyRequestPacket(SocksProxyRequest request)
Encodes the proxy authorization request packet.
|
protected void |
handleResponse(IoFilter.NextFilter nextFilter,
IoBuffer buf,
int step)
Handle a SOCKS v5 response from the proxy server.
|
void |
messageReceived(IoFilter.NextFilter nextFilter,
IoBuffer buf)
Handles incoming data during the handshake process.
|
private void |
writeRequest(IoFilter.NextFilter nextFilter,
SocksProxyRequest request,
int step)
Encodes a SOCKS5 request and writes it to the next filter
so it can be sent to the proxy server.
|
closeSession, enqueueWriteRequest, flushPendingWriteRequests, getProxyFilter, getProxyIoSession, getSession, isHandshakeComplete, setHandshakeComplete, writeDataprivate static final org.slf4j.Logger LOGGER
private static final java.lang.String SELECTED_AUTH_METHOD
private static final java.lang.String HANDSHAKE_STEP
private static final java.lang.String GSS_CONTEXT
private static final java.lang.String GSS_TOKEN
public Socks5LogicHandler(ProxyIoSession proxyIoSession)
public void doHandshake(IoFilter.NextFilter nextFilter)
nextFilter - the next filterprivate IoBuffer encodeInitialGreetingPacket(SocksProxyRequest request)
request - the socks proxy request dataprivate IoBuffer encodeProxyRequestPacket(SocksProxyRequest request) throws java.io.UnsupportedEncodingException
request - the socks proxy request datajava.io.UnsupportedEncodingException - if request's hostname charset
can't be converted to ASCII.private IoBuffer encodeAuthenticationPacket(SocksProxyRequest request) throws java.io.UnsupportedEncodingException, org.ietf.jgss.GSSException
request - the socks proxy request datajava.io.UnsupportedEncodingException - if some string charset convertion failsorg.ietf.jgss.GSSException - when something fails while using GSSAPIprivate IoBuffer encodeGSSAPIAuthenticationPacket(SocksProxyRequest request) throws org.ietf.jgss.GSSException
request - the socks proxy request dataorg.ietf.jgss.GSSException - when something fails while using GSSAPIprivate void writeRequest(IoFilter.NextFilter nextFilter, SocksProxyRequest request, int step)
nextFilter - the next filterrequest - the request to send.step - the current step in the handshake processpublic void messageReceived(IoFilter.NextFilter nextFilter, IoBuffer buf)
nextFilter - the next filterbuf - the buffered data receivedprotected void handleResponse(IoFilter.NextFilter nextFilter, IoBuffer buf, int step) throws java.lang.Exception
nextFilter - the next filterbuf - the buffered data receivedstep - the current step in the authentication processjava.lang.Exceptionprotected void closeSession(java.lang.String message)
GSSContext is present in the session
then it is closed.closeSession in class AbstractProxyLogicHandlermessage - the error message