corrections to port forwarding

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@286 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent d8cb3324a9
commit dbda6e1e85

@ -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>

@ -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);
}

@ -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"));
}

Loading…
Cancel
Save