Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.transport.sshd.proxy

public Class Socks5ClientConnector

extends AbstractClientProxyConnector
Class Inheritance
Static Imports
java.nio.charset.StandardCharsets.US_ASCII, .StandardCharsets.UTF_8, java.text.MessageFormat.format

A AbstractClientProxyConnector to connect through a SOCKS5 proxy.
See Also
RFC 1928

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
private static enum
Socks5ClientConnector.SocksAuthenticationMethod

Authentication methods for SOCKS5.

private class
private class

Field Summary

Modifier and TypeField and Description
private byte[]
private AuthenticationHandler<Buffer, Buffer>
private GSSContext
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private Socks5ClientConnector.ProtocolState
Inherited from org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector:
proxyAddressproxyPasswordproxyUserremoteAddress

Constructor Summary

AccessConstructor and Description
public
Socks5ClientConnector(InetSocketAddress
of the proxy server we're connecting to
proxyAddress
,
InetSocketAddress
of the target server to connect to
remoteAddress
)

Creates a new Socks5ClientConnector.

public
Socks5ClientConnector(InetSocketAddress
of the proxy server we're connecting to
proxyAddress
,
InetSocketAddress
of the target server to connect to
remoteAddress
,
String
to authenticate at the proxy with
proxyUser
,
char[]
to authenticate at the proxy with
proxyPassword
)

Creates a new Socks5ClientConnector.

Method Summary

Modifier and TypeMethod and Description
private void
authStep(IoSession session, Buffer input)

private void
private void
private void
private void
private byte[]
private Socks5ClientConnector.SocksAuthenticationMethod
getAuthMethod(byte value)

private static GSSContext
private static byte[]
public void
messageReceived(IoSession
to use for writing data
session
,
Readable
received data
buffer
)

Implements org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector.messageReceived.

Handle a received message.

public void
sendClientProxyMetadata(ClientSession
The ClientSession instance - Note: at this stage the client's identification line is not set yet.
sshSession
)

Implements org.apache.sshd.client.session.ClientProxyConnector.sendClientProxyMetadata.

Invoked once initial connection has been established so that the proxy can open its channel and send the meta-data to its peer.

private void
private void
private void
versionCheck(byte version)

Inherited from org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector:
adjustTimeoutclearPasswordgetTimeoutinitrunWhenDonesetDone

Field Detail

authenticationProposalsback to summary
private byte[] authenticationProposals
authenticatorback to summary
private AuthenticationHandler<Buffer, Buffer> authenticator
contextback to summary
private GSSContext context
SOCKS_ADDRESS_FQDNback to summary
private static final byte SOCKS_ADDRESS_FQDN
SOCKS_ADDRESS_IPv4back to summary
private static final byte SOCKS_ADDRESS_IPv4
SOCKS_ADDRESS_IPv6back to summary
private static final byte SOCKS_ADDRESS_IPv6
SOCKS_CMD_CONNECTback to summary
private static final byte SOCKS_CMD_CONNECT
SOCKS_REPLY_ADDRESS_UNSUPPORTEDback to summary
private static final byte SOCKS_REPLY_ADDRESS_UNSUPPORTED
SOCKS_REPLY_COMMAND_UNSUPPORTEDback to summary
private static final byte SOCKS_REPLY_COMMAND_UNSUPPORTED
SOCKS_REPLY_CONNECTION_REFUSEDback to summary
private static final byte SOCKS_REPLY_CONNECTION_REFUSED
SOCKS_REPLY_FAILUREback to summary
private static final byte SOCKS_REPLY_FAILURE
SOCKS_REPLY_FORBIDDENback to summary
private static final byte SOCKS_REPLY_FORBIDDEN
SOCKS_REPLY_HOST_UNREACHABLEback to summary
private static final byte SOCKS_REPLY_HOST_UNREACHABLE
SOCKS_REPLY_NETWORK_UNREACHABLEback to summary
private static final byte SOCKS_REPLY_NETWORK_UNREACHABLE
SOCKS_REPLY_SUCCESSback to summary
private static final byte SOCKS_REPLY_SUCCESS
SOCKS_REPLY_TTL_EXPIREDback to summary
private static final byte SOCKS_REPLY_TTL_EXPIRED
SOCKS_VERSION_5back to summary
private static final byte SOCKS_VERSION_5
stateback to summary
private Socks5ClientConnector.ProtocolState state

Constructor Detail

Socks5ClientConnectorback to summary
public Socks5ClientConnector(InetSocketAddress proxyAddress, InetSocketAddress remoteAddress)

Creates a new Socks5ClientConnector. The connector supports anonymous connections as well as username-password or Kerberos5 (GSS-API) authentication.

Parameters
proxyAddress:InetSocketAddress

