Top Description Inners Fields Constructors Methods
org.eclipse.jetty.client

public Class Socks5

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.ClosedChannelException, java.nio.charset.Charset, .StandardCharsets, java.util.Objects, org.eclipse.jetty.io.EndPoint, org.eclipse.jetty.util.BufferUtil, .Callback, org.slf4j.Logger, .LoggerFactory

Helper class for SOCKS5 proxying.

See Also
Socks5Proxy

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Socks5.Authentication

A SOCKS5 authentication method.

public static class
Socks5.NoAuthenticationFactory

The implementation of the NO AUTH authentication method defined in RFC 1928.

public static class
Socks5.UsernamePasswordAuthenticationFactory

The implementation of the USERNAME/PASSWORD authentication method defined in RFC 1929.

Field Summary

Modifier and TypeField and Description
public static final byte
ADDRESS_TYPE_DOMAIN

The address type for domain names used in SOCKS5 connect requests and responses.

public static final byte
ADDRESS_TYPE_IPV4

The address type for IPv4 used in SOCKS5 connect requests and responses.

public static final byte
ADDRESS_TYPE_IPV6

The address type for IPv6 used in SOCKS5 connect requests and responses.

public static final byte
COMMAND_CONNECT

The SOCKS5 CONNECT command used in SOCKS5 connect requests.

public static final byte
RESERVED

The reserved byte value: 0.

public static final byte
VERSION

The SOCKS protocol version: 5.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ADDRESS_TYPE_DOMAINback to summary
public static final byte ADDRESS_TYPE_DOMAIN

The address type for domain names used in SOCKS5 connect requests and responses.

ADDRESS_TYPE_IPV4back to summary
public static final byte ADDRESS_TYPE_IPV4

The address type for IPv4 used in SOCKS5 connect requests and responses.

ADDRESS_TYPE_IPV6back to summary
public static final byte ADDRESS_TYPE_IPV6

The address type for IPv6 used in SOCKS5 connect requests and responses.

COMMAND_CONNECTback to summary
public static final byte COMMAND_CONNECT

The SOCKS5 CONNECT command used in SOCKS5 connect requests.

RESERVEDback to summary
public static final byte RESERVED

The reserved byte value: 0.

VERSIONback to summary
public static final byte VERSION

The SOCKS protocol version: 5.

Constructor Detail

Socks5back to summary
private Socks5()
org.eclipse.jetty.client back to summary

public Interface Socks5.Authentication

Known Direct Implementers
org.eclipse.jetty.client.Socks5.UsernamePasswordAuthenticationFactory.UsernamePasswordAuthentication

A SOCKS5 authentication method.

Implementations should send and receive the bytes that are specific to the particular authentication method.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Method Summary

Modifier and TypeMethod and Description
public void
authenticate(EndPoint
the EndPoint to send to and receive from the SOCKS5 server
endPoint
,
Callback
the callback to complete when the authentication is complete
callback
)

Performs the authentication send and receive bytes exchanges specific for this Authentication.

Method Detail

authenticateback to summary
public void authenticate(EndPoint endPoint, Callback callback)

Performs the authentication send and receive bytes exchanges specific for this Authentication.

Parameters
endPoint:EndPoint

the EndPoint to send to and receive from the SOCKS5 server

callback:Callback

the callback to complete when the authentication is complete

org.eclipse.jetty.client back to summary

public Interface Socks5.Authentication.Factory

Known Direct Implementers
org.eclipse.jetty.client.Socks5.NoAuthenticationFactory, org.eclipse.jetty.client.Socks5.UsernamePasswordAuthenticationFactory

A factory for Authentications.

Method Summary

Modifier and TypeMethod and Description
public byte

Returns:

the authentication method defined by RFC 1928
getMethod
()

public Socks5.Authentication

Method Detail

getMethodback to summary
public byte getMethod()
Returns:byte

the authentication method defined by RFC 1928

newAuthenticationback to summary
public Socks5.Authentication newAuthentication()
Returns:Socks5.Authentication

a new Authentication

org.eclipse.jetty.client back to summary

public Class Socks5.NoAuthenticationFactory

extends Object
implements Factory
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.client.Socks5.Authentication.Factory

The implementation of the NO AUTH authentication method defined in RFC 1928.

Field Summary

Modifier and TypeField and Description
public static final byte

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public byte
public Socks5.Authentication
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

METHODback to summary
public static final byte METHOD

Constructor Detail

NoAuthenticationFactoryback to summary
public NoAuthenticationFactory()

Method Detail

getMethodback to summary
public byte getMethod()

Implements org.eclipse.jetty.client.Socks5.Authentication.Factory.getMethod.

Returns:byte

Doc from org.eclipse.jetty.client.Socks5.Authentication.Factory.getMethod.

the authentication method defined by RFC 1928

Annotations
@Override
newAuthenticationback to summary
public Socks5.Authentication newAuthentication()

Implements org.eclipse.jetty.client.Socks5.Authentication.Factory.newAuthentication.

