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

public Class Socks5Proxy

extends Proxy
Class Inheritance
Imports
java.io.IOException, java.net.InetAddress, .InetSocketAddress, java.nio.ByteBuffer, java.nio.channels.ClosedChannelException, java.nio.charset.StandardCharsets, java.util.LinkedHashMap, .Map, java.util.concurrent.Executor, .TimeoutException, java.util.regex.Matcher, .Pattern, org.eclipse.jetty.client.ProxyConfiguration.Proxy, .Socks5.NoAuthenticationFactory, org.eclipse.jetty.io.AbstractConnection, .ClientConnectionFactory, .ClientConnector, .EndPoint, org.eclipse.jetty.util.BufferUtil, .Callback, .Promise, .URIUtil, org.slf4j.Logger, .LoggerFactory

Client-side proxy configuration for SOCKS5, defined by RFC 1928.

Multiple authentication methods are supported via putAuthenticationFactory(Socks5.Authentication.Factory). By default only the NO AUTH authentication method is configured. The USERNAME/PASSWORD is available to applications but must be explicitly configured and added.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class

Field Summary

Modifier and TypeField and Description
private final Map<Byte, Socks5.Authentication.Factory>
private static final Logger

Constructor Summary

AccessConstructor and Description
public
Socks5Proxy(String host, int port)

public
Socks5Proxy(Origin.Address address, boolean secure)

Method Summary

Modifier and TypeMethod and Description
public ClientConnectionFactory
public Socks5.Authentication.Factory

Returns:

the previous authentication method of the same type, or null if there was none of that type already present
putAuthenticationFactory
(Socks5.Authentication.Factory
the SOCKS5 authentication factory
authenticationFactory
)

Provides this class with the given SOCKS5 authentication method.

public Socks5.Authentication.Factory
removeAuthenticationFactory(byte
the authentication method to remove
method
)

Removes the authentication of the given method.

Inherited from org.eclipse.jetty.client.ProxyConfiguration.Proxy:
getAddressgetExcludedAddressesgetIncludedAddressesgetOrigingetProtocolgetSslContextFactorygetURIisSecurematchestoString

Field Detail

authenticationsback to summary
private final Map<Byte, Socks5.Authentication.Factory> authentications
LOGback to summary
private static final Logger LOG

Constructor Detail

Socks5Proxyback to summary
public Socks5Proxy(String host, int port)
Socks5Proxyback to summary
public Socks5Proxy(Origin.Address address, boolean secure)

Method Detail

newClientConnectionFactoryback to summary
public ClientConnectionFactory newClientConnectionFactory(ClientConnectionFactory connectionFactory)

Implements abstract org.eclipse.jetty.client.ProxyConfiguration.Proxy.newClientConnectionFactory.

Parameters
connectionFactory:ClientConnectionFactory

Doc from org.eclipse.jetty.client.ProxyConfiguration.Proxy.newClientConnectionFactory.

the nested ClientConnectionFactory

Returns:ClientConnectionFactory

Doc from org.eclipse.jetty.client.ProxyConfiguration.Proxy.newClientConnectionFactory.

a new ClientConnectionFactory for this Proxy

Annotations
@Override
putAuthenticationFactoryback to summary
public Socks5.Authentication.Factory putAuthenticationFactory(Socks5.Authentication.Factory authenticationFactory)

Provides this class with the given SOCKS5 authentication method.

Parameters
authenticationFactory:Socks5.Authentication.Factory

the SOCKS5 authentication factory

Returns:Socks5.Authentication.Factory

the previous authentication method of the same type, or null if there was none of that type already present

removeAuthenticationFactoryback to summary
public Socks5.Authentication.Factory removeAuthenticationFactory(byte method)

Removes the authentication of the given method.

Parameters
method:byte

the authentication method to remove

org.eclipse.jetty.client back to summary

private Class Socks5Proxy.Socks5ProxyClientConnectionFactory

extends Object
implements ClientConnectionFactory
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.client.Socks5Proxy.Socks5ProxyClientConnectionFactory
All Implemented Interfaces
org.eclipse.jetty.io.ClientConnectionFactory

Field Summary

Modifier and TypeField and Description
private final ClientConnectionFactory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Connection
newConnection(EndPoint
the org.eclipse.jetty.io.EndPoint to link the newly created connection to
endPoint
,
Map<String, Object>
the context data to create the connection
context
)

Implements org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionFactoryback to summary
private final ClientConnectionFactory connectionFactory

Constructor Detail

Socks5ProxyClientConnectionFactoryback to summary
private Socks5ProxyClientConnectionFactory(ClientConnectionFactory connectionFactory)

Method Detail

newConnectionback to summary
public Connection newConnection(EndPoint endPoint, Map<String, Object> context)

Implements org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

Parameters
endPoint:EndPoint

Doc from org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

the org.eclipse.jetty.io.EndPoint to link the newly created connection to

context:Map<String, Object>

Doc from org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

the context data to create the connection

Returns:Connection

Doc from org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

a new Connection

org.eclipse.jetty.client back to summary

private Class Socks5Proxy.Socks5ProxyConnection

extends AbstractConnection
implements UpgradeFrom
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.io.Connection.UpgradeFrom

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private final Map<Byte, Socks5.Authentication.Factory>
private final ByteBuffer
private final ClientConnectionFactory
private final Map<String, Object>
private static final Pattern
private Socks5Proxy.Socks5ProxyConnection.State

