public class SftpStreamProxy extends Object implements com.jcraft.jsch.Proxy
Use a command on the proxy that will forward the SSH stream to the target host and port.
Modifier and Type | Field and Description |
---|---|
static String |
BASH_TCP_COMMAND
Command format using bash built-in TCP stream.
|
static String |
NETCAT_COMMAND
Command format using netcat command.
|
Constructor and Description |
---|
SftpStreamProxy(String commandFormat,
String proxyUser,
String proxyHost,
int proxyPort,
String proxyPassword,
FileSystemOptions proxyOptions)
Creates a stream proxy.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
connect(com.jcraft.jsch.SocketFactory socketFactory,
String targetHost,
int targetPort,
int timeout) |
InputStream |
getInputStream() |
OutputStream |
getOutputStream() |
Socket |
getSocket() |
public static final String BASH_TCP_COMMAND
public static final String NETCAT_COMMAND
public SftpStreamProxy(String commandFormat, String proxyUser, String proxyHost, int proxyPort, String proxyPassword, FileSystemOptions proxyOptions)
commandFormat
- A format string that will be used to create the command to execute on the proxy host using
String.format(String, Object...). Two parameters are given to the format command, the
target host name (String) and port (Integer).proxyUser
- The proxy userproxyPassword
- The proxy passwordproxyHost
- The proxy hostproxyPort
- The port to connect to on the proxyproxyOptions
- Options used when connecting to the proxypublic void close()
close
in interface com.jcraft.jsch.Proxy
public void connect(com.jcraft.jsch.SocketFactory socketFactory, String targetHost, int targetPort, int timeout) throws Exception
connect
in interface com.jcraft.jsch.Proxy
Exception
public InputStream getInputStream()
getInputStream
in interface com.jcraft.jsch.Proxy
public OutputStream getOutputStream()
getOutputStream
in interface com.jcraft.jsch.Proxy
public Socket getSocket()
getSocket
in interface com.jcraft.jsch.Proxy
Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.