Class Socks5ClientConnector
- java.lang.Object
-
- org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector
-
- org.eclipse.jgit.internal.transport.sshd.proxy.Socks5ClientConnector
-
- All Implemented Interfaces:
org.apache.sshd.client.session.ClientProxyConnector,StatefulProxyConnector
public class Socks5ClientConnector extends AbstractClientProxyConnector
AAbstractClientProxyConnectorto connect through a SOCKS5 proxy.- See Also:
- RFC 1928
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSocks5ClientConnector.ProtocolStateprivate static classSocks5ClientConnector.SocksAuthenticationMethodAuthentication methods for SOCKS5.private classSocks5ClientConnector.SocksBasicAuthenticationprivate classSocks5ClientConnector.SocksGssApiAuthentication
-
Field Summary
Fields Modifier and Type Field Description private byte[]authenticationProposalsprivate AuthenticationHandler<org.apache.sshd.common.util.buffer.Buffer,org.apache.sshd.common.util.buffer.Buffer>authenticatorprivate org.ietf.jgss.GSSContextcontextprivate static byteSOCKS_ADDRESS_FQDNprivate static byteSOCKS_ADDRESS_IPv4private static byteSOCKS_ADDRESS_IPv6private static byteSOCKS_CMD_CONNECTprivate static byteSOCKS_REPLY_ADDRESS_UNSUPPORTEDprivate static byteSOCKS_REPLY_COMMAND_UNSUPPORTEDprivate static byteSOCKS_REPLY_CONNECTION_REFUSEDprivate static byteSOCKS_REPLY_FAILUREprivate static byteSOCKS_REPLY_FORBIDDENprivate static byteSOCKS_REPLY_HOST_UNREACHABLEprivate static byteSOCKS_REPLY_NETWORK_UNREACHABLEprivate static byteSOCKS_REPLY_SUCCESSprivate static byteSOCKS_REPLY_TTL_EXPIREDprivate static byteSOCKS_VERSION_5private Socks5ClientConnector.ProtocolStatestate-
Fields inherited from class org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector
proxyAddress, proxyPassword, proxyUser, remoteAddress
-
Fields inherited from interface org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector
TIMEOUT_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description Socks5ClientConnector(java.net.InetSocketAddress proxyAddress, java.net.InetSocketAddress remoteAddress)Creates a newSocks5ClientConnector.Socks5ClientConnector(java.net.InetSocketAddress proxyAddress, java.net.InetSocketAddress remoteAddress, java.lang.String proxyUser, char[] proxyPassword)Creates a newSocks5ClientConnector.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidauthStep(org.apache.sshd.common.io.IoSession session, org.apache.sshd.common.util.buffer.Buffer input)private voidclose()private voiddoGssApiAuth(org.apache.sshd.common.io.IoSession session)private voiddoPasswordAuth(org.apache.sshd.common.io.IoSession session)private voidestablishConnection(org.apache.sshd.common.util.buffer.Buffer data)private byte[]getAuthenticationProposals()private Socks5ClientConnector.SocksAuthenticationMethodgetAuthMethod(byte value)private static org.ietf.jgss.GSSContextgetGSSContext(java.net.InetSocketAddress address)private static byte[]getRawAddress(java.net.InetSocketAddress address)voidmessageReceived(org.apache.sshd.common.io.IoSession session, org.apache.sshd.common.util.Readable buffer)Handle a received message.voidsendClientProxyMetadata(org.apache.sshd.client.session.ClientSession sshSession)private voidsendConnectInfo(org.apache.sshd.common.io.IoSession session)private voidstartAuth(org.apache.sshd.common.io.IoSession session)private voidversionCheck(byte version)-
Methods inherited from class org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector
adjustTimeout, clearPassword, getTimeout, init, runWhenDone, setDone
-
-
-
-
Field Detail
-
SOCKS_VERSION_5
private static final byte SOCKS_VERSION_5
- See Also:
- Constant Field Values
-
SOCKS_CMD_CONNECT
private static final byte SOCKS_CMD_CONNECT
- See Also:
- Constant Field Values
-
SOCKS_ADDRESS_IPv4
private static final byte SOCKS_ADDRESS_IPv4
- See Also:
- Constant Field Values
-
SOCKS_ADDRESS_FQDN
private static final byte SOCKS_ADDRESS_FQDN
- See Also:
- Constant Field Values
-
SOCKS_ADDRESS_IPv6
private static final byte SOCKS_ADDRESS_IPv6
- See Also:
- Constant Field Values
-
SOCKS_REPLY_SUCCESS
private static final byte SOCKS_REPLY_SUCCESS
- See Also:
- Constant Field Values
-
SOCKS_REPLY_FAILURE
private static final byte SOCKS_REPLY_FAILURE
- See Also:
- Constant Field Values
-
SOCKS_REPLY_FORBIDDEN
private static final byte SOCKS_REPLY_FORBIDDEN
- See Also:
- Constant Field Values
-
SOCKS_REPLY_NETWORK_UNREACHABLE
private static final byte SOCKS_REPLY_NETWORK_UNREACHABLE
- See Also:
- Constant Field Values
-
SOCKS_REPLY_HOST_UNREACHABLE
private static final byte SOCKS_REPLY_HOST_UNREACHABLE
- See Also:
- Constant Field Values
-
SOCKS_REPLY_CONNECTION_REFUSED
private static final byte SOCKS_REPLY_CONNECTION_REFUSED
- See Also:
- Constant Field Values
-
SOCKS_REPLY_TTL_EXPIRED
private static final byte SOCKS_REPLY_TTL_EXPIRED
- See Also:
- Constant Field Values
-
SOCKS_REPLY_COMMAND_UNSUPPORTED
private static final byte SOCKS_REPLY_COMMAND_UNSUPPORTED
- See Also:
- Constant Field Values
-
SOCKS_REPLY_ADDRESS_UNSUPPORTED
private static final byte SOCKS_REPLY_ADDRESS_UNSUPPORTED
- See Also:
- Constant Field Values
-
state
private Socks5ClientConnector.ProtocolState state
-
authenticator
private AuthenticationHandler<org.apache.sshd.common.util.buffer.Buffer,org.apache.sshd.common.util.buffer.Buffer> authenticator
-
context
private org.ietf.jgss.GSSContext context
-
authenticationProposals
private byte[] authenticationProposals
-
-
Constructor Detail
-
Socks5ClientConnector
public Socks5ClientConnector(@NonNull java.net.InetSocketAddress proxyAddress, @NonNull java.net.InetSocketAddress remoteAddress)
Creates a newSocks5ClientConnector. The connector supports anonymous connections as well as username-password or Kerberos5 (GSS-API) authentication.- Parameters:
proxyAddress- of the proxy server we're connecting toremoteAddress- of the target server to connect to
-
Socks5ClientConnector
public Socks5ClientConnector(@NonNull java.net.InetSocketAddress proxyAddress, @NonNull java.net.InetSocketAddress remoteAddress, java.lang.String proxyUser, char[] proxyPassword)
Creates a newSocks5ClientConnector. The connector supports anonymous connections as well as username-password or Kerberos5 (GSS-API) authentication.- Parameters:
proxyAddress- of the proxy server we're connecting toremoteAddress- of the target server to connect toproxyUser- to authenticate at the proxy withproxyPassword- to authenticate at the proxy with
-
-
Method Detail
-
sendClientProxyMetadata
public void sendClientProxyMetadata(org.apache.sshd.client.session.ClientSession sshSession) throws java.lang.Exception- Throws:
java.lang.Exception
-
getAuthenticationProposals
private byte[] getAuthenticationProposals()
-
sendConnectInfo
private void sendConnectInfo(org.apache.sshd.common.io.IoSession session) throws java.lang.Exception- Throws:
java.lang.Exception
-
doPasswordAuth
private void doPasswordAuth(org.apache.sshd.common.io.IoSession session) throws java.lang.Exception- Throws:
java.lang.Exception
-
doGssApiAuth
private void doGssApiAuth(org.apache.sshd.common.io.IoSession session) throws java.lang.Exception- Throws:
java.lang.Exception
-
close
private void close()
-
startAuth
private void startAuth(org.apache.sshd.common.io.IoSession session) throws java.lang.Exception- Throws:
java.lang.Exception
-
authStep
private void authStep(org.apache.sshd.common.io.IoSession session, org.apache.sshd.common.util.buffer.Buffer input) throws java.lang.Exception- Throws:
java.lang.Exception
-
establishConnection
private void establishConnection(org.apache.sshd.common.util.buffer.Buffer data) throws java.lang.Exception- Throws:
java.lang.Exception
-
messageReceived
public void messageReceived(org.apache.sshd.common.io.IoSession session, org.apache.sshd.common.util.Readable buffer) throws java.lang.ExceptionDescription copied from interface:StatefulProxyConnectorHandle a received message.- Parameters:
session- to use for writing databuffer- received data- Throws:
java.lang.Exception- if data cannot be read, or the connection attempt fails
-
versionCheck
private void versionCheck(byte version) throws java.lang.Exception- Throws:
java.lang.Exception
-
getAuthMethod
private Socks5ClientConnector.SocksAuthenticationMethod getAuthMethod(byte value)
-
getRawAddress
private static byte[] getRawAddress(@NonNull java.net.InetSocketAddress address)
-
getGSSContext
private static org.ietf.jgss.GSSContext getGSSContext(@NonNull java.net.InetSocketAddress address)
-
-