Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
possibility to use anonther bindPort than the externally reachable port.
allo6ff8359b9859
diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.javaindex e831d7c4b..bfd293720 100644--- a/source/de/anomic/server/serverCore.java+++ b/source/de/anomic/server/serverCore.java@@ -102,7 +102,8 @@ public final class serverCore extends serverAbstractThread implements serverThrepublic static Hashtable bfHost = new Hashtable(); // for brute-force prevention// class variables- private String extendedPort; // the listening port+ private String extendedPort; // the port, which is visible from outside (in most cases bind-port)+ private String bindPort; // if set, yacy will bind to this port, but set extendedPort in the seedpublic boolean forceRestart = false; // specifies if the server should try to do a restartpublic static boolean portForwardingEnabled = false;@@ -224,10 +225,11 @@ public final class serverCore extends serverAbstractThread implements serverThre// read some config valuesthis.extendedPort = this.switchboard.getConfig("port", "8080").trim();+ this.bindPort = this.switchboard.getConfig("bindPort", "").trim();// Open a new server-socket channeltry {- this.initPort(this.extendedPort);+ this.initPort(this.extendedPort, this.bindPort);} catch (Exception e) {String errorMsg = "FATAL ERROR: " + e.getMessage() + " - probably root access rights needed. check port number";this.log.logSevere(errorMsg);@@ -278,16 +280,22 @@ public final class serverCore extends serverAbstractThread implements serverThrethis.theSessionPool = new SessionPool(new SessionFactory(this.theSessionThreadGroup),this.sessionPoolConfig);}- public void initPort(String thePort) throws IOException {- this.log.logInfo("Trying to bind server to port " + thePort);+ public void initPort(String seedPort, String bindPort) throws IOException {// Binds the ServerSocket to a specific addressInetSocketAddress bindAddress = null;this.socket = new ServerSocket();- this.socket.bind(bindAddress = generateSocketAddress(thePort));+ if(bindPort == null || bindPort.equals("")){+ this.log.logInfo("Trying to bind server to port " + seedPort);+ this.socket.bind(bindAddress = generateSocketAddress(seedPort));+ }else{ //bindPort set, use another port to bind than the port reachable from outside+ this.log.logInfo("Trying to bind server to port " + bindPort+ " with "+ seedPort + "as seedPort.");+ this.socket.bind(bindAddress = generateSocketAddress(bindPort));+ }// updating the port information- yacyCore.seedDB.mySeed.put(yacySeed.PORT,Integer.toString(bindAddress.getPort()));+ //yacyCore.seedDB.mySeed.put(yacySeed.PORT,Integer.toString(bindAddress.getPort()));+ yacyCore.seedDB.mySeed.put(yacySeed.PORT, seedPort);}public static int getPortNr(String extendedPortString) {diff --git a/yacy.init b/yacy.initindex 2ce89d857..7c6792f3d 100644--- a/yacy.init+++ b/yacy.init@@ -15,6 +15,13 @@# 192.168.0.1:8080port = 8080+#sometimes you may want yacy to bind to another port, than the one reachable from outside.+#then set bindPort to the port yacy should bind on, and port to the port, visible from outside+#to run yacy on port 8080, reachable from port 80, set bindPort=8080, port=80 and use+#iptables -t nat -A PREROUTING -p tcp -s 192.168.24.0/16 --dport 80 -j DNAT --to 192.168.24.1:8080+#(of course you need to customize the ips)+bindPort =+# SSL support:## For a German manual see http://yacy-websuche.de/wiki/index.php/De:Interface%C3%9CberHTTPS