Returns:Socks5.Authentication

Doc from org.eclipse.jetty.client.Socks5.Authentication.Factory.newAuthentication.

a new Authentication

Annotations
@Override
org.eclipse.jetty.client back to summary

public Class Socks5.UsernamePasswordAuthenticationFactory

extends Object
implements Factory
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.client.Socks5.UsernamePasswordAuthenticationFactory
All Implemented Interfaces
org.eclipse.jetty.client.Socks5.Authentication.Factory

The implementation of the USERNAME/PASSWORD authentication method defined in RFC 1929.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Charset
private static final Logger
public static final byte
private final String
private final String
public static final byte

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public byte
public Socks5.Authentication
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

charsetback to summary
private final Charset charset
LOGback to summary
private static final Logger LOG
METHODback to summary
public static final byte METHOD
passwordback to summary
private final String password
userNameback to summary
private final String userName
VERSIONback to summary
public static final byte VERSION

Constructor Detail

UsernamePasswordAuthenticationFactoryback to summary
public UsernamePasswordAuthenticationFactory(String userName, String password)
UsernamePasswordAuthenticationFactoryback to summary
public UsernamePasswordAuthenticationFactory(String userName, String password, Charset charset)

Method Detail

getMethodback to summary
public byte getMethod()

Implements org.eclipse.jetty.client.Socks5.Authentication.Factory.getMethod.

Returns:byte

Doc from org.eclipse.jetty.client.Socks5.Authentication.Factory.getMethod.

the authentication method defined by RFC 1928

Annotations
@Override
newAuthenticationback to summary
public Socks5.Authentication newAuthentication()

Implements org.eclipse.jetty.client.Socks5.Authentication.Factory.newAuthentication.

Returns:Socks5.Authentication

Doc from org.eclipse.jetty.client.Socks5.Authentication.Factory.newAuthentication.

a new Authentication

Annotations
@Override
org.eclipse.jetty.client back to summary

private Class Socks5.UsernamePasswordAuthenticationFactory.UsernamePasswordAuthentication

extends Object
implements Authentication, Callback
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.client.Socks5.UsernamePasswordAuthenticationFactory.UsernamePasswordAuthentication
All Implemented Interfaces
org.eclipse.jetty.util.Callback, org.eclipse.jetty.util.thread.Invocable, org.eclipse.jetty.client.Socks5.Authentication

Field Summary

Modifier and TypeField and Description
private final ByteBuffer
private Callback
private EndPoint
private final Socks5.UsernamePasswordAuthenticationFactory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
authenticate(EndPoint
the EndPoint to send to and receive from the SOCKS5 server
endPoint
,
Callback
the callback to complete when the authentication is complete
callback
)

Implements org.eclipse.jetty.client.Socks5.Authentication.authenticate.

Performs the authentication send and receive bytes exchanges specific for this Authentication.

private void
public void
failed(Throwable
the reason for the operation failure
x
)

Overrides default org.eclipse.jetty.util.Callback.failed.

Callback invoked when the operation fails.

public Invocable.InvocationType
public void
succeeded()

Overrides default org.eclipse.jetty.util.Callback.succeeded.

Callback invoked when the operation completes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byteBufferback to summary
private final ByteBuffer byteBuffer
callbackback to summary
private Callback callback
endPointback to summary
private EndPoint endPoint
factoryback to summary
private final Socks5.UsernamePasswordAuthenticationFactory factory

Constructor Detail

UsernamePasswordAuthenticationback to summary
private UsernamePasswordAuthentication(Socks5.UsernamePasswordAuthenticationFactory factory)

Method Detail

authenticateback to summary
public void authenticate(EndPoint endPoint, Callback callback)

Implements org.eclipse.jetty.client.Socks5.Authentication.authenticate.

Doc from org.eclipse.jetty.client.Socks5.Authentication.authenticate.

Performs the authentication send and receive bytes exchanges specific for this Authentication.

Parameters
endPoint:EndPoint

the EndPoint to send to and receive from the SOCKS5 server

callback:Callback

the callback to complete when the authentication is complete

Annotations
@Override
authenticationSentback to summary
private void authenticationSent()
failedback to summary
public void failed(Throwable x)

Overrides default org.eclipse.jetty.util.Callback.failed.

Doc from org.eclipse.jetty.util.Callback.failed.

Callback invoked when the operation fails.

Parameters
x:Throwable

the reason for the operation failure

Annotations
@Override
getInvocationTypeback to summary
public Invocable.InvocationType getInvocationType()

Overrides default org.eclipse.jetty.util.thread.Invocable.getInvocationType.

Returns:Invocable.InvocationType

Doc from org.eclipse.jetty.util.thread.Invocable.getInvocationType.

The InvocationType of this object

Annotations
@Override
succeededback to summary
public void succeeded()

Overrides default org.eclipse.jetty.util.Callback.succeeded.

Doc from org.eclipse.jetty.util.Callback.succeeded.

Callback invoked when the operation completes.

Annotations
@Override