Constructor Summary

AccessConstructor and Description
private
Socks5ProxyConnection(EndPoint endPoint, Executor executor, ClientConnectionFactory connectionFactory, Map<String, Object> context, Map<Byte, Socks5.Authentication.Factory> authentications)

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
public void
onFillable()

Implements abstract org.eclipse.jetty.io.AbstractConnection.onFillable.

Callback method invoked when the endpoint is ready to be read.

public boolean
onIdleExpired(TimeoutException timeout)

Overrides org.eclipse.jetty.io.AbstractConnection.onIdleExpired.

Implements org.eclipse.jetty.io.Connection.onIdleExpired.

Callback method invoked upon an idle timeout event.

public void
onOpen()

Overrides org.eclipse.jetty.io.AbstractConnection.onOpen.

Implements org.eclipse.jetty.io.Connection.onOpen.

Callback method invoked when this connection is opened.

public ByteBuffer
onUpgradeFrom()

Implements org.eclipse.jetty.io.Connection.UpgradeFrom.onUpgradeFrom.

Invoked during an upgrade to produce a buffer containing bytes that have not been consumed by this connection, and that must be consumed by the upgrade-to connection.

private void
private void
private void
private void
private void
Inherited from org.eclipse.jetty.io.AbstractConnection:
addEventListenerclosefailedCallbackfillInterestedgetBytesIngetBytesOutgetCreatedTimeStampgetEndPointgetExecutorgetInputBufferSizegetInvocationTypegetMessagesIngetMessagesOutisFillInterestedonCloseonFillInterestedFailedonReadTimeoutremoveEventListenersetInputBufferSizetoConnectionStringtoStringtryFillInterested

Field Detail

authenticationsback to summary
private final Map<Byte, Socks5.Authentication.Factory> authentications
byteBufferback to summary
private final ByteBuffer byteBuffer
connectionFactoryback to summary
private final ClientConnectionFactory connectionFactory
contextback to summary
private final Map<String, Object> context
IPv4_PATTERNback to summary
private static final Pattern IPv4_PATTERN
stateback to summary
private Socks5Proxy.Socks5ProxyConnection.State state

Constructor Detail

Socks5ProxyConnectionback to summary
private Socks5ProxyConnection(EndPoint endPoint, Executor executor, ClientConnectionFactory connectionFactory, Map<String, Object> context, Map<Byte, Socks5.Authentication.Factory> authentications)

Method Detail

connectSentback to summary
private void connectSent()
failback to summary
private void fail(Throwable x)
handshakeSentback to summary
private void handshakeSent()
onFillableback to summary
public void onFillable()

Implements abstract org.eclipse.jetty.io.AbstractConnection.onFillable.

Doc from org.eclipse.jetty.io.AbstractConnection.onFillable.

Callback method invoked when the endpoint is ready to be read.

Annotations
@Override
onIdleExpiredback to summary
public boolean onIdleExpired(TimeoutException timeout)

Overrides org.eclipse.jetty.io.AbstractConnection.onIdleExpired.

Implements org.eclipse.jetty.io.Connection.onIdleExpired.

Doc from org.eclipse.jetty.io.Connection.onIdleExpired.

Callback method invoked upon an idle timeout event.

Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.

When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.

Returns:boolean

true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.

Annotations
@Override
onOpenback to summary
public void onOpen()

Overrides org.eclipse.jetty.io.AbstractConnection.onOpen.

Implements org.eclipse.jetty.io.Connection.onOpen.

Doc from org.eclipse.jetty.io.Connection.onOpen.

Callback method invoked when this connection is opened.

Creators of the connection implementation are responsible for calling this method.

Annotations
@Override
onUpgradeFromback to summary
public ByteBuffer onUpgradeFrom()

Implements org.eclipse.jetty.io.Connection.UpgradeFrom.onUpgradeFrom.

Doc from org.eclipse.jetty.io.Connection.UpgradeFrom.onUpgradeFrom.

Invoked during an upgrade to produce a buffer containing bytes that have not been consumed by this connection, and that must be consumed by the upgrade-to connection.

Returns:ByteBuffer

a buffer of unconsumed bytes to pass to the upgrade-to connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes. The returned buffer may be null if there are no unconsumed bytes.

Annotations
@Override
receiveConnectback to summary
private void receiveConnect() throws IOException
receiveHandshakeback to summary
private void receiveHandshake() throws IOException
sendConnectback to summary
private void sendConnect()
sendHandshakeback to summary
private void sendHandshake()
tunnelback to summary
private void tunnel()
org.eclipse.jetty.client back to summary

private final Enum Socks5Proxy.Socks5ProxyConnection.State

extends Enum<Socks5Proxy.Socks5ProxyConnection.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Socks5Proxy.Socks5ProxyConnection.State
public static final Socks5Proxy.Socks5ProxyConnection.State

Constructor Summary

AccessConstructor and Description
private

Field Detail

CONNECTback to summary
public static final Socks5Proxy.Socks5ProxyConnection.State CONNECT
HANDSHAKEback to summary
public static final Socks5Proxy.Socks5ProxyConnection.State HANDSHAKE

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static Socks5Proxy.Socks5ProxyConnection.State valueOf(String name)
valuesback to summary
public static Socks5Proxy.Socks5ProxyConnection.State[] values()