Author: toad
Date: 2007-09-14 19:24:25 +0000 (Fri, 14 Sep 2007)
New Revision: 15178
Modified:
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java
Log:
Tell the user to forward both ports
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2007-09-14
19:04:18 UTC (rev 15177)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2007-09-14
19:24:25 UTC (rev 15178)
@@ -390,10 +390,12 @@
IPDetectorPluginManager.symmetric=Your internet connection appears to be
behind a symmetric NAT or firewall. You will probably only be able to connect
to users directly connected to the internet or behind restricted cone NATs.
IPDetectorPluginManager.symmetricTitle=Symmetric firewall detected
IPUndetectedUserAlert.detecting=Freenet is currently attempting to detect your
external IP address. If this takes more than a few minutes there is something
wrong...
-IPUndetectedUserAlert.detectingWithConfigLink=Freenet is currently attempting
to detect your external IP address. If this takes more than a few minutes there
is something wrong and you can use the Temporary IP Address Hint
${link}configuration parameter${/link}. Also, it would be a good idea to
forward the port ${port} on your router for UDP to make it easier to connect to
your node.
-IPUndetectedUserAlert.unknownAddress=Freenet was unable to determine your
external IP address (or the IP address of your NAT or Firewall). You can still
exchange references with other people, however this will only work if the other
user is not behind a NAT or Firewall. As soon as you have connected to one
other user in this way, Freenet will be able to determine your external IP
address. You can determine your current IP address and tell your node with the
'Temporary IP address hint' ${link}configuration parameter${/link}. Also, it
would be a good idea to forward the port ${port} on your router for UDP to make
it easy to connect to your node.
+IPUndetectedUserAlert.detectingWithConfigLink=Freenet is currently attempting
to detect your external IP address. If this takes more than a few minutes there
is something wrong and you can use the Temporary IP Address Hint
${link}configuration parameter${/link}.
+IPUndetectedUserAlert.unknownAddress=Freenet was unable to determine your
external IP address (or the IP address of your NAT or Firewall). You can still
exchange references with other people, however this will only work if the other
user is not behind a NAT or Firewall. As soon as you have connected to one
other user in this way, Freenet will be able to determine your external IP
address. You can determine your current IP address and tell your node with the
'Temporary IP address hint' ${link}configuration parameter${/link}.
IPUndetectedUserAlert.unknownAddressTitle=Unknown external address
-IPUndetectedUserAlert.unknownAddressWithConfigLink=Freenet was unable to
determine your external IP address (or the IP address of your NAT-device or
firewall). You can still exchange references with other people, however this
will only work if the other user is not behind a NAT-device or firewall. As
soon as you have connected to one other user in this way, Freenet will be able
to determine your external IP address. You can determine your current IP
address and tell your node with the 'Temporary IP address hint'
${link}configuration parameter${/link}. Also, it would be a good idea to
forward the port ${port} on your router for UDP to make it easy to connect to
your node.
+IPUndetectedUserAlert.unknownAddressWithConfigLink=Freenet was unable to
determine your external IP address (or the IP address of your NAT-device or
firewall). You can still exchange references with other people, however this
will only work if the other user is not behind a NAT-device or firewall. As
soon as you have connected to one other user in this way, Freenet will be able
to determine your external IP address. You can determine your current IP
address and tell your node with the 'Temporary IP address hint'
${link}configuration parameter${/link}.
+IPUndetectedUserAlert.suggestForwardPort=Also, it would be a good idea to
forward the port ${port} (UDP) on your router to make it easy to connect to
your node.
+IPUndetectedUserAlert.suggestForwardTwoPorts=Also, it would be a good idea to
forward the ports ${port1} and ${port2} (UDP) on your router to make it easy to
connect to your node.
InsertException.longError.10=Cancelled by user
InsertException.longError.11=Meta string (most likely a '/') used in the URI
InsertException.longError.12=Binary blob format error
Modified: trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java
2007-09-14 19:04:18 UTC (rev 15177)
+++ trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java
2007-09-14 19:24:25 UTC (rev 15178)
@@ -30,7 +30,7 @@
if(node.ipDetector.isDetecting())
return l10n("detecting");
else
- return l10n("unknownAddress", "port",
Integer.toString(node.getDarknetPortNumber()));
+ return l10n("unknownAddress", "port",
Integer.toString(node.getDarknetPortNumber())) + ' ' +
textPortForwardSuggestion();
}
private String l10n(String key) {
@@ -41,14 +41,19 @@
return L10n.getString("IPUndetectedUserAlert."+key, pattern,
value);
}
+ private String l10n(String key, String[] patterns, String[] values) {
+ return L10n.getString("IPUndetectedUserAlert."+key, patterns,
values);
+ }
+
public HTMLNode getHTMLText() {
SubConfig sc = node.config.get("node");
Option o = sc.getOption("tempIPAddressHint");
HTMLNode textNode = new HTMLNode("div");
L10n.addL10nSubstitution(textNode,
"IPUndetectedUserAlert."+(node.ipDetector.isDetecting() ?
"detectingWithConfigLink" : "unknownAddressWithConfigLink"),
- new String[] { "link", "/link", "port" },
- new String[] { "<a href=\"/config/\">", "</a>",
Integer.toString(node.getDarknetPortNumber()) });
+ new String[] { "link", "/link" },
+ new String[] { "<a href=\"/config/\">", "</a>"
});
+ addPortForwardSuggestion(textNode);
HTMLNode formNode = textNode.addChild("form", new String[] {
"action", "method" }, new String[] { "/config/", "post" });
formNode.addChild("input", new String[] { "type", "name",
"value" }, new String[] { "hidden", "formPassword",
node.clientCore.formPassword });
HTMLNode listNode = formNode.addChild("ul", "class", "config");
@@ -60,6 +65,30 @@
return textNode;
}
+ private void addPortForwardSuggestion(HTMLNode textNode) {
+ // FIXME we should support any number of ports, UDP or TCP, and
pick them up from the node as we do with the forwarding plugin ... that would
be a bit of a pain for L10n though ...
+ int darknetPort = node.getDarknetPortNumber();
+ int opennetPort = node.getOpennetFNPPort();
+ if(opennetPort <= 0) {
+ textNode.addChild("#", " "+l10n("suggestForwardPort",
"port", Integer.toString(darknetPort)));
+ } else {
+ textNode.addChild("#", "
"+l10n("suggestForwardTwoPorts", new String[] { "port1", "port2" },
+ new String[] {
Integer.toString(darknetPort), Integer.toString(opennetPort) }));
+ }
+ }
+
+ private String textPortForwardSuggestion() {
+ // FIXME we should support any number of ports, UDP or TCP, and
pick them up from the node as we do with the forwarding plugin ... that would
be a bit of a pain for L10n though ...
+ int darknetPort = node.getDarknetPortNumber();
+ int opennetPort = node.getOpennetFNPPort();
+ if(opennetPort <= 0) {
+ return l10n("suggestForwardPort", "port",
Integer.toString(darknetPort));
+ } else {
+ return " "+l10n("suggestForwardTwoPorts", new String[]
{ "port1", "port2" },
+ new String[] {
Integer.toString(darknetPort), Integer.toString(opennetPort) });
+ }
+ }
+
public short getPriorityClass() {
if(node.ipDetector.isDetecting())
return UserAlert.WARNING;