At line 1 changed one line |
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. |
!Start a Single Tunnel |
At line 3 added 2 lines |
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. |
|
At line 6 changed one line |
java -Dcrushtunnel.pasv.ip=71.123.244.10 -Dcrushtunnel.pasv.port.start=2000 -Dcrushtunnel.pasv.port.stop=2100 -Djava.awt.headless=true -cp CrushTunnel.jar com.crushftp.tunnel.AutoChannelProxy protocol=https host=www.crushftp.com port=443 username=demo password=demo localport=2121 |
java -cp CrushTunnel.jar com.crushftp.tunnel2.Tunnel2 protocol=https host=www.crushftp.com port=443 username=demo password=demo |
At line 14 added one line |
!Start a Tunnel in Code |
At line 15 changed 6 lines |
final AutoChannelProxy tunnel = new AutoChannelProxy(); |
Thread thread = new Thread(new Runnable(){public void run(){ //create a thread for running the tunnel as this method does not return until the tunnel is done. |
String args[] = new String[]{"protocol=https","host=www.crushftp.com","port=443","username=demo","password="demo","localport=2121"}; |
tunnel.doTunnel(args); |
}}); |
thread.start(); |
com.crushtunnel.gui.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(); |
At line 24 changed one line |
thread.interrupt(); |
t.stopThisTunnel(); |
At line 26 added 74 lines |
|
---- |
!Install as a Service on Windows for an Always on Tunnel |
|
Here is another example for installing the tunnel as a service on Windows. First, make sure you have CrushFTP installed as a service on windows. You need this as we need the "service" folder that this creates. Copy this service folder somewhere else and call it "CrushTunnel". For my example, I put this in my program files folder. |
|
Now edit the wrapper.conf file to make it have these contents, with adjustments to the bottom part which applies to your server. |
|
{{{ |
wrapper.java.command=C:\\Program Files (x86)\\Java\\jre6\\bin\\java |
wrapper.working.dir=C:\\Program Files (x86)\\CrushTunnel\\ |
wrapper.java.app.mainclass=com.crushtunnel.gui.GUIFrame |
wrapper.console.visible=false |
wrapper.console.title=CrushTunnel |
|
wrapper.ntservice.name=CrushTunnel |
wrapper.ntservice.displayname=CrushTunnel |
wrapper.ntservice.description=CrushTunnel |
|
wrapper.tray=false |
|
wrapper.on_exit.0=SHUTDOWN |
wrapper.on_exit.default=RESTART |
|
wrapper.java.classpath.1=CrushTunnel.jar |
wrapper.java.additional.1=-Xmx128m |
wrapper.java.additional.2=-Dcrushtunnel.remote.protocol=https |
wrapper.java.additional.3=-Dcrushtunnel.remote.ip=www.crushftp.com |
wrapper.java.additional.4=-Dcrushtunnel.remote.port=443 |
wrapper.java.additional.5=-Dcrushtunnel.remote.user=demo |
wrapper.java.additional.6=-Dcrushtunnel.remote.pass=demo |
}}} |
|
Now you can test this config from the DOS prompt, or install the service. |
{{{ |
#test |
java -jar wrapper.jar -c wrapper.conf |
#install |
java -jar wrapper.jar -i wrapper.conf |
#remove |
java -jar wrapper.jar -r wrapper.conf |
}}} |
|
(If installing the service, your DOS prompt needs to be running as an administrator.) |
---- |
__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> |
|
|
}}} |