of the proxy server we're connecting to

remoteAddress:InetSocketAddress

of the target server to connect to

Socks5ClientConnectorback to summary
public Socks5ClientConnector(InetSocketAddress proxyAddress, InetSocketAddress remoteAddress, String proxyUser, char[] proxyPassword)

Creates a new Socks5ClientConnector. The connector supports anonymous connections as well as username-password or Kerberos5 (GSS-API) authentication.

Parameters
proxyAddress:InetSocketAddress

of the proxy server we're connecting to

remoteAddress:InetSocketAddress

of the target server to connect to

proxyUser:String

to authenticate at the proxy with

proxyPassword:char[]

to authenticate at the proxy with

Method Detail

authStepback to summary
private void authStep(IoSession session, Buffer input) throws Exception
closeback to summary
private void close()
doGssApiAuthback to summary
private void doGssApiAuth(IoSession session) throws Exception
doPasswordAuthback to summary
private void doPasswordAuth(IoSession session) throws Exception
establishConnectionback to summary
private void establishConnection(Buffer data) throws Exception
getAuthenticationProposalsback to summary
private byte[] getAuthenticationProposals()
getAuthMethodback to summary
private Socks5ClientConnector.SocksAuthenticationMethod getAuthMethod(byte value)
getGSSContextback to summary
private static GSSContext getGSSContext(InetSocketAddress address)
getRawAddressback to summary
private static byte[] getRawAddress(InetSocketAddress address)
messageReceivedback to summary
public void messageReceived(IoSession session, Readable buffer) throws Exception

Implements org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector.messageReceived.

Doc from org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector.messageReceived.

Handle a received message.

Parameters
session:IoSession

to use for writing data

buffer:Readable

received data

Annotations
@Override
Exceptions
Exception:
if data cannot be read, or the connection attempt fails
sendClientProxyMetadataback to summary
public void sendClientProxyMetadata(ClientSession sshSession) throws Exception

Implements org.apache.sshd.client.session.ClientProxyConnector.sendClientProxyMetadata.

Doc from org.apache.sshd.client.session.ClientProxyConnector.sendClientProxyMetadata.

Invoked once initial connection has been established so that the proxy can open its channel and send the meta-data to its peer. Upon successful return the SSH identification line is eventually sent and the protocol proceeds as usual.

Parameters
sshSession:ClientSession

The ClientSession instance - Note: at this stage the client's identification line is not set yet.

Annotations
@Override
Exceptions
Exception:
If failed to initialize the proxy - which will also terminate the session
sendConnectInfoback to summary
private void sendConnectInfo(IoSession session) throws Exception
startAuthback to summary
private void startAuth(IoSession session) throws Exception
versionCheckback to summary
private void versionCheck(byte version) throws Exception
org.eclipse.jgit.internal.transport.sshd.proxy back to summary

private sealed Enum Socks5ClientConnector.ProtocolState

extends Enum<Socks5ClientConnector.ProtocolState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Socks5ClientConnector.ProtocolState
public static final Socks5ClientConnector.ProtocolState
public static final Socks5ClientConnector.ProtocolState
public static final Socks5ClientConnector.ProtocolState
public static final Socks5ClientConnector.ProtocolState
public static final Socks5ClientConnector.ProtocolState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
public static Socks5ClientConnector.ProtocolState
public static Socks5ClientConnector.ProtocolState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

AUTHENTICATINGback to summary
public static final Socks5ClientConnector.ProtocolState AUTHENTICATING
CONNECTEDback to summary
public static final Socks5ClientConnector.ProtocolState CONNECTED
CONNECTINGback to summary
public static final Socks5ClientConnector.ProtocolState CONNECTING
FAILEDback to summary
public static final Socks5ClientConnector.ProtocolState FAILED
INITback to summary
public static final Socks5ClientConnector.ProtocolState INIT
NONEback to summary
public static final Socks5ClientConnector.ProtocolState NONE

Constructor Detail

ProtocolStateback to summary
private ProtocolState()

Method Detail

handleMessageback to summary
public void handleMessage(Socks5ClientConnector connector, IoSession session, Buffer data) throws Exception
valueOfback to summary
public static Socks5ClientConnector.ProtocolState valueOf(String name)
valuesback to summary
public static Socks5ClientConnector.ProtocolState[] values()
org.eclipse.jgit.internal.transport.sshd.proxy back to summary

private final Enum Socks5ClientConnector.SocksAuthenticationMethod

extends Enum<Socks5ClientConnector.SocksAuthenticationMethod>
Class Inheritance

Authentication methods for SOCKS5.
See Also
SOCKS Methods, IANA.org

Field Summary

