public class DefaultForwarder extends AbstractInnerCloseable implements Forwarder, SessionHolder<Session>, PortForwardingEventListenerManager
AbstractCloseable.State| Modifier and Type | Field and Description |
|---|---|
static Set<ClientChannelEvent> |
STATIC_IO_MSG_RECEIVED_EVENTS |
closeFuture, futureLock, statelog| Constructor and Description |
|---|
DefaultForwarder(ConnectionService service) |
doCloseGracefully, doCloseImmediatelyaddCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, removeCloseFutureListenerdebug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitstartLocalPortForwardingisRemotePortForwardingStartedForPortaddCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenergetSessionContextpublic static final Set<ClientChannelEvent> STATIC_IO_MSG_RECEIVED_EVENTS
public DefaultForwarder(ConnectionService service)
public PortForwardingEventListener getPortForwardingEventListenerProxy()
getPortForwardingEventListenerProxy in interface PortForwardingEventListenerManagerpublic void addPortForwardingEventListener(PortForwardingEventListener listener)
PortForwardingEventListenerManageraddPortForwardingEventListener in interface PortForwardingEventListenerManagerlistener - The PortForwardingEventListener to add - never nullpublic void removePortForwardingEventListener(PortForwardingEventListener listener)
PortForwardingEventListenerManagerremovePortForwardingEventListener in interface PortForwardingEventListenerManagerlistener - The PortForwardingEventListener to remove - ignored if nullpublic Collection<PortForwardingEventListenerManager> getRegisteredManagers()
getRegisteredManagers in interface PortForwardingEventListenerManagerHolderpublic boolean addPortForwardingEventListenerManager(PortForwardingEventListenerManager manager)
addPortForwardingEventListenerManager in interface PortForwardingEventListenerManagerHolderpublic boolean removePortForwardingEventListenerManager(PortForwardingEventListenerManager manager)
removePortForwardingEventListenerManager in interface PortForwardingEventListenerManagerHolderpublic Session getSession()
getSession in interface SessionHolder<Session>public final ConnectionService getConnectionService()
protected Collection<PortForwardingEventListener> getDefaultListeners()
public SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException
PortForwardingManagerstartLocalPortForwarding in interface PortForwardingManagerlocal - The local addressremote - The remote addressSshdSocketAddressIOException - If failed to create the requested bindingpublic void stopLocalPortForwarding(SshdSocketAddress local) throws IOException
PortForwardingManagerstopLocalPortForwarding in interface PortForwardingManagerlocal - The local addressIOException - If failed to cancel the requested bindingprotected void unbindLocalForwarding(SshdSocketAddress local, SshdSocketAddress remote, InetSocketAddress bound) throws IOException
IOExceptionpublic SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException
PortForwardingManagerStart 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 PortForwardingManagerremote - The remote addresslocal - The local addressSshdSocketAddressIOException - If failed to create the requested bindingpublic void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException
PortForwardingManagerstopRemotePortForwarding in interface PortForwardingManagerremote - The remote addressIOException - If failed to cancel the requested bindingprotected void signalTearingDownExplicitTunnel(SshdSocketAddress boundAddress, boolean localForwarding, SshdSocketAddress remote) throws IOException
IOExceptionprotected void signalTearingDownExplicitTunnel(PortForwardingEventListener listener, SshdSocketAddress boundAddress, boolean localForwarding, SshdSocketAddress remoteAddress) throws IOException
IOExceptionprotected void signalTornDownExplicitTunnel(SshdSocketAddress boundAddress, boolean localForwarding, SshdSocketAddress remoteAddress, Throwable reason) throws IOException
IOExceptionprotected void signalTornDownExplicitTunnel(PortForwardingEventListener listener, SshdSocketAddress boundAddress, boolean localForwarding, SshdSocketAddress remoteAddress, Throwable reason) throws IOException
IOExceptionpublic SshdSocketAddress startDynamicPortForwarding(SshdSocketAddress local) throws IOException
PortForwardingManagerstartDynamicPortForwarding in interface PortForwardingManagerlocal - The local addressSshdSocketAddressIOException - If failed to create the requested bindingprotected void signalEstablishedDynamicTunnel(SshdSocketAddress local, SshdSocketAddress boundAddress, Throwable reason) throws IOException
IOExceptionprotected void signalEstablishedDynamicTunnel(PortForwardingEventListener listener, SshdSocketAddress local, SshdSocketAddress boundAddress, Throwable reason) throws IOException
IOExceptionprotected void signalEstablishingDynamicTunnel(SshdSocketAddress local) throws IOException
IOExceptionprotected void signalEstablishingDynamicTunnel(PortForwardingEventListener listener, SshdSocketAddress local) throws IOException
IOExceptionpublic void stopDynamicPortForwarding(SshdSocketAddress local) throws IOException
PortForwardingManagerstopDynamicPortForwarding in interface PortForwardingManagerlocal - The local addressIOException - If failed to cancel the requested bindingprotected void unbindDynamicForwarding(SshdSocketAddress local, SocksProxy proxy, InetSocketAddress bound) throws IOException
IOExceptionprotected void signalTearingDownDynamicTunnel(SshdSocketAddress address) throws IOException
IOExceptionprotected void signalTearingDownDynamicTunnel(PortForwardingEventListener listener, SshdSocketAddress address) throws IOException
IOExceptionprotected void signalTornDownDynamicTunnel(SshdSocketAddress address, Throwable reason) throws IOException
IOExceptionprotected void signalTornDownDynamicTunnel(PortForwardingEventListener listener, SshdSocketAddress address, Throwable reason) throws IOException
IOExceptionpublic SshdSocketAddress getForwardedPort(int remotePort)
getForwardedPort in interface ForwarderremotePort - The remote portSshdSocketAddress that the remote port is forwarded topublic SshdSocketAddress localPortForwardingRequested(SshdSocketAddress local) throws IOException
ForwarderlocalPortForwardingRequested in interface Forwarderlocal - The request addressSshdSocketAddress - null if not allowed to forwardIOException - If failed to handle requestpublic void localPortForwardingCancelled(SshdSocketAddress local) throws IOException
ForwarderlocalPortForwardingCancelled in interface Forwarderlocal - The local SshdSocketAddressIOException - If failed to handle requestprotected void signalEstablishingExplicitTunnel(SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding) throws IOException
IOExceptionprotected void signalEstablishingExplicitTunnel(PortForwardingEventListener listener, SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding) throws IOException
IOExceptionprotected void signalEstablishedExplicitTunnel(SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding, SshdSocketAddress boundAddress, Throwable reason) throws IOException
IOExceptionprotected void signalEstablishedExplicitTunnel(PortForwardingEventListener listener, SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding, SshdSocketAddress boundAddress, Throwable reason) throws IOException
IOExceptionprotected void invokePortEventListenerSignaller(Invoker<PortForwardingEventListener,Void> invoker) throws Throwable
Throwableprotected void invokePortEventListenerSignallerListeners(Collection<? extends PortForwardingEventListener> listeners, Invoker<PortForwardingEventListener,Void> invoker) throws Throwable
Throwableprotected void invokePortEventListenerSignallerHolders(Collection<? extends PortForwardingEventListenerManager> holders, Invoker<PortForwardingEventListener,Void> invoker) throws Throwable
Throwableprotected Closeable getInnerCloseable()
getInnerCloseable in class AbstractInnerCloseableprotected void preClose()
preClose in class AbstractCloseableprotected IoAcceptor createIoAcceptor(Factory<? extends IoHandler> handlerFactory)
protected IoAcceptor getLocalIoAcceptor()
protected IoAcceptor getDynamicIoAcceptor()
protected InetSocketAddress doBind(SshdSocketAddress address, IoAcceptor acceptor) throws IOException
address - The request bind addressacceptor - An IoAcceptor to bind addressesInetSocketAddress to which the binding occurredIOException - If failed to bindpublic List<SshdSocketAddress> getBoundLocalPortForwards(int port)
getBoundLocalPortForwards in interface PortForwardingInformationProviderport - The port numberSshdSocketAddress-es for the portisLocalPortForwardingStartedForPort,
PortForwardingInformationProvider.getStartedLocalPortForwards()public boolean isLocalPortForwardingStartedForPort(int port)
PortForwardingInformationProviderisLocalPortForwardingStartedForPort in interface PortForwardingInformationProviderport - The local porttrue if local port forwarding is startedgetBoundLocalPortForwardspublic List<Map.Entry<SshdSocketAddress,SshdSocketAddress>> getLocalForwardsBindings()
getLocalForwardsBindings in interface PortForwardingInformationProviderSshdSocketAddress-espublic List<SshdSocketAddress> getStartedLocalPortForwards()
getStartedLocalPortForwards in interface PortForwardingInformationProviderList snapshot of the currently started local port forward bindingspublic List<Map.Entry<Integer,SshdSocketAddress>> getRemoteForwardsBindings()
getRemoteForwardsBindings in interface PortForwardingInformationProviderSshdSocketAddresspublic SshdSocketAddress getBoundRemotePortForward(int port)
getBoundRemotePortForward in interface PortForwardingInformationProviderport - The port numberSshdSocketAddress for the port - null if none boundisRemotePortForwardingStartedForPort,
PortForwardingInformationProvider.getStartedRemotePortForwards()public NavigableSet<Integer> getStartedRemotePortForwards()
getStartedRemotePortForwards in interface PortForwardingInformationProviderNavigableSet snapshot of the currently started remote port forwardsCopyright © 2008–2021 The Apache Software Foundation. All rights reserved.