diff --git a/htroot/Settings_p.html b/htroot/Settings_p.html index 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

-
Proxy Access Settings -
Proxy Port Configuration

+
Server Access Settings +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.
+
Port Configuration

- +
Proxy and Administration Port:Proxy and http-Server Administration Port: Changes will take effect after restart only.
-

Proxy Port Forwarding

+

Port Forwarding

+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. @@ -101,7 +106,7 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold
Enable port forwarding:

-

Proxy Access Restrictions

You can restrict the access to this proxy using a two-stage security barrier: +

Server Access Restrictions

You can restrict the access to this proxy/server using a two-stage security barrier:

  • define an access domain with a list of granted client IP-numbers or with wildcards
  • define an user account with an user:password - pair
  • diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java index 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 answers int 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 status if (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 statistics remoteSeed.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 cache if ((remoteSeed.hash != null) && (remoteSeed.isProper())) yacyCore.peerActions.peerPing(remoteSeed); } diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java index 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 information yacySeed mySeedBkp = (yacySeed) yacyCore.seedDB.mySeed.clone(); + + // we overwrite our own IP number only, if we do not portForwarding if (!serverCore.portForwardingEnabled) { yacyCore.seedDB.mySeed.put("IP", (String) result.get("yourip")); }