Modifier and TypeField and Description
public static final Socks5ClientConnector.SocksAuthenticationMethod
public static final Socks5ClientConnector.SocksAuthenticationMethod
public static final Socks5ClientConnector.SocksAuthenticationMethod
public static final Socks5ClientConnector.SocksAuthenticationMethod
private final byte

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public byte
public static Socks5ClientConnector.SocksAuthenticationMethod
public static Socks5ClientConnector.SocksAuthenticationMethod[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ANONYMOUSback to summary
public static final Socks5ClientConnector.SocksAuthenticationMethod ANONYMOUS
GSSAPIback to summary
public static final Socks5ClientConnector.SocksAuthenticationMethod GSSAPI
NONE_ACCEPTABLEback to summary
public static final Socks5ClientConnector.SocksAuthenticationMethod NONE_ACCEPTABLE
PASSWORDback to summary
public static final Socks5ClientConnector.SocksAuthenticationMethod PASSWORD
valueback to summary
private final byte value

Constructor Detail

SocksAuthenticationMethodback to summary
private SocksAuthenticationMethod(int value)

Method Detail

getValueback to summary
public byte getValue()
valueOfback to summary
public static Socks5ClientConnector.SocksAuthenticationMethod valueOf(String name)
valuesback to summary
public static Socks5ClientConnector.SocksAuthenticationMethod[] values()
org.eclipse.jgit.internal.transport.sshd.proxy back to summary

private Class Socks5ClientConnector.SocksBasicAuthentication

extends BasicAuthentication<Buffer, Buffer>
Class Inheritance

See Also
RFC 1929

Field Summary

Modifier and TypeField and Description
private static final byte
private static final byte
Inherited from org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication:
passworduser

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
public Buffer
public void
Inherited from org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication:
clearPasswordclosestart

Field Detail

SOCKS_BASIC_AUTH_SUCCESSback to summary
private static final byte SOCKS_BASIC_AUTH_SUCCESS
SOCKS_BASIC_PROTOCOL_VERSIONback to summary
private static final byte SOCKS_BASIC_PROTOCOL_VERSION

Constructor Detail

SocksBasicAuthenticationback to summary
public SocksBasicAuthentication()

Method Detail

askCredentialsback to summary
protected void askCredentials()

Overrides org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication.askCredentials.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication.askCredentials.

Asks for credentials via the global Authenticator.

Annotations
@Override
getTokenback to summary
public Buffer getToken() throws IOException

Implements org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.getToken.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.getToken.

Retrieves the last token generated.

Returns:Buffer

the token, or null if there is none

Annotations
@Override
processback to summary
public void process() throws Exception

Overrides org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication.process.

Implements org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.process.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.process.

Produces the next authentication token, if any.

Annotations
@Override
Exceptions
Exception:
if an error occurs
org.eclipse.jgit.internal.transport.sshd.proxy back to summary

private Class Socks5ClientConnector.SocksGssApiAuthentication

extends GssApiAuthentication<Buffer, Buffer>
Class Inheritance

See Also
RFC 1961

Field Summary

Modifier and TypeField and Description
private static final int
private static final byte
private static final byte
Inherited from org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication:
token

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected GSSContext
protected byte[]
extractToken(Buffer
to extract the token from
input
)

Implements abstract org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.extractToken.

Extracts the token from the last set parameters.

public Buffer
Inherited from org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication:
closeprocessstart

Field Detail

SOCKS5_GSSAPI_FAILUREback to summary
private static final int SOCKS5_GSSAPI_FAILURE
SOCKS5_GSSAPI_TOKENback to summary
private static final byte SOCKS5_GSSAPI_TOKEN
SOCKS5_GSSAPI_VERSIONback to summary
private static final byte SOCKS5_GSSAPI_VERSION

Constructor Detail

SocksGssApiAuthenticationback to summary
public SocksGssApiAuthentication()

Method Detail

createContextback to summary
protected GSSContext createContext() throws Exception

Implements abstract org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.createContext.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.createContext.

Creates the GSSContext to use.

Returns:GSSContext

a fresh GSSContext to use

Annotations
@Override
Exceptions
Exception:
if the context cannot be created
extractTokenback to summary
protected byte[] extractToken(Buffer input) throws Exception

Implements abstract org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.extractToken.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.extractToken.

Extracts the token from the last set parameters.

Parameters
input:Buffer

to extract the token from

Returns:byte[]

the extracted token, or null if none

Annotations
@Override
Exceptions
Exception:
if an error occurs
getTokenback to summary
public Buffer getToken() throws Exception

Implements org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.getToken.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.getToken.

Retrieves the last token generated.

Returns:Buffer

the token, or null if there is none

Annotations
@Override
Exceptions
Exception:
if an error occurs