Skip to content

Commit

Permalink
*) better handling of port forwarding
Browse files Browse the repository at this point in the history
   - button is disabled if libx is not installed
   - bugfix for disconnect

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1782 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
theli committed Feb 28, 2006
1 parent c48232a commit 8558000
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion build.xml
Expand Up @@ -172,7 +172,10 @@
<filter token="REPL_DATE" value="${DSTAMP}"/>
<filter token="REPL_RELEASE" value="${releaseFile}"/>
<filter token="REPL_VERSION" value="${releaseVersion}" />
<copy file="${src}/yacy.java" tofile="${build}/yacy.java" filtering="true" />

<!-- deleting old file -->
<delete file="${build}/yacy.java" failonerror="false"/>
<copy file="${src}/yacy.java" tofile="${build}/yacy.java" overwrite="true" filtering="true" />
<copy file="${doc}/Download.html" tofile="${doc}/Download.html.up" filtering="true" />
</target>

Expand Down Expand Up @@ -527,6 +530,7 @@
<target name="clean" description="make clean">
<delete dir="${release_main}" failonerror="false"/>
<delete dir="${release_ext}" failonerror="false"/>
<delete file="${build}/yacy.java" failonerror="false"/>
<delete failonerror="false">
<fileset dir="${src}" includes="**/*.class" />
<fileset dir="${build}" includes="**/*.class" />
Expand Down
5 changes: 3 additions & 2 deletions htroot/Settings_PortForwarding.inc
Expand Up @@ -3,10 +3,11 @@
<p>You can use a remote server running a ssh demon to forward your server/proxy port.
This is useful if you want to tunnel throug a NAT/router.
Alternatively, you can simply set a virtual server port on your NAT/Server to enable connections from outside.</p>
<p><font color="red">You need to install libx to use this feature</font></p>
<table border="0" cellspacing="5">
<tr valign="top">
<td>Enable&nbsp;port&nbsp;forwarding:</td>
<td><input type="checkbox" name="portForwardingEnabled" align="top" #(portForwardingEnabled)#::checked#(/portForwardingEnabled)#></td>
<td><input type="checkbox" name="portForwardingEnabled" align="top" #(portForwardingEnabled)#::checked#(/portForwardingEnabled)##(portForwardingAvailable)# disabled="disabled"::#(/portForwardingAvailable)#></td>
<td>Enabling disabling port forwarding via secure channel.</td>
</tr>
<tr valign="top">
Expand Down Expand Up @@ -41,7 +42,7 @@ Alternatively, you can simply set a virtual server port on your NAT/Server to en
<td>&nbsp;</td>
</tr>
<tr valign="top">
<td colspan="3"><input type="submit" name="portForwarding" value="Submit">&nbsp;<i>Changes will take effect immediately.</i></td>
<td colspan="3"><input type="submit" name="portForwarding" value="Submit"#(portForwardingAvailable)# disabled="disabled"::#(/portForwardingAvailable)#>&nbsp;<i>Changes will take effect immediately.</i></td>
</tr>
</table>
</fieldset>
Expand Down
8 changes: 8 additions & 0 deletions htroot/Settings_p.java
Expand Up @@ -119,6 +119,14 @@ else if (page.equals("parser")) {
prop.put("proxy.sendViaHeader", env.getConfig("proxy.sendViaHeader", "false").equals("true") ? 1 : 0);

// remote port forwarding settings
boolean portForwardingAvailable = false;
try {
Class.forName("de.anomic.server.serverPortForwardingSch");
portForwardingAvailable = true;
} catch (Exception e) {
} catch (Error e) {}

prop.put("portForwardingAvailable",portForwardingAvailable? 1:0);
prop.put("portForwardingEnabled",env.getConfig("portForwardingEnabled","false").equals("true")? 1 : 0);
prop.put("portForwardingUseProxy",env.getConfig("portForwardingUseProxy", "false").equals("true")? 1 : 0);
prop.put("portForwardingPort",env.getConfig("portForwardingPort", ""));
Expand Down
5 changes: 5 additions & 0 deletions source/de/anomic/server/serverCore.java
Expand Up @@ -353,6 +353,11 @@ public void initPortForwarding() throws Exception {
this.switchboard.setConfig("portForwardingEnabled", "false");
throw e;
}
} else {
serverCore.portForwardingEnabled = false;
serverCore.portForwarding = null;
yacyCore.seedDB.mySeed.put(yacySeed.IP,publicIP());
yacyCore.seedDB.mySeed.put(yacySeed.PORT,Integer.toString(serverCore.getPortNr(this.switchboard.getConfig("port", "8080"))));
}
}

Expand Down

0 comments on commit 8558000

Please sign in to comment.