public class DefaultForwardingFilter extends AbstractInnerCloseable implements ForwardingFilter, SessionHolder<Session>, PortForwardingEventListenerManager
AbstractCloseable.State
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_FORWARD_REQUEST_TIMEOUT
Default value for "tcpip-forward-request-timeout" if none specified
|
static String |
FORWARD_REQUEST_TIMEOUT
Used to configure the timeout (milliseconds) for receiving a response
for the forwarding request
|
static Set<ClientChannelEvent> |
STATIC_IO_MSG_RECEIVED_EVENTS |
closeFuture, lock, state
log
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
Constructor and Description |
---|
DefaultForwardingFilter(ConnectionService service) |
doCloseGracefully, doCloseImmediately
addCloseFutureListener, builder, close, isClosed, isClosing, removeCloseFutureListener
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isLocalPortForwardingStartedForPort, isRemotePortForwardingStartedForPort
addCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListener
public static final String FORWARD_REQUEST_TIMEOUT
public static final long DEFAULT_FORWARD_REQUEST_TIMEOUT
public static final Set<ClientChannelEvent> STATIC_IO_MSG_RECEIVED_EVENTS
public DefaultForwardingFilter(ConnectionService service)
public PortForwardingEventListener getPortForwardingEventListenerProxy()
getPortForwardingEventListenerProxy
in interface PortForwardingEventListenerManager
public void addPortForwardingEventListener(PortForwardingEventListener listener)
PortForwardingEventListenerManager
addPortForwardingEventListener
in interface PortForwardingEventListenerManager
listener
- The PortForwardingEventListener
to add - never null
public void removePortForwardingEventListener(PortForwardingEventListener listener)
PortForwardingEventListenerManager
removePortForwardingEventListener
in interface PortForwardingEventListenerManager
listener
- The PortForwardingEventListener
to remove - ignored if null
public Collection<PortForwardingEventListenerManager> getRegisteredManagers()
getRegisteredManagers
in interface PortForwardingEventListenerManagerHolder
public boolean addPortForwardingEventListenerManager(PortForwardingEventListenerManager manager)
addPortForwardingEventListenerManager
in interface PortForwardingEventListenerManagerHolder
public boolean removePortForwardingEventListenerManager(PortForwardingEventListenerManager manager)
removePortForwardingEventListenerManager
in interface PortForwardingEventListenerManagerHolder
public Session getSession()
getSession
in interface SessionHolder<Session>
public final ConnectionService getConnectionService()
protected Collection<PortForwardingEventListener> getDefaultListeners()
public SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException
PortForwardingManager
startLocalPortForwarding
in interface PortForwardingManager
local
- The local addressremote
- The remote addressSshdSocketAddress
IOException
- If failed to create the requested bindingpublic void stopLocalPortForwarding(SshdSocketAddress local) throws IOException
PortForwardingManager
stopLocalPortForwarding
in interface PortForwardingManager
local
- The local addressIOException
- If failed to cancel the requested bindingprotected void unbindLocalForwarding(SshdSocketAddress local, SshdSocketAddress remote, InetSocketAddress bound) throws IOException
IOException
public SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException
PortForwardingManager
Start forwarding tcpip from the given address on the server to the given address on the client.
The remote host name is the address to bind to on the server:startRemotePortForwarding
in interface PortForwardingManager
remote
- The remote addresslocal
- The local addressSshdSocketAddress
IOException
- If failed to create the requested bindingpublic void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException
PortForwardingManager
stopRemotePortForwarding
in interface PortForwardingManager
remote
- The remote addressIOException
- If failed to cancel the requested bindingprotected void signalTearingDownExplicitTunnel(SshdSocketAddress boundAddress, boolean localForwarding, SshdSocketAddress remote) throws IOException
IOException
protected void signalTearingDownExplicitTunnel(PortForwardingEventListener listener, SshdSocketAddress boundAddress, boolean localForwarding, SshdSocketAddress remoteAddress) throws IOException
IOException
protected void signalTornDownExplicitTunnel(SshdSocketAddress boundAddress, boolean localForwarding, SshdSocketAddress remoteAddress, Throwable reason) throws IOException
IOException
protected void signalTornDownExplicitTunnel(PortForwardingEventListener listener, SshdSocketAddress boundAddress, boolean localForwarding, SshdSocketAddress remoteAddress, Throwable reason) throws IOException
IOException
public SshdSocketAddress startDynamicPortForwarding(SshdSocketAddress local) throws IOException
PortForwardingManager
startDynamicPortForwarding
in interface PortForwardingManager
local
- The local addressSshdSocketAddress
IOException
- If failed to create the requested bindingprotected void signalEstablishedDynamicTunnel(SshdSocketAddress local, SshdSocketAddress boundAddress, Throwable reason) throws IOException
IOException
protected void signalEstablishedDynamicTunnel(PortForwardingEventListener listener, SshdSocketAddress local, SshdSocketAddress boundAddress, Throwable reason) throws IOException
IOException
protected void signalEstablishingDynamicTunnel(SshdSocketAddress local) throws IOException
IOException
protected void signalEstablishingDynamicTunnel(PortForwardingEventListener listener, SshdSocketAddress local) throws IOException
IOException
public void stopDynamicPortForwarding(SshdSocketAddress local) throws IOException
PortForwardingManager
stopDynamicPortForwarding
in interface PortForwardingManager
local
- The local addressIOException
- If failed to cancel the requested bindingprotected void unbindDynamicForwarding(SshdSocketAddress local, SocksProxy proxy, InetSocketAddress bound) throws IOException
IOException
protected void signalTearingDownDynamicTunnel(SshdSocketAddress address) throws IOException
IOException
protected void signalTearingDownDynamicTunnel(PortForwardingEventListener listener, SshdSocketAddress address) throws IOException
IOException
protected void signalTornDownDynamicTunnel(SshdSocketAddress address, Throwable reason) throws IOException
IOException
protected void signalTornDownDynamicTunnel(PortForwardingEventListener listener, SshdSocketAddress address, Throwable reason) throws IOException
IOException
public SshdSocketAddress getForwardedPort(int remotePort)
getForwardedPort
in interface ForwardingFilter
remotePort
- The remote portSshdSocketAddress
that the remote port is forwarded topublic SshdSocketAddress localPortForwardingRequested(SshdSocketAddress local) throws IOException
ForwardingFilter
localPortForwardingRequested
in interface ForwardingFilter
local
- The request addressSshdSocketAddress
- null
if not allowed to forwardIOException
- If failed to handle requestpublic void localPortForwardingCancelled(SshdSocketAddress local) throws IOException
ForwardingFilter
localPortForwardingCancelled
in interface ForwardingFilter
local
- The local SshdSocketAddress
IOException
- If failed to handle requestprotected void signalEstablishingExplicitTunnel(SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding) throws IOException
IOException
protected void signalEstablishingExplicitTunnel(PortForwardingEventListener listener, SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding) throws IOException
IOException
protected void signalEstablishedExplicitTunnel(SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding, SshdSocketAddress boundAddress, Throwable reason) throws IOException
IOException
protected void signalEstablishedExplicitTunnel(PortForwardingEventListener listener, SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding, SshdSocketAddress boundAddress, Throwable reason) throws IOException
IOException
protected void invokePortEventListenerSignaller(Invoker<PortForwardingEventListener,Void> invoker) throws Throwable
Throwable
protected void invokePortEventListenerSignallerListeners(Collection<? extends PortForwardingEventListener> listeners, Invoker<PortForwardingEventListener,Void> invoker) throws Throwable
Throwable
protected void invokePortEventListenerSignallerHolders(Collection<? extends PortForwardingEventListenerManager> holders, Invoker<PortForwardingEventListener,Void> invoker) throws Throwable
Throwable
protected Closeable getInnerCloseable()
getInnerCloseable
in class AbstractInnerCloseable
protected void preClose()
AbstractCloseable
preClose
in class AbstractCloseable
public SshdSocketAddress getBoundLocalPortForward(int port)
getBoundLocalPortForward
in interface PortForwardingInformationProvider
port
- The port numberSshdSocketAddress
for the port
- null
if none boundisLocalPortForwardingStartedForPort
,
PortForwardingInformationProvider.getStartedLocalPortForwards()
public List<Map.Entry<Integer,SshdSocketAddress>> getLocalForwardsBindings()
getLocalForwardsBindings
in interface PortForwardingInformationProvider
SshdSocketAddress
public NavigableSet<Integer> getStartedLocalPortForwards()
getStartedLocalPortForwards
in interface PortForwardingInformationProvider
NavigableSet
snapshot of the currently started
local port forwardspublic List<Map.Entry<Integer,SshdSocketAddress>> getRemoteForwardsBindings()
getRemoteForwardsBindings
in interface PortForwardingInformationProvider
SshdSocketAddress
public SshdSocketAddress getBoundRemotePortForward(int port)
getBoundRemotePortForward
in interface PortForwardingInformationProvider
port
- The port numberSshdSocketAddress
for the port
- null
if none boundisRemotePortForwardingStartedForPort
,
PortForwardingInformationProvider.getStartedRemotePortForwards()
public NavigableSet<Integer> getStartedRemotePortForwards()
getStartedRemotePortForwards
in interface PortForwardingInformationProvider
NavigableSet
snapshot of the currently started
remote port forwardsCopyright © 2008–2022 The Apache Software Foundation. All rights reserved.