Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
corrections to port forwarding
orbiterdbda6e1e85cf
diff --git a/htroot/Settings_p.html b/htroot/Settings_p.htmlindex 51ced2d05..7305d22a7 100644--- a/htroot/Settings_p.html+++ b/htroot/Settings_p.html@@ -60,18 +60,23 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold</form><br><p><form action="SettingsAck_p.html" method="post" enctype="multipart/form-data">-<fieldset><legend>Proxy Access Settings</legend>-<br><b>Proxy Port Configuration</b><br><br>+<fieldset><legend>Server Access Settings</legend>+These settings configure the access method to your own http proxy and server.+All traffic is routed throug one single port, for both proxy and server.<br>+<br><b>Port Configuration</b><br><br><table border="0" cellspacing="5"><tr valign="top">- <td>Proxy and Administration Port:</td>+ <td>Proxy and http-Server Administration Port:</td><td><input name="port" type="text" size="5" maxlength="5" value="#[port]#"></td><td><i>Changes will take effect after restart only.</i></td></tr></table>-<p><b>Proxy Port Forwarding</b><br><br>+<p><b>Port Forwarding</b><br><br>+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.<table border="0" cellspacing="5"><tr valign="top"><td>Enable port forwarding:</td>@@ -101,7 +106,7 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold</table></p>-<p><b>Proxy Access Restrictions</b><br><br>You can restrict the access to this proxy using a two-stage security barrier:+<p><b>Server Access Restrictions</b><br><br>You can restrict the access to this proxy/server using a two-stage security barrier:<ul><li>define an <i>access domain</i> with a list of granted client IP-numbers or with wildcards</li><li>define an <i>user account</i> with an user:password - pair</li>diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.javaindex f08718de5..c69a58af6 100644--- a/htroot/yacy/hello.java+++ b/htroot/yacy/hello.java@@ -82,23 +82,22 @@ public class hello {//System.out.println("YACYHELLO: YOUR IP=" + yourip);prop.put("yourip", yourip);+ // now let's check if the calling peer can be reached and answersint urls = -1;- /*- * Needed for port forwarding support ....- *- * If the peer has reported an other address as it has connected- * to us, we try to use the reported address first ...- *- * @see serverCore#portForwardingEnabled- */- if ((!remoteSeed.get("IP","").equalsIgnoreCase(yourip)) &&- ((urls = yacyClient.queryUrlCount(remoteSeed)) == -1)) {- remoteSeed.put("IP", yourip);+ String reportedip = remoteSeed.get("IP", "");+ remoteSeed.put("IP", yourip);+ urls = yacyClient.queryUrlCount(remoteSeed);++ // if this was not successful, we try to use the reported ip+ if ((urls < 0) &&+ (!remoteSeed.get("IP","").equalsIgnoreCase(yourip))) {+ // the other peer does not respond under the ip it reported+ // we try again using the ip we got from the http header+ remoteSeed.put("IP", reportedip);urls = yacyClient.queryUrlCount(remoteSeed);}- // now let's check if the calling peer can be reached and answers- int port = Integer.parseInt(remoteSeed.get("Port", "8080"));+ // assign statusif (urls >= 0) {if (remoteSeed.get("PeerType", "senior") == null) {prop.put("yourtype", "senior");@@ -116,7 +115,7 @@ public class hello {remoteSeed.put("LastSeen", yacyCore.universalDateShortString());yacyCore.peerActions.juniorConnects++; // update statisticsremoteSeed.put("PeerType", "junior");- yacyCore.log.logInfo("hello: responded remote junior peer '" + remoteSeed.getName() + "' from " + yourip + ":" + port);+ yacyCore.log.logInfo("hello: responded remote junior peer '" + remoteSeed.getName() + "' from " + yourip + ":" + remoteSeed.get("Port", "8080"));// no connection here, instead store junior in connection cacheif ((remoteSeed.hash != null) && (remoteSeed.isProper())) yacyCore.peerActions.peerPing(remoteSeed);}diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex c10cf24b8..899a6d1d7 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -134,6 +134,8 @@ public class yacyClient {// set my own seed according to new informationyacySeed mySeedBkp = (yacySeed) yacyCore.seedDB.mySeed.clone();++ // we overwrite our own IP number only, if we do not portForwardingif (!serverCore.portForwardingEnabled) {yacyCore.seedDB.mySeed.put("IP", (String) result.get("yourip"));}