!Start a Single Tunnel

The CrushTunnel process can be integrated into an existing workflow using a standalone machine acting as the tunnel provider, or programmatically through your own code.  CrushTunnel.jar can be found in the CrushFTP WebInterface folder.

Here is a stand alone example (one long line):

{{{
java -cp CrushTunnel.jar com.crushftp.tunnel2.Tunnel2 protocol=https host=www.crushftp.com port=443 username=demo password=demo
}}}

That command would start the tunnel and make it a FTP server handling requests that ultimately ended up going through the tunnel and to the main CrushFTP server on the other side.  You can control the port ranges for PASV, and the IP that is given to the FTP clients for PASV mode.  The tunnel goes over HTTPS, so everything is encrypted between CrushTunnel and the server.

----
!Start a Tunnel in Code
To programmatically start the tunnel, include the CrushTunnel.jar file, and do something similar to the following:

{{{
com.crushftp.client.Common.trustEverything(); //ignore SSL validation issues…bad for prod use
com.crushftp.tunnel2.Tunnel2 t = new com.crushftp.tunnel2.Tunnel2("https://www.crushftp.com:443/", "demo", "demo", false);
t.startThreads();
//tunnel is now open and ready.  Connections to it over FTP on 127.0.0.1 will be proxied securely through the tunnel to the CrushFTP FTP server side.

//to stop it later on
t.stopThisTunnel();
}}}

----
!Install as a Service on Windows for an Always on Tunnel

Run CrushTunnel.jar in command line client mode.\\
{{{
java -jar CrushTunnel.jar
}}}

Now issue the service tunnel command to install as a service.  The parameters are: protocol host port user pass.  Example:\\
{{{
service tunnel https www.CrushFTP.com 443 demo demo
}}}

Your done, type "quit" to exit the CrushClient command line.
----
__Command Line JNLP Launch__\\
You could also launch a specific tunnel from the command line using Java WebStart.

{{{
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="https://www.crushftp.com">
	<information>
		<title>CrushTunnel</title>
		<vendor>Ben Spink</vendor>
		<offline-allowed/>
		<shortcut online="true">
			<desktop/>
		</shortcut>
	</information>
	<security><all-permissions/></security>
	<resources>
		<j2se version="1.2+" /><jar href="/WebInterface/CrushTunnel.jar"/>
	</resources>
	<application-desc main-class="com.crushftp.tunnel2.Tunnel2">
		<argument>protocol=https</argument>
		<argument>host=www.crushftp.com</argument>
		<argument>port=443</argument>
		<argument>username=demo</argument>
		<argument>password=demo</argument>
	</application-desc>
</jnlp>


}}}