propagate from branch 'i2p.i2p' (head f42d02067d4fb58b86ffb79222a285f26c3a2628)

to branch 'i2p.i2p.zzz.test' (head 2ceb319557032e54cc8ace070515c6d540e0a7a4)
This commit is contained in:
zzz
2009-11-27 13:26:52 +00:00
209 changed files with 33301 additions and 14083 deletions

View File

@ -1,43 +1,155 @@
#!/bin/sh #!/bin/sh
#
#
# Now in the future we only need to look for '#I2P' and '#/I2P'
# for modifications to rc.local and rc.local_shutdown.
# I was a moron for not doing it this way in the first place :-) -- Sponge
#
#
touch /etc/rc.d/rc.local touch /etc/rc.d/rc.local
touch /etc/rc.d/rc.local_shutdown touch /etc/rc.d/rc.local_shutdown
I2PRCA=`grep -c /etc/rc.d/rc.local -e i2p`
I2PRCB=`grep -c /etc/rc.d/rc.local_shutdown -e i2p`
echo echo
echo -n "Check 1: /etc/rc.d/rc.local "
I2PRCA=`grep -c /etc/rc.d/rc.local -e '/etc/rc.d/rc.i2p'`
if [ $I2PRCA -eq 0 ] ; then if [ $I2PRCA -eq 0 ] ; then
echo '#I2P' >> /etc/rc.d/rc.local
echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local
echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local echo "fi" >> /etc/rc.d/rc.local
echo "/etc/rc.d/rc.local modified." echo '#/I2P' >> /etc/rc.d/rc.local
echo "modified."
else else
echo "/etc/rc.d/rc.local looks OK" echo -n "looks OK so far,"
# Fix old installs, or where people have modified.
echo -n " Check 1A: "
I2PRCC=`grep -c /etc/rc.d/rc.local -e 'i2p-\*\.tmp'`
if [ $I2PRCC -eq 0 ] ; then
DATA=$(cat /etc/rc.d/rc.local | sed -re 's/if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/#I2P\n\( cd \/tmp ; rm -Rf i2p-*.tmp \)\nif \[ -x \/etc\/rc.d\/rc.i2p \] ; then/')
echo "${DATA}" > /etc/rc.d/rc.local
echo -n "additional modifications applied,"
else
echo -n "looks OK so far,"
fi
echo -n " Check 1B: "
I2PRCE=`grep -c /etc/rc.d/rc.local -e 'i2p-\*\.tmp'`
if [ $I2PRCE -eq 0 ] ; then
DATATOP=$(cat /etc/rc.d/rc.local | sed -n '0,/i2p-\*\.tmp/p' | sed '$d' )
DATABOT=$(cat /etc/rc.d/rc.local | sed -n '/i2p-\*\.tmp/,$p' | sed -n '/^fi/,$p' | sed "1d")
echo "${DATATOP}" > /etc/rc.d/rc.local
echo '#I2P' >> /etc/rc.d/rc.local
echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local
echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local
echo '#/I2P' >> /etc/rc.d/rc.local
echo "${DATABOT}" >> /etc/rc.d/rc.local
echo -n "additional modifications applied,"
else
echo -n "looks ok so far,"
fi
echo -n " Check 1C: "
I2PRCF=`grep -c /etc/rc.d/rc.local -e '#/I2P'`
if [ $I2PRCF -eq 0 ] ; then
DATATOP=$(cat /etc/rc.d/rc.local | sed -n '0,/^#I2P/p' | sed '$d' )
DATABOT=$(cat /etc/rc.d/rc.local | sed -n '/^#I2P/,$p' | sed -n '/^fi/,$p' | sed "1d")
echo "${DATATOP}" > /etc/rc.d/rc.local
echo '#I2P' >> /etc/rc.d/rc.local
echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local
echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local
echo '#/I2P' >> /etc/rc.d/rc.local
echo "${DATABOT}" >> /etc/rc.d/rc.local
echo -n "additional modifications applied,"
else
echo -n "looks ok so far,"
fi
echo " Done."
fi fi
echo -n "Check 2: /etc/rc.d/rc.local_shutdown "
I2PRCB=`grep -c /etc/rc.d/rc.local_shutdown -e '/etc/rc.d/rc.i2p'`
if [ $I2PRCB -eq 0 ] ; then if [ $I2PRCB -eq 0 ] ; then
echo "#I2P" >> /etc/rc.d/rc.local_shutdown
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown
echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown
echo "fi" >> /etc/rc.d/rc.local_shutdown echo "fi" >> /etc/rc.d/rc.local_shutdown
echo "/etc/rc.d/rc.local_shutdown modified." echo "#/I2P" >> /etc/rc.d/rc.local_shutdown
echo "modified."
else else
echo "/etc/rc.d/rc.local_shutdown looks OK" echo -n "looks OK so far,"
# Fix old installs
echo -n " Check 1A: "
I2PRCG=`grep -c /etc/rc.d/rc.local_shutdown -e '#I2P'`
if [ $I2PRCG -eq 0 ] ; then
DATATOP=$(cat /etc/rc.d/rc.local_shutdown | sed -n '0,/^if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/p' | sed '$d' )
DATABOT=$(cat /etc/rc.d/rc.local_shutdown | sed -n '/^if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/,$p' | sed -n '/^fi/,$p' | sed "1d")
echo "${DATATOP}" > /etc/rc.d/rc.local_shutdown
echo '#I2P' >> /etc/rc.d/rc.local_shutdown
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown
echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown
echo "fi" >> /etc/rc.d/rc.local_shutdown
echo "#/I2P" >> /etc/rc.d/rc.local_shutdown
echo "${DATABOT}" >> /etc/rc.d/rc.local_shutdown
echo -n "additional modifications applied,"
else
echo -n "looks OK so far,"
fi
echo -n " Check 1B: "
I2PRCH=`grep -c /etc/rc.d/rc.local_shutdown -e '#/I2P'`
if [ $I2PRCH -eq 0 ] ; then
DATATOP=$(cat /etc/rc.d/rc.local_shutdown | sed -n '0,/^#I2P/p' | sed '$d' )
DATABOT=$(cat /etc/rc.d/rc.local_shutdown | sed -n '/^#I2P/,$p' | sed -n '/^fi/,$p' | sed "1d")
echo "${DATATOP}" > /etc/rc.d/rc.local_shutdown
echo '#I2P' >> /etc/rc.d/rc.local_shutdown
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown
echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown
echo "fi" >> /etc/rc.d/rc.local_shutdown
echo "#/I2P" >> /etc/rc.d/rc.local_shutdown
echo "${DATABOT}" >> /etc/rc.d/rc.local_shutdown
echo -n "additional modifications applied,"
else
echo -n "looks OK so far,"
fi
echo " Done."
fi fi
if [ -f /etc/rc.d/rc.i2p ] ; then if [ -f /etc/rc.d/rc.i2p ] ; then
if [ -x /etc/rc.d/rc.i2p ] ; then if [ -x /etc/rc.d/rc.i2p ] ; then
chmod +x /etc/rc.d/rc.i2p.new chmod +x /etc/rc.d/rc.i2p.new
fi fi
echo # Hopefully get admin's attention.
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -e "\007" ; sleep 0.3
echo "It apears that you already have /etc/rc.d/rc.i2p" echo "It apears that you already have /etc/rc.d/rc.i2p"
echo "You may wish to replace it with /etc/rc.d/rc.i2p.new" echo "You should replace it with /etc/rc.d/rc.i2p.new as soon as possible"
echo echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -e "\007" ; sleep 0.3
else else
mv /etc/rc.d/rc.i2p.new /etc/rc.d/rc.i2p mv /etc/rc.d/rc.i2p.new /etc/rc.d/rc.i2p
echo echo
echo "Installation finished. The i2p start/stop script has been" echo "Installation finished. The i2p start/stop script has been"
echo "installed on /etc/rc.d directory. You should chmod +x" echo "installed in /etc/rc.d . You should chmod +x"
echo '/etc/rc.d/rc.i2p to start it on boot.' echo '/etc/rc.d/rc.i2p to start it on boot.'
echo echo
fi fi

View File

@ -1,46 +1,57 @@
#!/bin/sh #!/bin/sh
# Heavily based on the Slackware 12.1 SlackBuild #
# Slackware build script for i2p # Heavily based on the Slackware 12.2 SlackBuild
# Slackware build script for I2P
#
# PLEASE READ THIS: # PLEASE READ THIS:
# Probably you will never have to update i2p packages with upgradepkg, # How to start I2P:
# just because i2p have an auto-update function. # After installpkg command, doinst.sh will execute a post-installation script
# How to start i2p: # needed by I2P. After that you have to chmod +x /etc/rc.d/rc.i2p and start
# After installpkg command, doinst.sh will execute a postinstallation script # I2P service with /etc/rc.d/rc.i2p start.
# needed by i2p. After that you have to chmod +x /etc/rc.d/rc.i2p and start #
# i2p service with /etc/rc.d/rc.i2p start.
# Now tell your browser to user this proxy: localhost on port 4444 and open # Now tell your browser to user this proxy: localhost on port 4444 and open
# this page: http://localhost:7657/index.jsp # this page: http://localhost:7657/index.jsp
# Here you can configure i2p, watch network status and navigate anonimously. #
# Here you can configure I2P, watch network status and navigate anonimously.
# It's suggested to subscribe to various dns host, like i2host.i2p # It's suggested to subscribe to various dns host, like i2host.i2p
# For any additional information, visit i2host.i2p and forum.i2p # For any additional information, visit i2host.i2p and forum.i2p
#
CWD=$(pwd) CWD=$(pwd)
TMP=/tmp TMP=/tmp
PKG=/$TMP/package-base-i2p PKG=/$TMP/package-base-i2p
rm -rf $PKG
mkdir -p $PKG
# put here installation dir, without first and last /
# es: usr/local
NAME=i2p-base NAME=i2p-base
VERSION=0.0.1 VERSION=0.0.2
BUILD=1sponge BUILD=1sponge
ARCH=noarch ARCH=noarch
INSTALL_DIR=opt INSTALL_DIR=opt
# Less than slackware 13?
SLKPLT=$(cat /etc/slackware-version | sed -re "s/(Slackware )([0-9]*)(.*)/\2/")
if [ $SLKPLT -lt 13 ] ; then
EXT=tgz
else
EXT=txz
fi
rm -rf $PKG
mkdir -p $PKG
cd $PKG cd $PKG
chown -R root:root . chown -R root:root .
mkdir -p $PKG/etc/rc.d mkdir -p $PKG/etc/rc.d
mkdir -p $PKG/install mkdir -p $PKG/install
sed "s|directory|/$INSTALL_DIR/i2p/i2prouter|g" $CWD/rc.i2p_def > $PKG/etc/rc.d/rc.i2p.new sed "s|directory|/$INSTALL_DIR/i2p/i2prouter|g" "$CWD/rc.i2p_def" > $PKG/etc/rc.d/rc.i2p.new
chmod 644 $PKG/etc/rc.d/rc.i2p.new chmod 644 $PKG/etc/rc.d/rc.i2p.new
sed "s|directory|/$INSTALL_DIR/i2p/|g" $CWD/doinst.sh > $PKG/install/doinst.sh cat "$CWD/doinst.sh" > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc cat "$CWD/slack-desc" > $PKG/install/slack-desc
cd $PKG cd $PKG
# #
# Not really that important to exec this. # Not really that important to exec this
#requiredbuilder -v -y -s $CWD $PKG # as there aren't any deps we don't know.
# #
cat $CWD/slack-required > $PKG/install/slack-required # requiredbuilder -v -y -s $CWD $PKG
makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.tgz #
cat "$CWD/slack-required" > $PKG/install/slack-required
makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.$EXT

View File

@ -9,6 +9,22 @@ i2p_stop() {
/bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory stop )" /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory stop )"
} }
i2p_restart() {
/bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory restart)"
}
i2p_status() {
/bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory status )"
}
i2p_console() {
/bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory console )"
}
i2p_dump() {
/bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory dump )"
}
case "$1" in case "$1" in
'start') 'start')
i2p_start i2p_start
@ -17,11 +33,19 @@ case "$1" in
i2p_stop i2p_stop
;; ;;
'restart') 'restart')
i2p_stop i2p_restart
i2p_start ;;
'status')
i2p_status
;;
'console')
i2p_console
;;
'dump')
i2p_dump
;; ;;
*) *)
echo "usage $0 start|stop|restart" echo "usage $0 start|stop|restart|status|console|dump"
;; ;;
esac esac

View File

@ -1,28 +1,35 @@
#!/bin/sh #!/bin/sh
# Heavily based on the Slackware 12.1 SlackBuild #
# Slackware build script for i2p # Heavily based on the Slackware 12.2 SlackBuild
# Slackware build script for I2P
#
# PLEASE READ THIS: # PLEASE READ THIS:
# Probably you will never have to update i2p packages with upgradepkg, # Probably you will never have to update I2P packages with upgradepkg,
# just because i2p have an auto-update function. # just because I2P has an auto-update function.
# How to start i2p: # Really you should not ever use any "upgrade" method.
# After installpkg command, doinst.sh will execute a postinstallation script #
# needed by i2p. After that you have to chmod +x /etc/rc.d/rc.i2p and start # The correct way to upgrade is to:
# i2p service with /etc/rc.d/rc.i2p start. # 1: install the upgrade
# Now tell your browser to user this proxy: localhost on port 4444 and open # 2: remove the old package
# this page: http://localhost:7657/index.jsp #
# Here you can configure i2p, watch network status and navigate anonimously. # It is a terrible shame that upgradepkg doesn't do this, infact,
# It's suggested to subscribe to various dns host, like i2host.i2p # it would actually be the correct way for *any* package!
# For any additional information, visit i2host.i2p and forum.i2p #
#
BUILD=1sponge BUILD=1sponge
# put here installation dir, without first and last /
# eg: usr/local
INSTALL_DIR=opt INSTALL_DIR=opt
NAME=i2p NAME=i2p
ARCH=noarch ARCH=noarch
# Less than slackware 13?
SLKPLT=$(cat /etc/slackware-version | sed -re "s/(Slackware )([0-9]*)(.*)/\2/")
if [ $SLKPLT -lt 13 ] ; then
EXT=tgz
else
EXT=txz
fi
# #
# This mess is here due to the totally moronic way i2p does versioning. # This mess is here due to the totally moronic way i2p does versioning.
@ -117,7 +124,7 @@ cd $PKG
# requiredbuilder fucks up REALLY bad, and thinks java is perl?! # requiredbuilder fucks up REALLY bad, and thinks java is perl?!
# It also did not catch the shell requirements! BOOOOOOOOOOO! HISSSSSSSS! # It also did not catch the shell requirements! BOOOOOOOOOOO! HISSSSSSSS!
# #
#requiredbuilder -v -y -s $CWD $PKG # requiredbuilder -v -y -s $CWD $PKG
# #
cat $CWD/slack-required > $PKG/install/slack-required cat $CWD/slack-required > $PKG/install/slack-required
makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.tgz makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.$EXT

View File

@ -1,9 +1,13 @@
These instructions are for the 1.5 SDK. These instructions are for the 1.5 Android SDK.
The build file is not compatible with the 1.1 SDK any more. The build file is not compatible with the 1.1 SDK any more.
1.6 and 2.0 SDKs are untested.
#Unzip the android SDK in ../../ #Unzip the android SDK in ../../
#So then the android tools will be in ../../android-sdk-linux_x86-1.5_r2/tools/ #So then the android tools will be in ../../android-sdk-linux_x86-1.5_r2/tools/
# create a file local.properties with the following line:
# sdk-location=/path/to/your/android-sdk-linux_x86-1.5_r2
#then build the android apk file: #then build the android apk file:
ant debug ant debug

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package addressbook; package net.i2p.addressbook;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -193,7 +193,8 @@ public class AddressBook {
(! host.endsWith(".router.i2p")) && (! host.endsWith(".router.i2p")) &&
(! host.endsWith(".console.i2p")) && (! host.endsWith(".console.i2p")) &&
((dest.length() == MIN_DEST_LENGTH && dest.endsWith("AAAA")) || // null cert ends with AAAA but other zero-length certs would be AA
((dest.length() == MIN_DEST_LENGTH && dest.endsWith("AA")) ||
(dest.length() > MIN_DEST_LENGTH && dest.length() <= MAX_DEST_LENGTH)) && (dest.length() > MIN_DEST_LENGTH && dest.length() <= MAX_DEST_LENGTH)) &&
dest.replaceAll("[a-zA-Z0-9~-]", "").length() == 0 dest.replaceAll("[a-zA-Z0-9~-]", "").length() == 0
; ;

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package addressbook; package net.i2p.addressbook;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package addressbook; package net.i2p.addressbook;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package addressbook; package net.i2p.addressbook;
/** /**
* A thread that waits five minutes, then runs the addressbook daemon. * A thread that waits five minutes, then runs the addressbook daemon.

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package addressbook; package net.i2p.addressbook;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package addressbook; package net.i2p.addressbook;
import javax.servlet.GenericServlet; import javax.servlet.GenericServlet;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package addressbook; package net.i2p.addressbook;
/** /**
* A subscription to a remote address book. * A subscription to a remote address book.

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package addressbook; package net.i2p.addressbook;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package addressbook; package net.i2p.addressbook;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View File

@ -6,7 +6,7 @@
<web-app> <web-app>
<servlet> <servlet>
<servlet-name>addressbook</servlet-name> <servlet-name>addressbook</servlet-name>
<servlet-class>addressbook.Servlet</servlet-class> <servlet-class>net.i2p.addressbook.Servlet</servlet-class>
<init-param> <init-param>
<param-name>home</param-name> <param-name>home</param-name>
<param-value>./addressbook</param-value> <param-value>./addressbook</param-value>

View File

@ -236,10 +236,21 @@ public class PeerCoordinator implements PeerListener
{ {
synchronized(peers) synchronized(peers)
{ {
return !halted && peers.size() < _util.getMaxConnections(); return !halted && peers.size() < getMaxConnections();
} }
} }
/** reduce max if huge pieces to keep from ooming */
private int getMaxConnections() {
int size = metainfo.getPieceLength(0);
int max = _util.getMaxConnections();
if (size <= 1024*1024)
return max;
if (size <= 2*1024*1024)
return (max + 1) / 2;
return (max + 3) / 4;
}
public boolean halted() { return halted; } public boolean halted() { return halted; }
public void halt() public void halt()
@ -294,7 +305,7 @@ public class PeerCoordinator implements PeerListener
peer.disconnect(false); // Don't deregister this connection/peer. peer.disconnect(false); // Don't deregister this connection/peer.
} }
// This is already checked in addPeer() but we could have gone over the limit since then // This is already checked in addPeer() but we could have gone over the limit since then
else if (peers.size() >= _util.getMaxConnections()) else if (peers.size() >= getMaxConnections())
{ {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Already at MAX_CONNECTIONS in connected() with peer: " + peer); _log.warn("Already at MAX_CONNECTIONS in connected() with peer: " + peer);
@ -350,7 +361,7 @@ public class PeerCoordinator implements PeerListener
peersize = peers.size(); peersize = peers.size();
// This isn't a strict limit, as we may have several pending connections; // This isn't a strict limit, as we may have several pending connections;
// thus there is an additional check in connected() // thus there is an additional check in connected()
need_more = (!peer.isConnected()) && peersize < _util.getMaxConnections(); need_more = (!peer.isConnected()) && peersize < getMaxConnections();
// Check if we already have this peer before we build the connection // Check if we already have this peer before we build the connection
Peer old = peerIDInList(peer.getPeerID(), peers); Peer old = peerIDInList(peer.getPeerID(), peers);
need_more = need_more && ((old == null) || (old.getInactiveTime() > 8*60*1000)); need_more = need_more && ((old == null) || (old.getInactiveTime() > 8*60*1000));
@ -378,7 +389,7 @@ public class PeerCoordinator implements PeerListener
if (peer.isConnected()) if (peer.isConnected())
_log.info("Add peer already connected: " + peer); _log.info("Add peer already connected: " + peer);
else else
_log.info("Connections: " + peersize + "/" + _util.getMaxConnections() _log.info("Connections: " + peersize + "/" + getMaxConnections()
+ " not accepting extra peer: " + peer); + " not accepting extra peer: " + peer);
} }
return false; return false;

View File

@ -20,6 +20,7 @@ import net.i2p.data.Base64;
import net.i2p.data.DataHelper; import net.i2p.data.DataHelper;
import net.i2p.util.I2PAppThread; import net.i2p.util.I2PAppThread;
import net.i2p.util.Log; import net.i2p.util.Log;
import net.i2p.util.OrderedProperties;
/** /**
* Manage multiple snarks * Manage multiple snarks
@ -126,7 +127,7 @@ public class SnarkManager implements Snark.CompleteListener {
/** null to set initial defaults */ /** null to set initial defaults */
public void loadConfig(String filename) { public void loadConfig(String filename) {
if (_config == null) if (_config == null)
_config = new Properties(); _config = new OrderedProperties();
if (filename != null) { if (filename != null) {
File cfg = new File(filename); File cfg = new File(filename);
if (!cfg.isAbsolute()) if (!cfg.isAbsolute())
@ -552,11 +553,15 @@ public class SnarkManager implements Snark.CompleteListener {
List files = info.getFiles(); List files = info.getFiles();
if ( (files != null) && (files.size() > MAX_FILES_PER_TORRENT) ) { if ( (files != null) && (files.size() > MAX_FILES_PER_TORRENT) ) {
return "Too many files in " + info.getName() + " (" + files.size() + "), deleting it!"; return "Too many files in " + info.getName() + " (" + files.size() + "), deleting it!";
} else if ( (files == null) && (info.getName().endsWith(".torrent")) ) {
return "Torrent file " + info.getName() + " cannot end in '.torrent', deleting it!";
} else if (info.getPieces() <= 0) { } else if (info.getPieces() <= 0) {
return "No pieces in " + info.getName() + "? deleting it!"; return "No pieces in " + info.getName() + "? deleting it!";
} else if (info.getPieces() > Storage.MAX_PIECES) {
return "Too many pieces in " + info.getName() + ", limit is " + Storage.MAX_PIECES + ", deleting it!";
} else if (info.getPieceLength(0) > Storage.MAX_PIECE_SIZE) { } else if (info.getPieceLength(0) > Storage.MAX_PIECE_SIZE) {
return "Pieces are too large in " + info.getName() + " (" + DataHelper.formatSize(info.getPieceLength(0)) + return "Pieces are too large in " + info.getName() + " (" + DataHelper.formatSize(info.getPieceLength(0)) +
"B), deleting it."; "B, limit is " + DataHelper.formatSize(Storage.MAX_PIECE_SIZE) + "B), deleting it.";
} else if (info.getTotalLength() > Storage.MAX_TOTAL_SIZE) { } else if (info.getTotalLength() > Storage.MAX_TOTAL_SIZE) {
System.out.println("torrent info: " + info.toString()); System.out.println("torrent info: " + info.toString());
List lengths = info.getLengths(); List lengths = info.getLengths();
@ -710,7 +715,6 @@ public class SnarkManager implements Snark.CompleteListener {
"POSTMAN", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/" "POSTMAN", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/"
,"WELTERDE", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5" ,"WELTERDE", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
, "CRSTRACK", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/" , "CRSTRACK", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
, "ThePirateBay", "http://tracker.thepiratebay.i2p/announce=http://thepiratebay.i2p/"
}; };
/** comma delimited list of name=announceURL=baseURL for the trackers to be displayed */ /** comma delimited list of name=announceURL=baseURL for the trackers to be displayed */

View File

@ -57,7 +57,8 @@ public class Storage
/** The default piece size. */ /** The default piece size. */
private static final int MIN_PIECE_SIZE = 256*1024; private static final int MIN_PIECE_SIZE = 256*1024;
public static final int MAX_PIECE_SIZE = 1024*1024; /** note that we start reducing max number of peer connections above 1MB */
public static final int MAX_PIECE_SIZE = 2*1024*1024;
/** The maximum number of pieces in a torrent. */ /** The maximum number of pieces in a torrent. */
public static final int MAX_PIECES = 10*1024; public static final int MAX_PIECES = 10*1024;
public static final long MAX_TOTAL_SIZE = MAX_PIECE_SIZE * (long) MAX_PIECES; public static final long MAX_TOTAL_SIZE = MAX_PIECE_SIZE * (long) MAX_PIECES;

View File

@ -505,7 +505,6 @@ public class I2PSnarkServlet extends HttpServlet {
// temporarily hardcoded for postman* and anonymity, requires bytemonsoon patch for lookup by info_hash // temporarily hardcoded for postman* and anonymity, requires bytemonsoon patch for lookup by info_hash
String announce = snark.meta.getAnnounce(); String announce = snark.meta.getAnnounce();
if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr") || if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr") ||
announce.startsWith("http://4svjpPox") || announce.startsWith("http://tracker.thepiratebay.i2p/") ||
announce.startsWith("http://lnQ6yoBT") || announce.startsWith("http://tracker2.postman.i2p/")) { announce.startsWith("http://lnQ6yoBT") || announce.startsWith("http://tracker2.postman.i2p/")) {
Map trackers = _manager.getTrackers(); Map trackers = _manager.getTrackers();
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) { for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
@ -513,8 +512,7 @@ public class I2PSnarkServlet extends HttpServlet {
String name = (String)entry.getKey(); String name = (String)entry.getKey();
String baseURL = (String)entry.getValue(); String baseURL = (String)entry.getValue();
if (!(baseURL.startsWith(announce) || // vvv hack for non-b64 announce in list vvv if (!(baseURL.startsWith(announce) || // vvv hack for non-b64 announce in list vvv
(announce.startsWith("http://lnQ6yoBT") && baseURL.startsWith("http://tracker2.postman.i2p/")) || (announce.startsWith("http://lnQ6yoBT") && baseURL.startsWith("http://tracker2.postman.i2p/"))))
(announce.startsWith("http://4svjpPox") && baseURL.startsWith("http://thepiratebay.i2p/"))))
continue; continue;
int e = baseURL.indexOf('='); int e = baseURL.indexOf('=');
if (e < 0) if (e < 0)

View File

@ -3,8 +3,10 @@
*/ */
package net.i2p.i2ptunnel; package net.i2p.i2ptunnel;
import java.io.ByteArrayOutputStream;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@ -15,6 +17,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -55,6 +58,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
private HashMap addressHelpers = new HashMap(); private HashMap addressHelpers = new HashMap();
/**
* These are backups if the xxx.ht error page is missing.
*/
private final static byte[] ERR_REQUEST_DENIED = private final static byte[] ERR_REQUEST_DENIED =
("HTTP/1.1 403 Access Denied\r\n"+ ("HTTP/1.1 403 Access Denied\r\n"+
"Content-Type: text/html; charset=iso-8859-1\r\n"+ "Content-Type: text/html; charset=iso-8859-1\r\n"+
@ -77,6 +84,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
"Could not find the following Destination:<BR><BR><div>") "Could not find the following Destination:<BR><BR><div>")
.getBytes(); .getBytes();
/*****
private final static byte[] ERR_TIMEOUT = private final static byte[] ERR_TIMEOUT =
("HTTP/1.1 504 Gateway Timeout\r\n"+ ("HTTP/1.1 504 Gateway Timeout\r\n"+
"Content-Type: text/html; charset=iso-8859-1\r\n"+ "Content-Type: text/html; charset=iso-8859-1\r\n"+
@ -88,6 +96,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
"destination may have issues. Could not get a response from "+ "destination may have issues. Could not get a response from "+
"the following Destination:<BR><BR>") "the following Destination:<BR><BR>")
.getBytes(); .getBytes();
*****/
private final static byte[] ERR_NO_OUTPROXY = private final static byte[] ERR_NO_OUTPROXY =
("HTTP/1.1 503 Service Unavailable\r\n"+ ("HTTP/1.1 503 Service Unavailable\r\n"+
@ -108,11 +117,11 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
"The addresshelper link you followed specifies a different destination key "+ "The addresshelper link you followed specifies a different destination key "+
"than a host entry in your host database. "+ "than a host entry in your host database. "+
"Someone could be trying to impersonate another eepsite, "+ "Someone could be trying to impersonate another eepsite, "+
"or people have given two eepsites identical names.<P/>"+ "or people have given two eepsites identical names.<p>"+
"You can resolve the conflict by considering which key you trust, "+ "You can resolve the conflict by considering which key you trust, "+
"and either discarding the addresshelper link, "+ "and either discarding the addresshelper link, "+
"discarding the host entry from your host database, "+ "discarding the host entry from your host database, "+
"or naming one of them differently.<P/>") "or naming one of them differently.<p>")
.getBytes(); .getBytes();
private final static byte[] ERR_BAD_PROTOCOL = private final static byte[] ERR_BAD_PROTOCOL =
@ -376,22 +385,16 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
// Did addresshelper key conflict? // Did addresshelper key conflict?
if (ahelperConflict) if (ahelperConflict)
{ {
String str;
byte[] header;
str = FileUtil.readTextFile((new File(_errorDir, "ahelper-conflict-header.ht")).getAbsolutePath(), 100, true);
if (str != null) header = str.getBytes();
else header = ERR_AHELPER_CONFLICT;
if (out != null) { if (out != null) {
// Fixme untranslated
long alias = I2PAppContext.getGlobalContext().random().nextLong(); long alias = I2PAppContext.getGlobalContext().random().nextLong();
String trustedURL = protocol + uriPath + urlEncoding; String trustedURL = protocol + uriPath + urlEncoding;
String conflictURL = protocol + alias + ".i2p/?" + initialFragments; String conflictURL = protocol + alias + ".i2p/?" + initialFragments;
byte[] header = getErrorPage("ahelper-conflict", ERR_AHELPER_CONFLICT);
out.write(header); out.write(header);
out.write(("To visit the destination in your host database, click <a href=\"" + trustedURL + "\">here</a>. To visit the conflicting addresshelper link by temporarily giving it a random alias, click <a href=\"" + conflictURL + "\">here</a>.<P/>").getBytes()); out.write(("To visit the destination in your host database, click <a href=\"" + trustedURL + "\">here</a>. To visit the conflicting addresshelper link by temporarily giving it a random alias, click <a href=\"" + conflictURL + "\">here</a>.<p></div>").getBytes());
out.write("</div><div class=\"proxyfooter\"><p><i>I2P HTTP Proxy Server<br />Generated on: ".getBytes()); writeFooter(out);
out.write(new Date().toString().getBytes());
out.write("</i></div></body></html>\n".getBytes());
out.flush();
} }
s.close(); s.close();
return; return;
@ -408,11 +411,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
line = method + " " + request.substring(pos); line = method + " " + request.substring(pos);
} else if (host.toLowerCase().equals("localhost") || host.equals("127.0.0.1")) { } else if (host.toLowerCase().equals("localhost") || host.equals("127.0.0.1")) {
if (out != null) { if (out != null) {
out.write(ERR_LOCALHOST); out.write(getErrorPage("localhost", ERR_LOCALHOST));
out.write("<p /><i>Generated on: ".getBytes()); writeFooter(out);
out.write(new Date().toString().getBytes());
out.write("</i></body></html>\n".getBytes());
out.flush();
} }
s.close(); s.close();
return; return;
@ -430,11 +430,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
_log.warn(getPrefix(requestId) + "Host wants to be outproxied, but we dont have any!"); _log.warn(getPrefix(requestId) + "Host wants to be outproxied, but we dont have any!");
l.log("No HTTP outproxy found for the request."); l.log("No HTTP outproxy found for the request.");
if (out != null) { if (out != null) {
out.write(ERR_NO_OUTPROXY); out.write(getErrorPage("noproxy", ERR_NO_OUTPROXY));
out.write("<p /><i>Generated on: ".getBytes()); writeFooter(out);
out.write(new Date().toString().getBytes());
out.write("</i></body></html>\n".getBytes());
out.flush();
} }
s.close(); s.close();
return; return;
@ -449,11 +446,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
if (pos < 0) { if (pos < 0) {
l.log("Invalid request url [" + request + "]"); l.log("Invalid request url [" + request + "]");
if (out != null) { if (out != null) {
out.write(ERR_REQUEST_DENIED); out.write(getErrorPage("denied", ERR_REQUEST_DENIED));
out.write("<p /><i>Generated on: ".getBytes()); writeFooter(out);
out.write(new Date().toString().getBytes());
out.write("</i></body></html>\n".getBytes());
out.flush();
} }
s.close(); s.close();
return; return;
@ -540,13 +534,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
l.log("No HTTP method found in the request."); l.log("No HTTP method found in the request.");
if (out != null) { if (out != null) {
if ("http://".equalsIgnoreCase(protocol)) if ("http://".equalsIgnoreCase(protocol))
out.write(ERR_REQUEST_DENIED); out.write(getErrorPage("denied", ERR_REQUEST_DENIED));
else else
out.write(ERR_BAD_PROTOCOL); out.write(getErrorPage("protocol", ERR_BAD_PROTOCOL));
out.write("<p /><i>Generated on: ".getBytes()); writeFooter(out);
out.write(new Date().toString().getBytes());
out.write("</i></body></html>\n".getBytes());
out.flush();
} }
s.close(); s.close();
return; return;
@ -568,23 +559,18 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
//l.log("Could not resolve " + destination + "."); //l.log("Could not resolve " + destination + ".");
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Unable to resolve " + destination + " (proxy? " + usingWWWProxy + ", request: " + targetRequest); _log.warn("Unable to resolve " + destination + " (proxy? " + usingWWWProxy + ", request: " + targetRequest);
String str;
byte[] header; byte[] header;
boolean showAddrHelper = false; boolean showAddrHelper = false;
if (usingWWWProxy) if (usingWWWProxy)
str = FileUtil.readTextFile((new File(_errorDir, "dnfp-header.ht")).getAbsolutePath(), 100, true); header = getErrorPage("dnfp", ERR_DESTINATION_UNKNOWN);
else if(ahelper != 0) else if(ahelper != 0)
str = FileUtil.readTextFile((new File(_errorDir, "dnfb-header.ht")).getAbsolutePath(), 100, true); header = getErrorPage("dnfb", ERR_DESTINATION_UNKNOWN);
else if (destination.length() == 60 && destination.endsWith(".b32.i2p")) else if (destination.length() == 60 && destination.endsWith(".b32.i2p"))
str = FileUtil.readTextFile((new File(_errorDir, "dnf-header.ht")).getAbsolutePath(), 100, true); header = getErrorPage("dnf", ERR_DESTINATION_UNKNOWN);
else { else {
str = FileUtil.readTextFile((new File(_errorDir, "dnfh-header.ht")).getAbsolutePath(), 100, true); header = getErrorPage("dnfh", ERR_DESTINATION_UNKNOWN);
showAddrHelper = true; showAddrHelper = true;
} }
if (str != null)
header = str.getBytes();
else
header = ERR_DESTINATION_UNKNOWN;
writeErrorMessage(header, out, targetRequest, usingWWWProxy, destination, showAddrHelper); writeErrorMessage(header, out, targetRequest, usingWWWProxy, destination, showAddrHelper);
s.close(); s.close();
return; return;
@ -658,6 +644,64 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
} }
} }
/**
* foo => errordir/foo-header_xx.ht for lang xx, or errordir/foo-header.ht,
* or the backup byte array on fail.
*
* .ht files must be UTF-8 encoded and use \r\n terminators so the
* HTTP headers are conformant.
* We can't use FileUtil.readFile() because it strips \r
*
* @return non-null
*/
private byte[] getErrorPage(String base, byte[] backup) {
return getErrorPage(getTunnel().getContext(), base, backup);
}
private static byte[] getErrorPage(I2PAppContext ctx, String base, byte[] backup) {
File errorDir = new File(ctx.getBaseDir(), "docs");
String lang = ctx.getProperty("routerconsole.lang", Locale.getDefault().getLanguage());
if (lang != null && lang.length() > 0 && !lang.equals("en")) {
File file = new File(errorDir, base + "-header_" + lang + ".ht");
try {
return readFile(file);
} catch (IOException ioe) {
// try the english version now
}
}
File file = new File(errorDir, base + "-header.ht");
try {
return readFile(file);
} catch (IOException ioe) {
return backup;
}
}
private static byte[] readFile(File file) throws IOException {
FileInputStream fis = null;
byte[] buf = new byte[512];
ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
try {
int len = 0;
fis = new FileInputStream(file);
while ((len = fis.read(buf)) > 0) {
baos.write(buf, 0, len);
}
return baos.toByteArray();
} finally {
try { if (fis != null) fis.close(); } catch (IOException foo) {}
}
// we won't ever get here
}
private static void writeFooter(OutputStream out) throws IOException {
// the css is hiding this div for now, but we'll keep it here anyway
out.write("<div class=\"proxyfooter\"><p><i>I2P HTTP Proxy Server<br>Generated on: ".getBytes());
out.write(new Date().toString().getBytes());
out.write("</i></div></body></html>\n".getBytes());
out.flush();
}
private static class OnTimeout implements Runnable { private static class OnTimeout implements Runnable {
private Socket _socket; private Socket _socket;
private OutputStream _out; private OutputStream _out;
@ -705,9 +749,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
out.write("\">http://".getBytes()); out.write("\">http://".getBytes());
out.write(uri.getBytes()); out.write(uri.getBytes());
out.write("</a>".getBytes()); out.write("</a>".getBytes());
if (usingWWWProxy) out.write(("<br />WWW proxy: " + wwwProxy).getBytes()); if (usingWWWProxy) out.write(("<br>WWW proxy: " + wwwProxy).getBytes());
if (showAddrHelper) { if (showAddrHelper) {
out.write("<br /><br />Click a link below to look for an address helper by using a \"jump\" service:<br />".getBytes()); // Fixme untranslated
out.write("<br><br>Click a link below to look for an address helper by using a \"jump\" service:<br>".getBytes());
for (int i = 0; i < jumpServers.length; i++) { for (int i = 0; i < jumpServers.length; i++) {
// Skip jump servers we don't know // Skip jump servers we don't know
String jumphost = jumpServers[i].substring(7); // "http://" String jumphost = jumpServers[i].substring(7); // "http://"
@ -719,7 +764,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
continue; continue;
} }
out.write("<br /><a href=\"".getBytes()); out.write("<br><a href=\"".getBytes());
out.write(jumpServers[i].getBytes()); out.write(jumpServers[i].getBytes());
out.write(uri.getBytes()); out.write(uri.getBytes());
out.write("\">".getBytes()); out.write("\">".getBytes());
@ -729,10 +774,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
} }
} }
} }
out.write("</div><div class=\"proxyfooter\"><p><i>I2P HTTP Proxy Server<br />Generated on: ".getBytes()); out.write("</div>".getBytes());
out.write(new Date().toString().getBytes()); writeFooter(out);
out.write("</i></div></body></html>\n".getBytes());
out.flush();
} }
} }
@ -744,16 +787,11 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
// _log.warn(getPrefix(requestId) + "Error sending to " + wwwProxy + " (proxy? " + usingWWWProxy + ", request: " + targetRequest, ex); // _log.warn(getPrefix(requestId) + "Error sending to " + wwwProxy + " (proxy? " + usingWWWProxy + ", request: " + targetRequest, ex);
if (out != null) { if (out != null) {
try { try {
String str;
byte[] header; byte[] header;
if (usingWWWProxy) if (usingWWWProxy)
str = FileUtil.readTextFile((new File(_errorDir, "dnfp-header.ht")).getAbsolutePath(), 100, true); header = getErrorPage(I2PAppContext.getGlobalContext(), "dnfp", ERR_DESTINATION_UNKNOWN);
else else
str = FileUtil.readTextFile((new File(_errorDir, "dnf-header.ht")).getAbsolutePath(), 100, true); header = getErrorPage(I2PAppContext.getGlobalContext(), "dnf", ERR_DESTINATION_UNKNOWN);
if (str != null)
header = str.getBytes();
else
header = ERR_DESTINATION_UNKNOWN;
writeErrorMessage(header, out, targetRequest, usingWWWProxy, wwwProxy, false); writeErrorMessage(header, out, targetRequest, usingWWWProxy, wwwProxy, false);
} catch (IOException ioe) { } catch (IOException ioe) {
// static // static

View File

@ -0,0 +1,17 @@
#
# Update messages_xx.po and messages_xx.class files,
# from both java and jsp sources.
# Requires installed programs xgettext, msgfmt, msgmerge, and find.
# zzz - public domain
#
## launching sh.exe with -login parameter will open a shell with the current path always pointing to \bin\
## need to cd into our orignal path - where we call sh.exe from.
cd $CALLFROM
## echo $PWD
## except this everything is the same with bundle-message.sh
## walking - public domain :-D
source bundle-messages.sh $PARAS

View File

@ -89,10 +89,28 @@
<!-- jar again to get the latest messages_*.class files --> <!-- jar again to get the latest messages_*.class files -->
<jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" /> <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
</target> </target>
<target name="poupdate" depends="compile">
<ant target="war" />
<!-- Update the messages_*.po files.
We need to supply the bat file for windows, and then change the fail property to true -->
<exec executable="sh" osfamily="unix" failifexecutionfails="true" >
<arg value="./bundle-messages.sh" />
<arg value="-p" />
</exec>
<exec executable="sh" osfamily="mac" failifexecutionfails="true" >
<arg value="./bundle-messages.sh" />
<arg value="-p" />
</exec>
<exec executable="cmd" osfamily="windows" failifexecutionfails="true" >
<arg value="/c" />
<arg value="bundle-messages.bat" />
<arg value="-p" />
</exec>
</target>
<target name="war" depends="precompilejsp"> <target name="war" depends="precompilejsp">
<!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ --> <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
<war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml" <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, web-fragment.xml"> basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, *.jsi, web-fragment.xml">
</war> </war>
</target> </target>
<target name="precompilejsp" unless="precompilejsp.uptodate"> <target name="precompilejsp" unless="precompilejsp.uptodate">
@ -101,7 +119,36 @@
<delete file="../jsp/web-out.xml" /> <delete file="../jsp/web-out.xml" />
<mkdir dir="../jsp/WEB-INF/" /> <mkdir dir="../jsp/WEB-INF/" />
<mkdir dir="../jsp/WEB-INF/classes" /> <mkdir dir="../jsp/WEB-INF/classes" />
<!-- there are various jspc ant tasks, but they all seem a bit flakey --> <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
<!--
** Usage: jspc <options> <jsp files>
** where jsp files is
** -webapp <dir> A directory containing a web-app, whose JSP pages
** will be processed recursively
** or any number of
** <file> A file to be parsed as a JSP page
** where options include:
** -help Print this help message
** -v Verbose mode
** -d <dir> Output Directory (default -Djava.io.tmpdir)
** -l Outputs the name of the JSP page upon failure
** -s Outputs the name of the JSP page upon success
** -p <name> Name of target package (default org.apache.jsp)
** -c <name> Name of target class name (only applies to first JSP page)
** -mapped Generates separate write() calls for each HTML line in the JSP
** -die[#] Generates an error return code (#) on fatal errors (default 1)
** -uribase <dir> The uri directory compilations should be relative to
** (default "/")
** -uriroot <dir> Same as -webapp
** -compile Compiles generated servlets
** -webinc <file> Creates a partial servlet mappings in the file
** -webxml <file> Creates a complete web.xml in the file
** -ieplugin <clsid> Java Plugin classid for Internet Explorer
** -classpath <path> Overrides java.class.path system property
** -xpoweredBy Add X-Powered-By response header
** -trimSpaces Trim spaces in template text between actions, directives
-->
<java classname="org.apache.jasper.JspC" fork="true" failonerror="true"> <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
<classpath> <classpath>
<pathelement location="../../jetty/jettylib/jasper-compiler.jar" /> <pathelement location="../../jetty/jettylib/jasper-compiler.jar" />

View File

@ -0,0 +1,26 @@
@echo off
set Callfrom=%cd%
set Paras=%1
rem before calling make sure you have msys and mingw 's "bin" path
rem in your current searching path
rem type "set path" to check
if not exist ..\locale\*.only goto updateALL
rem put a messages_xx.only(eg messages_zh.only) into locale folder
rem this script will only touch the po file(eg zh) you specified, leaving other po files untact.
for %%i in (..\locale\*.only) do set PO=%%~ni
echo [Notice] Yu choose to Ony update the choosen file: %PO%.po
for %%i in (..\locale\*.po) do if not %%~ni==%PO% ren %%i %%~ni.po-
call sh --login %cd%\bmsg.sh
for %%i in (..\locale\*.po-) do if not %%~ni==%PO% ren %%i %%~ni.po
goto end
:updateALL
call sh --login %cd%\bmsg.sh
:end
echo End of Message Bundling

View File

@ -2,65 +2,112 @@
# Update messages_xx.po and messages_xx.class files, # Update messages_xx.po and messages_xx.class files,
# from both java and jsp sources. # from both java and jsp sources.
# Requires installed programs xgettext, msgfmt, msgmerge, and find. # Requires installed programs xgettext, msgfmt, msgmerge, and find.
#
# usage:
# bundle-messages.sh (generates the resource bundle from the .po file)
# bundle-messages.sh -p (updates the .po file from the source tags, then generates the resource bundle)
#
# zzz - public domain # zzz - public domain
# #
CLASS=net.i2p.router.web.messages CLASS=net.i2p.router.web.messages
TMPFILE=build/javafiles.txt TMPFILE=build/javafiles.txt
export TZ=UTC export TZ=UTC
if [ "$1" = "-p" ]
then
POUPDATE=1
fi
#
# generate strings/Countries.java from ../../../installer/resources/countries.txt
#
CFILE=../../../installer/resources/countries.txt
# add ../java/ so the refs will work in the po file
JFILE=../java/build/Countries.java
if [ $CFILE -nt $JFILE -o ! -s $JFILE ]
then
mkdir -p build
echo '// Automatically generated pseudo-java for xgettext - do not edit' > $JFILE
echo '// Translators may wish to translate a few of these, do not bother to translate all of them!!' >> $JFILE
sed 's/..,\(..*\)/_("\1");/' $CFILE >> $JFILE
fi
# list specific files in router/ here, so we don't scan the whole tree
ROUTERFILES="\
../../../router/java/src/net/i2p/router/RouterThrottleImpl.java \
../../../router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java \
../../../router/java/src/net/i2p/router/transport/TransportManager.java \
../../../router/java/src/net/i2p/router/transport/GetBidsJob.java \
../../../router/java/src/net/i2p/router/Blocklist.java \
../../../router/java/src/net/i2p/router/transport/ntcp/EstablishState.java"
# add ../java/ so the refs will work in the po file
JPATHS="../java/src ../jsp/WEB-INF ../java/strings $JFILE $ROUTERFILES"
for i in ../locale/messages_*.po for i in ../locale/messages_*.po
do do
# get language # get language
LG=${i#../locale/messages_} LG=${i#../locale/messages_}
LG=${LG%.po} LG=${LG%.po}
# make list of java files newer than the .po file if [ "$POUPDATE" = "1" ]
find src ../jsp/WEB-INF -name *.java -newer $i > $TMPFILE then
if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a ! -s $TMPFILE ] # make list of java files newer than the .po file
find $JPATHS -name *.java -newer $i > $TMPFILE
fi
if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a \
build/obj/net/i2p/router/web/messages_$LG.class -nt $i -a \
! -s $TMPFILE ]
then then
continue continue
fi fi
echo "Generating ${CLASS}_$LG ResourceBundle..." if [ "$POUPDATE" = "1" ]
then
echo "Updating the $i file from the tags..."
# extract strings from java and jsp files, and update messages.po files
# translate calls must be one of the forms:
# _("foo")
# _x("foo")
# intl._("foo")
# intl.title("foo")
# handler._("foo")
# formhandler._("foo")
# net.i2p.router.web.Messages.getString("foo")
# In a jsp, you must use a helper or handler that has the context set.
# To start a new translation, copy the header from an old translation to the new .po file,
# then ant distclean updater.
find $JPATHS -name *.java > $TMPFILE
xgettext -f $TMPFILE -F -L java --from-code=UTF-8 \
--keyword=_ --keyword=_x --keyword=intl._ --keyword=intl.title \
--keyword=handler._ --keyword=formhandler._ \
--keyword=net.i2p.router.web.Messages.getString \
-o ${i}t
if [ $? -ne 0 ]
then
echo 'Warning - xgettext failed, not updating translations'
rm -f ${i}t
break
fi
msgmerge -U --backup=none $i ${i}t
if [ $? -ne 0 ]
then
echo 'Warning - msgmerge failed, not updating translations'
rm -f ${i}t
break
fi
rm -f ${i}t
# so we don't do this again
touch $i
fi
# extract strings from java and jsp files, and update messages.po files echo "Generating ${CLASS}_$LG ResourceBundle..."
# translate calls must be one of the forms:
# _("foo")
# _x("foo")
# cssHelper._("foo")
# cssHelper.title("foo")
# handler._("foo")
# formhandler._("foo")
# In a jsp, you must use a helper or handler that has the context set.
# To start a new translation, copy the header from an old translation to the new .po file,
# then ant distclean updater.
find src ../jsp/WEB-INF -name *.java > $TMPFILE
xgettext -f $TMPFILE -F -L java \
--keyword=_ --keyword=_x --keyword=cssHelper._ --keyword=cssHelper.title \
--keyword=handler._ --keyword=formhandler._ \
-o ${i}t
if [ $? -ne 0 ]
then
echo 'Warning - xgettext failed, not updating translations'
rm -f ${i}t
break
fi
msgmerge -U --backup=none $i ${i}t
if [ $? -ne 0 ]
then
echo 'Warning - msgmerge failed, not updating translations'
rm -f ${i}t
break
fi
rm -f ${i}t
# so we don't do this again
touch $i
# convert to class files in build/obj # convert to class files in build/obj
msgfmt --java -r $CLASS -l $LG -d build/obj $i msgfmt --java -r $CLASS -l $LG -d build/obj $i
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo 'Warning - xgettext failed, not updating translations' echo 'Warning - msgfmt failed, not updating translations'
break break
fi fi
done done

View File

@ -13,7 +13,7 @@ import java.util.Iterator;
* *
*/ */
public class ConfigAdvancedHandler extends FormHandler { public class ConfigAdvancedHandler extends FormHandler {
private boolean _forceRestart; //private boolean _forceRestart;
private boolean _shouldSave; private boolean _shouldSave;
private String _config; private String _config;
@ -27,7 +27,7 @@ public class ConfigAdvancedHandler extends FormHandler {
} }
public void setShouldsave(String moo) { _shouldSave = true; } public void setShouldsave(String moo) { _shouldSave = true; }
public void setRestart(String moo) { _forceRestart = true; } //public void setRestart(String moo) { _forceRestart = true; }
public void setConfig(String val) { public void setConfig(String val) {
_config = val; _config = val;
@ -54,7 +54,7 @@ public class ConfigAdvancedHandler extends FormHandler {
unsetKeys.remove(key); unsetKeys.remove(key);
} }
} catch (IOException ioe) { } catch (IOException ioe) {
addFormError("Error updating the configuration (IOERROR) - please see the error logs"); addFormError(_("Error updating the configuration - please see the error logs"));
return; return;
} }
@ -66,15 +66,15 @@ public class ConfigAdvancedHandler extends FormHandler {
boolean saved = _context.router().saveConfig(); boolean saved = _context.router().saveConfig();
if (saved) if (saved)
addFormNotice("Configuration saved successfully"); addFormNotice(_("Configuration saved successfully"));
else else
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs"); addFormNotice(_("Error saving the configuration (applied but not saved) - please see the error logs"));
if (_forceRestart) { //if (_forceRestart) {
addFormNotice("Performing a soft restart"); // addFormNotice("Performing a soft restart");
_context.router().restart(); // _context.router().restart();
addFormNotice("Soft restart complete"); // addFormNotice("Soft restart complete");
} //}
} }
} }
} }

View File

@ -29,11 +29,16 @@ public class ConfigClientsHandler extends FormHandler {
@Override @Override
protected void processForm() { protected void processForm() {
if (_action.startsWith("Save Client")) { if (_action.equals(_("Save Client Configuration"))) {
saveClientChanges(); saveClientChanges();
} else if (_action.startsWith("Save WebApp")) { return;
}
if (_action.equals(_("Save WebApp Configuration"))) {
saveWebAppChanges(); saveWebAppChanges();
} else if (_action.startsWith("Start ")) { return;
}
// value
if (_action.startsWith("Start ")) {
String app = _action.substring(6); String app = _action.substring(6);
int appnum = -1; int appnum = -1;
try { try {
@ -43,10 +48,14 @@ public class ConfigClientsHandler extends FormHandler {
startClient(appnum); startClient(appnum);
else else
startWebApp(app); startWebApp(app);
} else if (_action.toLowerCase().startsWith("start<span class=hide> ") && return;
}
// label (IE)
String xStart = _("Start");
if (_action.toLowerCase().startsWith(xStart + "<span class=hide> ") &&
_action.toLowerCase().endsWith("</span>")) { _action.toLowerCase().endsWith("</span>")) {
// IE sucks // IE sucks
String app = _action.substring(23, _action.length() - 7); String app = _action.substring(xStart.length() + 18, _action.length() - 7);
int appnum = -1; int appnum = -1;
try { try {
appnum = Integer.parseInt(app); appnum = Integer.parseInt(app);
@ -56,7 +65,7 @@ public class ConfigClientsHandler extends FormHandler {
else else
startWebApp(app); startWebApp(app);
} else { } else {
addFormError("Unsupported " + _action + "."); addFormError(_("Unsupported") + ' ' + _action + '.');
} }
} }
@ -67,22 +76,22 @@ public class ConfigClientsHandler extends FormHandler {
for (int cur = 0; cur < clients.size(); cur++) { for (int cur = 0; cur < clients.size(); cur++) {
ClientAppConfig ca = (ClientAppConfig) clients.get(cur); ClientAppConfig ca = (ClientAppConfig) clients.get(cur);
Object val = _settings.get(cur + ".enabled"); Object val = _settings.get(cur + ".enabled");
if (! "webConsole".equals(ca.clientName)) if (! ("webConsole".equals(ca.clientName) || "Web console".equals(ca.clientName)))
ca.disabled = val == null; ca.disabled = val == null;
} }
ClientAppConfig.writeClientAppConfig(_context, clients); ClientAppConfig.writeClientAppConfig(_context, clients);
addFormNotice("Client configuration saved successfully - restart required to take effect."); addFormNotice(_("Client configuration saved successfully - restart required to take effect."));
} }
private void startClient(int i) { private void startClient(int i) {
List clients = ClientAppConfig.getClientApps(_context); List clients = ClientAppConfig.getClientApps(_context);
if (i >= clients.size()) { if (i >= clients.size()) {
addFormError("Bad client index."); addFormError(_("Bad client index."));
return; return;
} }
ClientAppConfig ca = (ClientAppConfig) clients.get(i); ClientAppConfig ca = (ClientAppConfig) clients.get(i);
LoadClientAppsJob.runClient(ca.className, ca.clientName, LoadClientAppsJob.parseArgs(ca.args), configClient_log); LoadClientAppsJob.runClient(ca.className, ca.clientName, LoadClientAppsJob.parseArgs(ca.args), configClient_log);
addFormNotice("Client " + ca.clientName + " started."); addFormNotice(_("Client") + ' ' + _(ca.clientName) + ' ' + _("started") + '.');
} }
private void saveWebAppChanges() { private void saveWebAppChanges() {
@ -99,7 +108,7 @@ public class ConfigClientsHandler extends FormHandler {
props.setProperty(name, "" + (val != null)); props.setProperty(name, "" + (val != null));
} }
RouterConsoleRunner.storeWebAppProperties(props); RouterConsoleRunner.storeWebAppProperties(props);
addFormNotice("WebApp configuration saved successfully - restart required to take effect."); addFormNotice(_("WebApp configuration saved successfully - restart required to take effect."));
} }
// Big hack for the moment, not using properties for directory and port // Big hack for the moment, not using properties for directory and port
@ -117,14 +126,14 @@ public class ConfigClientsHandler extends FormHandler {
path = new File(path, app + ".war"); path = new File(path, app + ".war");
s.addWebApplication("/"+ app, path.getAbsolutePath()).start(); s.addWebApplication("/"+ app, path.getAbsolutePath()).start();
// no passwords... initialize(wac); // no passwords... initialize(wac);
addFormNotice("WebApp <a href=\"/" + app + "/\">" + app + "</a> started."); addFormNotice(_("WebApp") + " <a href=\"/" + app + "/\">" + _(app) + "</a> " + _("started") + '.');
} catch (Exception ioe) { } catch (Exception ioe) {
addFormError("Failed to start " + app + " " + ioe + "."); addFormError(_("Failed to start") + ' ' + _(app) + " " + ioe + '.');
} }
return; return;
} }
} }
} }
addFormError("Failed to find server."); addFormError(_("Failed to find server."));
} }
} }

View File

@ -14,12 +14,13 @@ public class ConfigClientsHelper extends HelperBase {
public String getForm1() { public String getForm1() {
StringBuilder buf = new StringBuilder(1024); StringBuilder buf = new StringBuilder(1024);
buf.append("<table>\n"); buf.append("<table>\n");
buf.append("<tr><th align=\"right\">Client</th><th>Run at Startup?</th><th>Start Now</th><th align=\"left\">Class and arguments</th></tr>\n"); buf.append("<tr><th align=\"right\">" + _("Client") + "</th><th>" + _("Run at Startup?") + "</th><th>" + _("Start Now") + "</th><th align=\"left\">" + _("Class and arguments") + "</th></tr>\n");
List clients = ClientAppConfig.getClientApps(_context); List clients = ClientAppConfig.getClientApps(_context);
for (int cur = 0; cur < clients.size(); cur++) { for (int cur = 0; cur < clients.size(); cur++) {
ClientAppConfig ca = (ClientAppConfig) clients.get(cur); ClientAppConfig ca = (ClientAppConfig) clients.get(cur);
renderForm(buf, ""+cur, ca.clientName, false, !ca.disabled, "webConsole".equals(ca.clientName), renderForm(buf, ""+cur, ca.clientName, false, !ca.disabled,
"webConsole".equals(ca.clientName) || "Web console".equals(ca.clientName),
ca.className + ((ca.args != null) ? " " + ca.args : "")); ca.className + ((ca.args != null) ? " " + ca.args : ""));
} }
@ -30,7 +31,7 @@ public class ConfigClientsHelper extends HelperBase {
public String getForm2() { public String getForm2() {
StringBuilder buf = new StringBuilder(1024); StringBuilder buf = new StringBuilder(1024);
buf.append("<table>\n"); buf.append("<table>\n");
buf.append("<tr><th align=\"right\">WebApp</th><th>Run at Startup?</th><th>Start Now</th><th align=\"left\">Description</th></tr>\n"); buf.append("<tr><th align=\"right\">" + _("WebApp") + "</th><th>" + _("Run at Startup?") + "</th><th>" + _("Start Now") + "</th><th align=\"left\">" + _("Description") + "</th></tr>\n");
Properties props = RouterConsoleRunner.webAppProperties(); Properties props = RouterConsoleRunner.webAppProperties();
Set keys = new TreeSet(props.keySet()); Set keys = new TreeSet(props.keySet());
for (Iterator iter = keys.iterator(); iter.hasNext(); ) { for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
@ -51,9 +52,9 @@ public class ConfigClientsHelper extends HelperBase {
String link = "/"; String link = "/";
if (! RouterConsoleRunner.ROUTERCONSOLE.equals(name)) if (! RouterConsoleRunner.ROUTERCONSOLE.equals(name))
link += name + "/"; link += name + "/";
buf.append("<a href=\"").append(link).append("\">").append(name).append("</a>"); buf.append("<a href=\"").append(link).append("\">").append(_(name)).append("</a>");
} else { } else {
buf.append(name); buf.append(_(name));
} }
buf.append("</td><td align=\"center\" width=\"10%\"><input type=\"checkbox\" class=\"optbox\" name=\"").append(index).append(".enabled\" value=\"true\" "); buf.append("</td><td align=\"center\" width=\"10%\"><input type=\"checkbox\" class=\"optbox\" name=\"").append(index).append(".enabled\" value=\"true\" ");
if (enabled) { if (enabled) {
@ -63,7 +64,7 @@ public class ConfigClientsHelper extends HelperBase {
} }
buf.append("/></td><td align=\"center\" width=\"15%\">"); buf.append("/></td><td align=\"center\" width=\"15%\">");
if (!enabled) { if (!enabled) {
buf.append("<button type=\"submit\" name=\"action\" value=\"Start ").append(index).append("\" >Start<span class=hide> ").append(index).append("</span></button>"); buf.append("<button type=\"submit\" name=\"action\" value=\"Start ").append(index).append("\" >" + _("Start") + "<span class=hide> ").append(index).append("</span></button>");
} }
buf.append("</td><td align=\"left\" width=\"50%\">").append(desc).append("</td></tr>\n"); buf.append("</td><td align=\"left\" width=\"50%\">").append(desc).append("</td></tr>\n");
} }

View File

@ -15,12 +15,12 @@ public class ConfigKeyringHandler extends FormHandler {
@Override @Override
protected void processForm() { protected void processForm() {
if (_action == null) return; if (_action == null) return;
boolean adding = _action.startsWith("Add"); boolean adding = _action.equals(_("Add key"));
if (adding || _action.startsWith("Delete")) { if (adding || _action.equals(_("Delete key"))) {
if (_peer == null) if (_peer == null)
addFormError("You must enter a destination"); addFormError(_("You must enter a destination"));
if (_key == null && adding) if (_key == null && adding)
addFormError("You must enter a key"); addFormError(_("You must enter a key"));
if (_peer == null || (_key == null && adding)) if (_peer == null || (_key == null && adding))
return; return;
Hash h = ConvertToHash.getHash(_peer); Hash h = ConvertToHash.getHash(_peer);
@ -31,22 +31,22 @@ public class ConfigKeyringHandler extends FormHandler {
} catch (DataFormatException dfe) {} } catch (DataFormatException dfe) {}
if (h != null && h.getData() != null && sk.getData() != null) { if (h != null && h.getData() != null && sk.getData() != null) {
_context.keyRing().put(h, sk); _context.keyRing().put(h, sk);
addFormNotice("Key for " + h.toBase64() + " added to keyring"); addFormNotice(_("Key for") + " " + h.toBase64() + " " + _("added to keyring"));
} else { } else {
addFormError("Invalid destination or key"); addFormError(_("Invalid destination or key"));
} }
} else { // Delete } else { // Delete
if (h != null && h.getData() != null) { if (h != null && h.getData() != null) {
if (_context.keyRing().remove(h) != null) if (_context.keyRing().remove(h) != null)
addFormNotice("Key for " + h.toBase64() + " removed from keyring"); addFormNotice(_("Key for") + " " + h.toBase64() + " " + _("removed from keyring"));
else else
addFormNotice("Key for " + h.toBase64() + " not found in keyring"); addFormNotice(_("Key for") + " " + h.toBase64() + " " + _("not found in keyring"));
} else { } else {
addFormError("Invalid destination"); addFormError(_("Invalid destination"));
} }
} }
} else { } else {
addFormError("Unsupported"); addFormError(_("Unsupported"));
} }
} }

View File

@ -36,7 +36,7 @@ public class ConfigLoggingHelper extends HelperBase {
sortedLogs.add(prefix); sortedLogs.add(prefix);
} }
buf.append("<textarea name=\"levels\" rows=\"4\" cols=\"60\">"); buf.append("<textarea name=\"levels\" rows=\"4\" cols=\"60\" wrap=\"off\">");
for (Iterator iter = sortedLogs.iterator(); iter.hasNext(); ) { for (Iterator iter = sortedLogs.iterator(); iter.hasNext(); ) {
String prefix = (String)iter.next(); String prefix = (String)iter.next();
String level = limits.getProperty(prefix); String level = limits.getProperty(prefix);
@ -48,30 +48,21 @@ public class ConfigLoggingHelper extends HelperBase {
buf.append("<i>Valid levels are DEBUG, INFO, WARN, ERROR, CRIT</i>\n"); buf.append("<i>Valid levels are DEBUG, INFO, WARN, ERROR, CRIT</i>\n");
return buf.toString(); return buf.toString();
} }
private static String[] levels = { _x("CRIT"), _x("ERROR"), _x("WARN"), _x("INFO"), _x("DEBUG") };
public String getDefaultLogLevelBox() { public String getDefaultLogLevelBox() {
String cur = _context.logManager().getDefaultLimit(); String cur = _context.logManager().getDefaultLimit();
StringBuilder buf = new StringBuilder(128); StringBuilder buf = new StringBuilder(128);
buf.append("<select name=\"defaultloglevel\">\n"); buf.append("<select name=\"defaultloglevel\">\n");
buf.append("<option value=\"DEBUG\" "); for (int i = 0; i < levels.length; i++) {
if ("DEBUG".equals(cur)) buf.append(" selected=\"true\" "); String l = levels[i];
buf.append(">DEBUG</option>\n"); buf.append("<option value=\"").append(l).append("\" ");
if (l.equals(cur))
buf.append("<option value=\"INFO\" "); buf.append(" selected=\"true\" ");
if ("INFO".equals(cur)) buf.append(" selected=\"true\" "); buf.append('>').append(_(l)).append("</option>\n");
buf.append(">INFO</option>\n"); }
buf.append("<option value=\"WARN\" ");
if ("WARN".equals(cur)) buf.append(" selected=\"true\" ");
buf.append(">WARN</option>\n");
buf.append("<option value=\"ERROR\" ");
if ("ERROR".equals(cur)) buf.append(" selected=\"true\" ");
buf.append(">ERROR</option>\n");
buf.append("<option value=\"CRIT\" ");
if ("CRIT".equals(cur)) buf.append(" selected=\"true\" ");
buf.append(">CRIT</option>\n");
buf.append("</select>\n"); buf.append("</select>\n");
return buf.toString(); return buf.toString();

View File

@ -44,7 +44,7 @@ public class ConfigNetHandler extends FormHandler {
@Override @Override
protected void processForm() { protected void processForm() {
if (_saveRequested || ( (_action != null) && ("Save changes".equals(_action)) )) { if (_saveRequested || ( (_action != null) && (_("Save changes").equals(_action)) )) {
saveChanges(); saveChanges();
} else if (_recheckReachabilityRequested) { } else if (_recheckReachabilityRequested) {
recheckReachability(); recheckReachability();
@ -116,7 +116,7 @@ public class ConfigNetHandler extends FormHandler {
private void recheckReachability() { private void recheckReachability() {
_context.commSystem().recheckReachability(); _context.commSystem().recheckReachability();
addFormNotice("Rechecking router reachability..."); addFormNotice(_("Rechecking router reachability..."));
} }
/** /**
@ -145,7 +145,7 @@ public class ConfigNetHandler extends FormHandler {
// Todo: Catch local IPs right here rather than complaining later // Todo: Catch local IPs right here rather than complaining later
_context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_HOST, uhost); _context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_HOST, uhost);
if ((!oldUdp.equals(_udpAutoIP)) || (!oldUHost.equals(uhost))) { if ((!oldUdp.equals(_udpAutoIP)) || (!oldUHost.equals(uhost))) {
addFormNotice("Updating IP address"); addFormNotice(_("Updating IP address"));
restartRequired = true; restartRequired = true;
} }
} }
@ -163,17 +163,17 @@ public class ConfigNetHandler extends FormHandler {
if ((!oldAutoHost.equals(_ntcpAutoIP)) || ! oldNHost.equalsIgnoreCase(_ntcpHostname)) { if ((!oldAutoHost.equals(_ntcpAutoIP)) || ! oldNHost.equalsIgnoreCase(_ntcpHostname)) {
if ("disabled".equals(_ntcpAutoIP)) { if ("disabled".equals(_ntcpAutoIP)) {
addFormNotice("Disabling TCP completely"); addFormNotice(_("Disabling TCP completely"));
} else if ("false".equals(_ntcpAutoIP) && _ntcpHostname.length() > 0) { } else if ("false".equals(_ntcpAutoIP) && _ntcpHostname.length() > 0) {
// Todo: Catch local IPs right here rather than complaining later // Todo: Catch local IPs right here rather than complaining later
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME, _ntcpHostname); _context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME, _ntcpHostname);
addFormNotice("Updating inbound TCP address to " + _ntcpHostname); addFormNotice(_("Updating inbound TCP address to") + " " + _ntcpHostname);
} else { } else {
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME); _context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME);
if ("false".equals(_ntcpAutoIP)) if ("false".equals(_ntcpAutoIP))
addFormNotice("Disabling inbound TCP"); addFormNotice(_("Disabling inbound TCP"));
else else
addFormNotice("Updating inbound TCP address to auto"); // true or always addFormNotice(_("Updating inbound TCP address to auto")); // true or always
} }
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, _ntcpAutoIP); _context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, _ntcpAutoIP);
_context.router().setConfigSetting(TransportManager.PROP_ENABLE_NTCP, "" + !"disabled".equals(_ntcpAutoIP)); _context.router().setConfigSetting(TransportManager.PROP_ENABLE_NTCP, "" + !"disabled".equals(_ntcpAutoIP));
@ -182,10 +182,10 @@ public class ConfigNetHandler extends FormHandler {
if (oldAutoPort != _ntcpAutoPort || ! oldNPort.equals(_ntcpPort)) { if (oldAutoPort != _ntcpAutoPort || ! oldNPort.equals(_ntcpPort)) {
if (_ntcpPort.length() > 0 && !_ntcpAutoPort) { if (_ntcpPort.length() > 0 && !_ntcpAutoPort) {
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT, _ntcpPort); _context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT, _ntcpPort);
addFormNotice("Updating inbound TCP port to " + _ntcpPort); addFormNotice(_("Updating inbound TCP port to") + " " + _ntcpPort);
} else { } else {
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT); _context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
addFormNotice("Updating inbound TCP port to auto"); addFormNotice(_("Updating inbound TCP port to auto"));
} }
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "" + _ntcpAutoPort); _context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "" + _ntcpAutoPort);
restartRequired = true; restartRequired = true;
@ -197,7 +197,7 @@ public class ConfigNetHandler extends FormHandler {
if (!oldPort.equals(_udpPort)) { if (!oldPort.equals(_udpPort)) {
_context.router().setConfigSetting(UDPTransport.PROP_INTERNAL_PORT, _udpPort); _context.router().setConfigSetting(UDPTransport.PROP_INTERNAL_PORT, _udpPort);
_context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_PORT, _udpPort); _context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_PORT, _udpPort);
addFormNotice("Updating UDP port from " + oldPort + " to " + _udpPort); addFormNotice(_("Updating UDP port from") + " " + oldPort + " " + _("to") + " " + _udpPort);
restartRequired = true; restartRequired = true;
} }
} }
@ -213,9 +213,9 @@ public class ConfigNetHandler extends FormHandler {
if (switchRequired) { if (switchRequired) {
_context.router().setConfigSetting(PROP_HIDDEN, "" + _hiddenMode); _context.router().setConfigSetting(PROP_HIDDEN, "" + _hiddenMode);
if (_hiddenMode) if (_hiddenMode)
addFormError("Gracefully restarting into Hidden Router Mode"); addFormError(_("Gracefully restarting into Hidden Router Mode"));
else else
addFormError("Gracefully restarting to exit Hidden Router Mode"); addFormError(_("Gracefully restarting to exit Hidden Router Mode"));
} }
_context.router().setConfigSetting(Router.PROP_DYNAMIC_KEYS, "" + _dynamicKeys); _context.router().setConfigSetting(Router.PROP_DYNAMIC_KEYS, "" + _dynamicKeys);
@ -224,15 +224,15 @@ public class ConfigNetHandler extends FormHandler {
_upnp) { _upnp) {
// This is minor, don't set restartRequired // This is minor, don't set restartRequired
if (_upnp) if (_upnp)
addFormNotice("Enabling UPnP, restart required to take effect"); addFormNotice(_("Enabling UPnP, restart required to take effect"));
else else
addFormNotice("Disabling UPnP, restart required to take effect"); addFormNotice(_("Disabling UPnP, restart required to take effect"));
} }
_context.router().setConfigSetting(TransportManager.PROP_ENABLE_UPNP, "" + _upnp); _context.router().setConfigSetting(TransportManager.PROP_ENABLE_UPNP, "" + _upnp);
if (_requireIntroductions) { if (_requireIntroductions) {
_context.router().setConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS, "true"); _context.router().setConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS, "true");
addFormNotice("Requiring SSU introduers"); addFormNotice(_("Requiring SSU introduers"));
} else { } else {
_context.router().removeConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS); _context.router().removeConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS);
} }
@ -246,11 +246,11 @@ public class ConfigNetHandler extends FormHandler {
} }
boolean saved = _context.router().saveConfig(); boolean saved = _context.router().saveConfig();
if ( (_action != null) && ("Save changes".equals(_action)) ) { if ( (_action != null) && (_("Save changes").equals(_action)) ) {
if (saved) if (saved)
addFormNotice("Configuration saved successfully"); addFormNotice(_("Configuration saved successfully"));
else else
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs"); addFormNotice(_("Error saving the configuration (applied but not saved) - please see the error logs"));
} }
if (switchRequired) { if (switchRequired) {
@ -272,7 +272,7 @@ public class ConfigNetHandler extends FormHandler {
// There's a few changes that don't really require restart (e.g. enabling inbound TCP) // There's a few changes that don't really require restart (e.g. enabling inbound TCP)
// But it would be hard to get right, so just do a restart. // But it would be hard to get right, so just do a restart.
addFormError("Gracefully restarting I2P to change published router address"); addFormError(_("Gracefully restarting I2P to change published router address"));
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART); _context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
} }
} }
@ -290,7 +290,7 @@ public class ConfigNetHandler extends FormHandler {
String old = _context.router().getConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE); String old = _context.router().getConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE);
if ( (old == null) || (!old.equalsIgnoreCase(_sharePct)) ) { if ( (old == null) || (!old.equalsIgnoreCase(_sharePct)) ) {
_context.router().setConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE, _sharePct); _context.router().setConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE, _sharePct);
addFormNotice("Updating bandwidth share percentage"); addFormNotice(_("Updating bandwidth share percentage"));
updated = true; updated = true;
} }
} }
@ -360,7 +360,7 @@ public class ConfigNetHandler extends FormHandler {
if (updated && !_ratesOnly) { if (updated && !_ratesOnly) {
_context.bandwidthLimiter().reinitialize(); _context.bandwidthLimiter().reinitialize();
addFormNotice("Updated bandwidth limits"); addFormNotice(_("Updated bandwidth limits"));
} }
} }
} }

View File

@ -36,7 +36,7 @@ public class ConfigNetHelper extends HelperBase {
public String getUdpAddress() { public String getUdpAddress() {
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU"); RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
if (addr == null) if (addr == null)
return "unknown"; return _("unknown");
UDPAddress ua = new UDPAddress(addr); UDPAddress ua = new UDPAddress(addr);
return ua.toString(); return ua.toString();
} }
@ -44,20 +44,20 @@ public class ConfigNetHelper extends HelperBase {
public String getUdpIP() { public String getUdpIP() {
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU"); RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
if (addr == null) if (addr == null)
return "unknown"; return _("unknown");
UDPAddress ua = new UDPAddress(addr); UDPAddress ua = new UDPAddress(addr);
if (ua.getHost() == null) if (ua.getHost() == null)
return "unknown"; return _("unknown");
return ua.getHost(); return ua.getHost();
} }
public String getUdpPort() { public String getUdpPort() {
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU"); RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
if (addr == null) if (addr == null)
return "unknown"; return _("unknown");
UDPAddress ua = new UDPAddress(addr); UDPAddress ua = new UDPAddress(addr);
if (ua.getPort() <= 0) if (ua.getPort() <= 0)
return "unknown"; return _("unknown");
return "" + ua.getPort(); return "" + ua.getPort();
} }
@ -162,7 +162,7 @@ public class ConfigNetHelper extends HelperBase {
return kbytesToBits(getShareBandwidth()); return kbytesToBits(getShareBandwidth());
} }
private String kbytesToBits(int kbytes) { private String kbytesToBits(int kbytes) {
return DataHelper.formatSize(kbytes * 8 * 1024) + " bits per second"; return DataHelper.formatSize(kbytes * 8 * 1024) + ' ' + _("bits per second");
} }
public String getInboundBurstRate() { public String getInboundBurstRate() {
return "" + _context.bandwidthLimiter().getInboundBurstKBytesPerSecond(); return "" + _context.bandwidthLimiter().getInboundBurstKBytesPerSecond();

View File

@ -17,26 +17,26 @@ public class ConfigPeerHandler extends FormHandler {
if ("Save Configuration".equals(_action)) { if ("Save Configuration".equals(_action)) {
_context.router().saveConfig(); _context.router().saveConfig();
addFormNotice("Settings saved - not really!!!!!"); addFormNotice("Settings saved - not really!!!!!");
} else if (_action.startsWith("Ban")) { } else if (_action.equals(_("Ban peer until restart"))) {
Hash h = getHash(); Hash h = getHash();
if (h != null) { if (h != null) {
_context.shitlist().shitlistRouterForever(h, "Manually banned via <a href=\"configpeer.jsp\">configpeer.jsp</a>"); _context.shitlist().shitlistRouterForever(h, _("Manually banned via {0}"), "<a href=\"configpeer.jsp\">configpeer.jsp</a>");
addFormNotice("Peer " + _peer + " banned until restart"); addFormNotice(_("Peer") + " " + _peer + " " + _("banned until restart") );
return; return;
} }
addFormError("Invalid peer"); addFormError(_("Invalid peer"));
} else if (_action.startsWith("Unban")) { } else if (_action.equals(_("Unban peer"))) {
Hash h = getHash(); Hash h = getHash();
if (h != null) { if (h != null) {
if (_context.shitlist().isShitlisted(h)) { if (_context.shitlist().isShitlisted(h)) {
_context.shitlist().unshitlistRouter(h); _context.shitlist().unshitlistRouter(h);
addFormNotice("Peer " + _peer + " unbanned"); addFormNotice(_("Peer") + " " + _peer + " " + _("unbanned") );
} else } else
addFormNotice("Peer " + _peer + " is not currently banned"); addFormNotice(_("Peer") + " " + _peer + " " + _("is not currently banned") );
return; return;
} }
addFormError("Invalid peer"); addFormError(_("Invalid peer"));
} else if (_action.startsWith("Adjust")) { } else if (_action.equals(_("Adjust Profile Bonuses"))) {
Hash h = getHash(); Hash h = getHash();
if (h != null) { if (h != null) {
PeerProfile prof = _context.profileOrganizer().getProfile(h); PeerProfile prof = _context.profileOrganizer().getProfile(h);
@ -44,19 +44,19 @@ public class ConfigPeerHandler extends FormHandler {
try { try {
prof.setSpeedBonus(Long.parseLong(_speed)); prof.setSpeedBonus(Long.parseLong(_speed));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
addFormError("Bad speed value"); addFormError(_("Bad speed value"));
} }
try { try {
prof.setCapacityBonus(Long.parseLong(_capacity)); prof.setCapacityBonus(Long.parseLong(_capacity));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
addFormError("Bad capacity value"); addFormError(_("Bad capacity value"));
} }
addFormNotice("Bonuses adjusted for " + _peer); addFormNotice("Bonuses adjusted for " + _peer);
} else } else
addFormError("No profile exists for " + _peer); addFormError("No profile exists for " + _peer);
return; return;
} }
addFormError("Invalid peer"); addFormError(_("Invalid peer"));
} else if (_action.startsWith("Check")) { } else if (_action.startsWith("Check")) {
addFormError("Unsupported"); addFormError("Unsupported");
} }

View File

@ -1,7 +1,5 @@
package net.i2p.router.web; package net.i2p.router.web;
import java.util.StringTokenizer;
import net.i2p.data.DataHelper; import net.i2p.data.DataHelper;
import net.i2p.router.Router; import net.i2p.router.Router;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
@ -11,6 +9,12 @@ import net.i2p.router.RouterContext;
* *
*/ */
public class ConfigRestartBean { public class ConfigRestartBean {
/** all these are tagged below so no need to _x them here */
static final String[] SET1 = {"shutdownImmediate", "Shutdown immediately", "cancelShutdown", "Cancel shutdown"};
static final String[] SET2 = {"restartImmediate", "Restart immediately", "cancelShutdown", "Cancel restart"};
static final String[] SET3 = {"restart", "Restart", "shutdown", "Shutdown"};
static final String[] SET4 = {"shutdown", "Shutdown"};
public static String getNonce() { public static String getNonce() {
RouterContext ctx = ContextHelper.getContext(null); RouterContext ctx = ContextHelper.getContext(null);
String nonce = System.getProperty("console.nonce"); String nonce = System.getProperty("console.nonce");
@ -25,20 +29,21 @@ public class ConfigRestartBean {
String systemNonce = getNonce(); String systemNonce = getNonce();
if ( (nonce != null) && (systemNonce.equals(nonce)) && (action != null) ) { if ( (nonce != null) && (systemNonce.equals(nonce)) && (action != null) ) {
// Normal browsers send value, IE sends button label // Normal browsers send value, IE sends button label
if ("shutdownImmediate".equals(action) || "Shutdown immediately".equals(action)) { if ("shutdownImmediate".equals(action) || _("Shutdown immediately", ctx).equals(action)) {
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD)); ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD));
//ctx.router().shutdown(Router.EXIT_HARD); // never returns //ctx.router().shutdown(Router.EXIT_HARD); // never returns
ctx.router().shutdownGracefully(Router.EXIT_HARD); // give the UI time to respond ctx.router().shutdownGracefully(Router.EXIT_HARD); // give the UI time to respond
} else if ("cancelShutdown".equals(action) || "Cancel shutdown".equals(action)) { } else if ("cancelShutdown".equals(action) || _("Cancel shutdown", ctx).equals(action) ||
_("Cancel restart", ctx).equals(action)) {
ctx.router().cancelGracefulShutdown(); ctx.router().cancelGracefulShutdown();
} else if ("restartImmediate".equals(action) || "Restart immediately".equals(action)) { } else if ("restartImmediate".equals(action) || _("Restart immediately", ctx).equals(action)) {
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART)); ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART));
//ctx.router().shutdown(Router.EXIT_HARD_RESTART); // never returns //ctx.router().shutdown(Router.EXIT_HARD_RESTART); // never returns
ctx.router().shutdownGracefully(Router.EXIT_HARD_RESTART); // give the UI time to respond ctx.router().shutdownGracefully(Router.EXIT_HARD_RESTART); // give the UI time to respond
} else if ("restart".equalsIgnoreCase(action)) { } else if ("restart".equals(action) || _("Restart", ctx).equals(action)) {
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART)); ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART));
ctx.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART); ctx.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
} else if ("shutdown".equalsIgnoreCase(action)) { } else if ("shutdown".equals(action) || _("Shutdown", ctx).equals(action)) {
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL)); ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL));
ctx.router().shutdownGracefully(); ctx.router().shutdownGracefully();
} }
@ -47,38 +52,35 @@ public class ConfigRestartBean {
boolean shuttingDown = isShuttingDown(ctx); boolean shuttingDown = isShuttingDown(ctx);
boolean restarting = isRestarting(ctx); boolean restarting = isRestarting(ctx);
long timeRemaining = ctx.router().getShutdownTimeRemaining(); long timeRemaining = ctx.router().getShutdownTimeRemaining();
if (shuttingDown) { StringBuilder buf = new StringBuilder(128);
if (timeRemaining <= 0) { if ((shuttingDown || restarting) && timeRemaining <= 0) {
return "<center><b>Shutdown imminent</b></center>"; buf.append("<center><b>").append(_("Shutdown imminent", ctx)).append("</b></center>");
} else { } else if (shuttingDown) {
return "<center><b>Shutdown in " + DataHelper.formatDuration(timeRemaining) + "</b></center><br>" buf.append("<center><b>");
+ buttons(urlBase, systemNonce, "shutdownImmediate,Shutdown immediately,cancelShutdown,Cancel shutdown"); buf.append(_("Shutdown in {0}", DataHelper.formatDuration(timeRemaining), ctx));
} buf.append("</b></center><br>");
buttons(ctx, buf, urlBase, systemNonce, SET1);
} else if (restarting) { } else if (restarting) {
if (timeRemaining <= 0) { buf.append("<center><b>");
return "<center><b>Restart imminent</b></center>"; buf.append(_("Restart in {0}", DataHelper.formatDuration(timeRemaining), ctx));
} else { buf.append("</b></center><br>");
return "<center><b>Restart in " + DataHelper.formatDuration(timeRemaining) + "</b></center><br>" buttons(ctx, buf, urlBase, systemNonce, SET2);
+ buttons(urlBase, systemNonce, "restartImmediate,Restart immediately,cancelShutdown,Cancel restart");
}
} else { } else {
if (System.getProperty("wrapper.version") != null) if (System.getProperty("wrapper.version") != null)
return buttons(urlBase, systemNonce, "restart,Restart,shutdown,Shutdown"); buttons(ctx, buf, urlBase, systemNonce, SET3);
else else
return buttons(urlBase, systemNonce, "shutdown,Shutdown"); buttons(ctx, buf, urlBase, systemNonce, SET4);
} }
return buf.toString();
} }
/** @param s value,label,... pairs */ /** @param s value,label,... pairs */
private static String buttons(String url, String nonce, String s) { private static void buttons(RouterContext ctx, StringBuilder buf, String url, String nonce, String[] s) {
StringBuilder buf = new StringBuilder(128);
StringTokenizer tok = new StringTokenizer(s, ",");
buf.append("<form action=\"").append(url).append("\" method=\"GET\">\n"); buf.append("<form action=\"").append(url).append("\" method=\"GET\">\n");
buf.append("<input type=\"hidden\" name=\"consoleNonce\" value=\"").append(nonce).append("\" >\n"); buf.append("<input type=\"hidden\" name=\"consoleNonce\" value=\"").append(nonce).append("\" >\n");
while (tok.hasMoreTokens()) for (int i = 0; i < s.length; i+= 2)
buf.append("<button type=\"submit\" name=\"action\" value=\"").append(tok.nextToken()).append("\" >").append(tok.nextToken()).append("</button>\n"); buf.append("<button type=\"submit\" name=\"action\" value=\"").append(s[i]).append("\" >").append(_(s[i+1], ctx)).append("</button>\n");
buf.append("</form>\n"); buf.append("</form>\n");
return buf.toString();
} }
private static boolean isShuttingDown(RouterContext ctx) { private static boolean isShuttingDown(RouterContext ctx) {
@ -96,4 +98,13 @@ public class ConfigRestartBean {
return ctx.router().getShutdownTimeRemaining(); return ctx.router().getShutdownTimeRemaining();
return Long.MAX_VALUE/2; // summaryframe.jsp adds a safety factor so we don't want to overflow... return Long.MAX_VALUE/2; // summaryframe.jsp adds a safety factor so we don't want to overflow...
} }
private static String _(String s, RouterContext ctx) {
return Messages.getString(s, ctx);
}
private static String _(String s, Object o, RouterContext ctx) {
return Messages.getString(s, o, ctx);
}
} }

View File

@ -50,74 +50,74 @@ public class ConfigServiceHandler extends FormHandler {
protected void processForm() { protected void processForm() {
if (_action == null) return; if (_action == null) return;
if ("Shutdown gracefully".equals(_action)) { if (_("Shutdown gracefully").equals(_action)) {
_context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_GRACEFUL)); _context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_GRACEFUL));
_context.router().shutdownGracefully(); _context.router().shutdownGracefully();
addFormNotice("Graceful shutdown initiated"); addFormNotice(_("Graceful shutdown initiated"));
} else if ("Shutdown immediately".equals(_action)) { } else if (_("Shutdown immediately").equals(_action)) {
_context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_HARD)); _context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_HARD));
_context.router().shutdown(Router.EXIT_HARD); _context.router().shutdown(Router.EXIT_HARD);
addFormNotice("Shutdown immediately! boom bye bye bad bwoy"); addFormNotice(_("Shutdown immediately! boom bye bye bad bwoy"));
} else if ("Cancel graceful shutdown".equals(_action)) { } else if (_("Cancel graceful shutdown").equals(_action)) {
_context.router().cancelGracefulShutdown(); _context.router().cancelGracefulShutdown();
addFormNotice("Graceful shutdown cancelled"); addFormNotice(_("Graceful shutdown cancelled"));
} else if ("Graceful restart".equals(_action)) { } else if (_("Graceful restart").equals(_action)) {
_context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART)); _context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART));
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART); _context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
addFormNotice("Graceful restart requested"); addFormNotice(_("Graceful restart requested"));
} else if ("Hard restart".equals(_action)) { } else if (_("Hard restart").equals(_action)) {
_context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART)); _context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART));
_context.router().shutdown(Router.EXIT_HARD_RESTART); _context.router().shutdown(Router.EXIT_HARD_RESTART);
addFormNotice("Hard restart requested"); addFormNotice(_("Hard restart requested"));
} else if ("Rekey and Restart".equals(_action)) { } else if (_("Rekey and Restart").equals(_action)) {
addFormNotice("Rekeying after graceful restart"); addFormNotice(_("Rekeying after graceful restart"));
_context.addShutdownTask(new UpdateWrapperManagerAndRekeyTask(Router.EXIT_GRACEFUL_RESTART)); _context.addShutdownTask(new UpdateWrapperManagerAndRekeyTask(Router.EXIT_GRACEFUL_RESTART));
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART); _context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
} else if ("Rekey and Shutdown".equals(_action)) { } else if (_("Rekey and Shutdown").equals(_action)) {
addFormNotice("Rekeying after graceful shutdown"); addFormNotice(_("Rekeying after graceful shutdown"));
_context.addShutdownTask(new UpdateWrapperManagerAndRekeyTask(Router.EXIT_GRACEFUL)); _context.addShutdownTask(new UpdateWrapperManagerAndRekeyTask(Router.EXIT_GRACEFUL));
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL); _context.router().shutdownGracefully(Router.EXIT_GRACEFUL);
} else if ("Run I2P on startup".equals(_action)) { } else if (_("Run I2P on startup").equals(_action)) {
installService(); installService();
} else if ("Don't run I2P on startup".equals(_action)) { } else if (_("Don't run I2P on startup").equals(_action)) {
uninstallService(); uninstallService();
} else if ("Dump threads".equals(_action)) { } else if (_("Dump threads").equals(_action)) {
try { try {
WrapperManager.requestThreadDump(); WrapperManager.requestThreadDump();
} catch (Throwable t) { } catch (Throwable t) {
addFormError("Warning: unable to contact the service manager - " + t.getMessage()); addFormError("Warning: unable to contact the service manager - " + t.getMessage());
} }
addFormNotice("Threads dumped to wrapper.log"); addFormNotice("Threads dumped to wrapper.log");
} else if ("Show systray icon".equals(_action)) { } else if (_("Show systray icon").equals(_action)) {
try { try {
SysTray tray = SysTray.getInstance(); SysTray tray = SysTray.getInstance();
if (tray != null) { if (tray != null) {
tray.show(); tray.show();
addFormNotice("System tray icon enabled."); addFormNotice(_("System tray icon enabled."));
} else { } else {
addFormNotice("System tray icon feature not supported on this platform. Sorry!"); addFormNotice(_("System tray icon feature not supported on this platform. Sorry!"));
} }
} catch (Throwable t) { } catch (Throwable t) {
addFormError("Warning: unable to contact the systray manager - " + t.getMessage()); addFormError(_("Warning: unable to contact the systray manager") + " - " + t.getMessage());
} }
} else if ("Hide systray icon".equals(_action)) { } else if (_("Hide systray icon").equals(_action)) {
try { try {
SysTray tray = SysTray.getInstance(); SysTray tray = SysTray.getInstance();
if (tray != null) { if (tray != null) {
tray.hide(); tray.hide();
addFormNotice("System tray icon disabled."); addFormNotice(_("System tray icon disabled."));
} else { } else {
addFormNotice("System tray icon feature not supported on this platform. Sorry!"); addFormNotice(_("System tray icon feature not supported on this platform. Sorry!"));
} }
} catch (Throwable t) { } catch (Throwable t) {
addFormError("Warning: unable to contact the systray manager - " + t.getMessage()); addFormError(_("Warning: unable to contact the systray manager") + " - " + t.getMessage());
} }
} else if ("View console on startup".equals(_action)) { } else if (_("View console on startup").equals(_action)) {
browseOnStartup(true); browseOnStartup(true);
addFormNotice("Console is to be shown on startup"); addFormNotice(_("Console is to be shown on startup"));
} else if ("Do not view console on startup".equals(_action)) { } else if (_("Do not view console on startup").equals(_action)) {
browseOnStartup(false); browseOnStartup(false);
addFormNotice("Console is not to be shown on startup"); addFormNotice(_("Console is not to be shown on startup"));
} else { } else {
//addFormNotice("Blah blah blah. whatever. I'm not going to " + _action); //addFormNotice("Blah blah blah. whatever. I'm not going to " + _action);
} }
@ -126,17 +126,17 @@ public class ConfigServiceHandler extends FormHandler {
private void installService() { private void installService() {
try { try {
Runtime.getRuntime().exec("install_i2p_service_winnt.bat"); Runtime.getRuntime().exec("install_i2p_service_winnt.bat");
addFormNotice("Service installed"); addFormNotice(_("Service installed"));
} catch (IOException ioe) { } catch (IOException ioe) {
addFormError("Warning: unable to install the service - " + ioe.getMessage()); addFormError(_("Warning: unable to install the service") + " - " + ioe.getMessage());
} }
} }
private void uninstallService() { private void uninstallService() {
try { try {
Runtime.getRuntime().exec("uninstall_i2p_service_winnt.bat"); Runtime.getRuntime().exec("uninstall_i2p_service_winnt.bat");
addFormNotice("Service removed"); addFormNotice(_("Service removed"));
} catch (IOException ioe) { } catch (IOException ioe) {
addFormError("Warning: unable to remove the service - " + ioe.getMessage()); addFormError(_("Warning: unable to remove the service") + " - " + ioe.getMessage());
} }
} }

View File

@ -115,10 +115,10 @@ public class ConfigStatsHandler extends FormHandler {
_context.router().setConfigSetting(StatManager.PROP_STAT_FULL, "" + _isFull); _context.router().setConfigSetting(StatManager.PROP_STAT_FULL, "" + _isFull);
boolean ok = _context.router().saveConfig(); boolean ok = _context.router().saveConfig();
if (ok) if (ok)
addFormNotice("Stat filter and location updated successfully to: " + stats.toString()); addFormNotice(_("Stat filter and location updated successfully to") + ": " + stats.toString());
else else
addFormError("Failed to update the stat filter and location"); addFormError(_("Failed to update the stat filter and location"));
addFormNotice("Graph list updated, may take up to 60s to be reflected here and on the <a href=\"graphs.jsp\">Graphs Page</a>"); addFormNotice(_("Graph list updated, may take up to 60s to be reflected here and on the <a href=\"graphs.jsp\">Graphs Page</a>"));
} }
} }

View File

@ -32,7 +32,7 @@ public class ConfigTunnelsHandler extends FormHandler {
} }
public void setShouldsave(String moo) { public void setShouldsave(String moo) {
if ( (moo != null) && (moo.equals("Save changes")) ) if ( (moo != null) && (moo.equals(_("Save changes"))) )
_shouldSave = true; _shouldSave = true;
} }
@ -132,14 +132,16 @@ public class ConfigTunnelsHandler extends FormHandler {
} }
if (updated > 0) if (updated > 0)
addFormNotice("Updated settings for " + updated + " pools."); // the count isn't really correct anyway, since we don't check for actual changes
//addFormNotice("Updated settings for " + updated + " pools.");
addFormNotice(_("Updated settings for all pools."));
if (saveRequired) { if (saveRequired) {
boolean saved = _context.router().saveConfig(); boolean saved = _context.router().saveConfig();
if (saved) if (saved)
addFormNotice("Exploratory tunnel configuration saved successfully."); addFormNotice(_("Exploratory tunnel configuration saved successfully."));
else else
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs."); addFormNotice(_("Error saving the configuration (applied but not saved) - please see the error logs."));
} }
} }
private static final int getInt(Object val) { private static final int getInt(Object val) {

View File

@ -8,8 +8,13 @@ import net.i2p.data.Destination;
import net.i2p.router.TunnelPoolSettings; import net.i2p.router.TunnelPoolSettings;
public class ConfigTunnelsHelper extends HelperBase { public class ConfigTunnelsHelper extends HelperBase {
public ConfigTunnelsHelper() {} static final String HOP = _x("hop");
static final String TUNNEL = _x("tunnel");
/** dummies for translation */
static final String HOPS = _x("hops");
static final String TUNNELS = _x("tunnels");
public ConfigTunnelsHelper() {}
public String getForm() { public String getForm() {
StringBuilder buf = new StringBuilder(1024); StringBuilder buf = new StringBuilder(1024);
@ -18,7 +23,7 @@ public class ConfigTunnelsHelper extends HelperBase {
TunnelPoolSettings exploratoryOut = _context.tunnelManager().getOutboundSettings(); TunnelPoolSettings exploratoryOut = _context.tunnelManager().getOutboundSettings();
buf.append("<input type=\"hidden\" name=\"pool.0\" value=\"exploratory\" >"); buf.append("<input type=\"hidden\" name=\"pool.0\" value=\"exploratory\" >");
renderForm(buf, 0, "exploratory", "Exploratory tunnels", exploratoryIn, exploratoryOut); renderForm(buf, 0, "exploratory", _("Exploratory tunnels"), exploratoryIn, exploratoryOut);
int cur = 1; int cur = 1;
Set clients = _context.clientManager().listClients(); Set clients = _context.clientManager().listClients();
@ -38,7 +43,7 @@ public class ConfigTunnelsHelper extends HelperBase {
String prefix = dest.calculateHash().toBase64().substring(0,4); String prefix = dest.calculateHash().toBase64().substring(0,4);
buf.append("<input type=\"hidden\" name=\"pool.").append(cur).append("\" value=\""); buf.append("<input type=\"hidden\" name=\"pool.").append(cur).append("\" value=\"");
buf.append(dest.calculateHash().toBase64()).append("\" >"); buf.append(dest.calculateHash().toBase64()).append("\" >");
renderForm(buf, cur, prefix, "Client tunnels for " + name, in, out); renderForm(buf, cur, prefix, _("Client tunnels for") + " " + _(name), in, out);
cur++; cur++;
} }
@ -61,95 +66,95 @@ public class ConfigTunnelsHelper extends HelperBase {
in.getLength() + in.getLengthVariance() <= 0 || in.getLength() + in.getLengthVariance() <= 0 ||
out.getLength() <= 0 || out.getLength() <= 0 ||
out.getLength() + out.getLengthVariance() <= 0) out.getLength() + out.getLengthVariance() <= 0)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 0-hop tunnels.</font></th></tr>"); buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _("ANONYMITY WARNING - Settings include 0-hop tunnels.") + "</font></th></tr>");
else if (in.getLength() <= 1 || else if (in.getLength() <= 1 ||
in.getLength() + in.getLengthVariance() <= 1 || in.getLength() + in.getLengthVariance() <= 1 ||
out.getLength() <= 1 || out.getLength() <= 1 ||
out.getLength() + out.getLengthVariance() <= 1) out.getLength() + out.getLengthVariance() <= 1)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 1-hop tunnels.</font></th></tr>"); buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _("ANONYMITY WARNING - Settings include 1-hop tunnels.") + "</font></th></tr>");
if (in.getLength() + Math.abs(in.getLengthVariance()) >= WARN_LENGTH || if (in.getLength() + Math.abs(in.getLengthVariance()) >= WARN_LENGTH ||
out.getLength() + Math.abs(out.getLengthVariance()) >= WARN_LENGTH) out.getLength() + Math.abs(out.getLengthVariance()) >= WARN_LENGTH)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include very long tunnels.</font></th></tr>"); buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _("PERFORMANCE WARNING - Settings include very long tunnels.") + "</font></th></tr>");
if (in.getQuantity() + in.getBackupQuantity() >= WARN_QUANTITY || if (in.getQuantity() + in.getBackupQuantity() >= WARN_QUANTITY ||
out.getQuantity() + out.getBackupQuantity() >= WARN_QUANTITY) out.getQuantity() + out.getBackupQuantity() >= WARN_QUANTITY)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include high tunnel quantities.</font></th></tr>"); buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _("PERFORMANCE WARNING - Settings include high tunnel quantities.") + "</font></th></tr>");
buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt=\"Inbound\" title=\"Inbound Tunnels\">&nbsp;&nbsp;Inbound</th><th><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound Tunnels\" title=\"Outbound\">&nbsp;&nbsp;Outbound</th></tr>\n"); buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt=\"Inbound\" title=\"Inbound Tunnels\">&nbsp;&nbsp;" + _("Inbound") + "</th><th><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound Tunnels\" title=\"Outbound\">&nbsp;&nbsp;" + _("Outbound") + "</th></tr>\n");
// buf.append("<tr><th></th><th>Inbound</th><th>Outbound</th></tr>\n"); // buf.append("<tr><th></th><th>Inbound</th><th>Outbound</th></tr>\n");
// tunnel depth // tunnel depth
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Depth:</td>\n"); buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Depth") + ":</td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".depthInbound\">\n"); buf.append("<td align=\"center\"><select name=\"").append(index).append(".depthInbound\">\n");
int now = in.getLength(); int now = in.getLength();
renderOptions(buf, 0, MAX_LENGTH, now, "", "hop"); renderOptions(buf, 0, MAX_LENGTH, now, "", HOP);
if (now > MAX_LENGTH) if (now > MAX_LENGTH)
renderOptions(buf, now, now, now, "", "hop"); renderOptions(buf, now, now, now, "", HOP);
buf.append("</select></td>\n"); buf.append("</select></td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".depthOutbound\">\n"); buf.append("<td align=\"center\"><select name=\"").append(index).append(".depthOutbound\">\n");
now = out.getLength(); now = out.getLength();
renderOptions(buf, 0, MAX_LENGTH, now, "", "hop"); renderOptions(buf, 0, MAX_LENGTH, now, "", HOP);
if (now > MAX_LENGTH) if (now > MAX_LENGTH)
renderOptions(buf, now, now, now, "", "hop"); renderOptions(buf, now, now, now, "", HOP);
buf.append("</select></td>\n"); buf.append("</select></td>\n");
buf.append("</tr>\n"); buf.append("</tr>\n");
// tunnel depth variance // tunnel depth variance
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Randomization:</td>\n"); buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Randomization") + ":</td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".varianceInbound\">\n"); buf.append("<td align=\"center\"><select name=\"").append(index).append(".varianceInbound\">\n");
now = in.getLengthVariance(); now = in.getLengthVariance();
renderOptions(buf, 0, 0, now, "", "hop"); renderOptions(buf, 0, 0, now, "", HOP);
renderOptions(buf, 1, MAX_VARIANCE, now, "+ 0-", "hop"); renderOptions(buf, 1, MAX_VARIANCE, now, "+ 0-", HOP);
renderOptions(buf, MIN_NEG_VARIANCE, -1, now, "+/- 0", "hop"); renderOptions(buf, MIN_NEG_VARIANCE, -1, now, "+/- 0", HOP);
if (now > MAX_VARIANCE) if (now > MAX_VARIANCE)
renderOptions(buf, now, now, now, "+ 0-", "hop"); renderOptions(buf, now, now, now, "+ 0-", HOP);
else if (now < MIN_NEG_VARIANCE) else if (now < MIN_NEG_VARIANCE)
renderOptions(buf, now, now, now, "+/- 0", "hop"); renderOptions(buf, now, now, now, "+/- 0", HOP);
buf.append("</select></td>\n"); buf.append("</select></td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".varianceOutbound\">\n"); buf.append("<td align=\"center\"><select name=\"").append(index).append(".varianceOutbound\">\n");
now = out.getLengthVariance(); now = out.getLengthVariance();
renderOptions(buf, 0, 0, now, "", "hop"); renderOptions(buf, 0, 0, now, "", HOP);
renderOptions(buf, 1, MAX_VARIANCE, now, "+ 0-", "hop"); renderOptions(buf, 1, MAX_VARIANCE, now, "+ 0-", HOP);
renderOptions(buf, MIN_NEG_VARIANCE, -1, now, "+/- 0", "hop"); renderOptions(buf, MIN_NEG_VARIANCE, -1, now, "+/- 0", HOP);
if (now > MAX_VARIANCE) if (now > MAX_VARIANCE)
renderOptions(buf, now, now, now, "+ 0-", "hop"); renderOptions(buf, now, now, now, "+ 0-", HOP);
else if (now < MIN_NEG_VARIANCE) else if (now < MIN_NEG_VARIANCE)
renderOptions(buf, now, now, now, "+/- 0", "hop"); renderOptions(buf, now, now, now, "+/- 0", HOP);
buf.append("</select></td>\n"); buf.append("</select></td>\n");
// tunnel quantity // tunnel quantity
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Quantity:</td>\n"); buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Quantity") + ":</td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".quantityInbound\">\n"); buf.append("<td align=\"center\"><select name=\"").append(index).append(".quantityInbound\">\n");
now = in.getQuantity(); now = in.getQuantity();
renderOptions(buf, 1, MAX_QUANTITY, now, "", "tunnel"); renderOptions(buf, 1, MAX_QUANTITY, now, "", TUNNEL);
if (now > MAX_QUANTITY) if (now > MAX_QUANTITY)
renderOptions(buf, now, now, now, "", "tunnel"); renderOptions(buf, now, now, now, "", TUNNEL);
buf.append("</select></td>\n"); buf.append("</select></td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".quantityOutbound\">\n"); buf.append("<td align=\"center\"><select name=\"").append(index).append(".quantityOutbound\">\n");
now = out.getQuantity(); now = out.getQuantity();
renderOptions(buf, 1, MAX_QUANTITY, now, "", "tunnel"); renderOptions(buf, 1, MAX_QUANTITY, now, "", TUNNEL);
if (now > MAX_QUANTITY) if (now > MAX_QUANTITY)
renderOptions(buf, now, now, now, "", "tunnel"); renderOptions(buf, now, now, now, "", TUNNEL);
buf.append("</select></td>\n"); buf.append("</select></td>\n");
buf.append("</tr>\n"); buf.append("</tr>\n");
// tunnel backup quantity // tunnel backup quantity
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Backup quantity:</td>\n"); buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Backup quantity") + ":</td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".backupInbound\">\n"); buf.append("<td align=\"center\"><select name=\"").append(index).append(".backupInbound\">\n");
now = in.getBackupQuantity(); now = in.getBackupQuantity();
renderOptions(buf, 0, MAX_BACKUP_QUANTITY, now, "", "tunnel"); renderOptions(buf, 0, MAX_BACKUP_QUANTITY, now, "", TUNNEL);
if (now > MAX_BACKUP_QUANTITY) if (now > MAX_BACKUP_QUANTITY)
renderOptions(buf, now, now, now, "", "tunnel"); renderOptions(buf, now, now, now, "", TUNNEL);
buf.append("</select></td>\n"); buf.append("</select></td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".backupOutbound\">\n"); buf.append("<td align=\"center\"><select name=\"").append(index).append(".backupOutbound\">\n");
now = out.getBackupQuantity(); now = out.getBackupQuantity();
renderOptions(buf, 0, MAX_BACKUP_QUANTITY, now, "", "tunnel"); renderOptions(buf, 0, MAX_BACKUP_QUANTITY, now, "", TUNNEL);
if (now > MAX_BACKUP_QUANTITY) if (now > MAX_BACKUP_QUANTITY)
renderOptions(buf, now, now, now, "", "tunnel"); renderOptions(buf, now, now, now, "", TUNNEL);
buf.append("</select></td>\n"); buf.append("</select></td>\n");
buf.append("</tr>\n"); buf.append("</tr>\n");
@ -159,7 +164,7 @@ buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt
// And let's not display them at all unless they have contents, which should be rare. // And let's not display them at all unless they have contents, which should be rare.
Properties props = in.getUnknownOptions(); Properties props = in.getUnknownOptions();
if (props.size() > 0) { if (props.size() > 0) {
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Inbound options:</td>\n" + buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Inbound options") + ":</td>\n" +
"<td colspan=\"2\" align=\"center\"><input name=\"").append(index); "<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
buf.append(".inboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " + buf.append(".inboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " +
"value=\""); "value=\"");
@ -172,7 +177,7 @@ buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt
} }
props = out.getUnknownOptions(); props = out.getUnknownOptions();
if (props.size() > 0) { if (props.size() > 0) {
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Outbound options:</td>\n" + buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Outbound options") + ":</td>\n" +
"<td colspan=\"2\" align=\"center\"><input name=\"").append(index); "<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
buf.append(".outboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " + buf.append(".outboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " +
"value=\""); "value=\"");
@ -191,9 +196,13 @@ buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt
buf.append("<option value=\"").append(i).append("\" "); buf.append("<option value=\"").append(i).append("\" ");
if (i == now) if (i == now)
buf.append("selected=\"true\" "); buf.append("selected=\"true\" ");
buf.append(">").append(prefix).append(i).append(' ').append(name); String pname;
// pluralize and then translate
if (i != 1 && i != -1) if (i != 1 && i != -1)
buf.append('s'); pname = name + 's';
else
pname = name;
buf.append(">").append(prefix).append(i).append(' ').append(_(pname));
buf.append("</option>\n"); buf.append("</option>\n");
} }
} }

View File

@ -17,16 +17,23 @@ public class ConfigUIHandler extends FormHandler {
_config = val; _config = val;
} }
/** note - lang change is handled in CSSHelper but we still need to save it here */
private void saveChanges() { private void saveChanges() {
if (_config == null) if (_config == null)
return; return;
String oldTheme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
if (_config.equals("default")) // obsolete if (_config.equals("default")) // obsolete
_context.router().removeConfigSetting(CSSHelper.PROP_THEME_NAME); _context.router().removeConfigSetting(CSSHelper.PROP_THEME_NAME);
else else
_context.router().setConfigSetting(CSSHelper.PROP_THEME_NAME, _config); _context.router().setConfigSetting(CSSHelper.PROP_THEME_NAME, _config);
if (_context.router().saveConfig()) if (_context.router().saveConfig()) {
addFormNotice("Theme change saved. <a href=\"configui.jsp\">Refresh the page</a> to view."); if (!oldTheme.equals(_config))
else addFormNotice(_("Theme change saved.") +
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs."); " <a href=\"configui.jsp\">" +
_("Refresh the page to view.") +
"</a>");
} else {
addFormNotice(_("Error saving the configuration (applied but not saved) - please see the error logs."));
}
} }
} }

View File

@ -1,13 +1,15 @@
package net.i2p.router.web; package net.i2p.router.web;
public class ConfigUIHelper extends HelperBase { import java.io.File;
public ConfigUIHelper() {} import java.util.TreeSet;
import java.util.Set;
private static final String themes[] = {_x("classic"), _x("dark"), _x("light")}; public class ConfigUIHelper extends HelperBase {
public String getSettings() { public String getSettings() {
StringBuilder buf = new StringBuilder(512); StringBuilder buf = new StringBuilder(512);
String current = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME); String current = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
Set<String> themes = themeSet();
for (String theme : themes) { for (String theme : themes) {
buf.append("<input type=\"radio\" class=\"optbox\" name=\"theme\" "); buf.append("<input type=\"radio\" class=\"optbox\" name=\"theme\" ");
if (theme.equals(current)) if (theme.equals(current))
@ -17,10 +19,29 @@ public class ConfigUIHelper extends HelperBase {
return buf.toString(); return buf.toString();
} }
/** @return standard and user-installed themes, sorted (untranslated) */
private Set<String> themeSet() {
Set<String> rv = new TreeSet();
// add a failsafe even if we can't find any themes
rv.add(CSSHelper.DEFAULT_THEME);
File dir = new File(_context.getBaseDir(), "docs/themes/console");
File[] files = dir.listFiles();
if (files == null)
return rv;
for (int i = 0; i < files.length; i++) {
String name = files[i].getName();
if (files[i].isDirectory() && ! name.equals("images"))
rv.add(name);
}
return rv;
}
private static final String langs[] = {"de", "en", "fr", "nl", "se", "zh"}; private static final String langs[] = {"de", "en", "fr", "nl", "se", "zh"};
private static final String flags[] = {"de", "us", "fr", "nl", "se", "cn"};
private static final String xlangs[] = {_x("German"), _x("English"), _x("French"), private static final String xlangs[] = {_x("German"), _x("English"), _x("French"),
_x("Dutch"), _x("Swedish"), _x("Chinese")}; _x("Dutch"), _x("Swedish"), _x("Chinese")};
/** todo sort by translated string */
public String getLangSettings() { public String getLangSettings() {
StringBuilder buf = new StringBuilder(512); StringBuilder buf = new StringBuilder(512);
String current = Messages.getLanguage(_context); String current = Messages.getLanguage(_context);
@ -29,7 +50,9 @@ public class ConfigUIHelper extends HelperBase {
buf.append("<input type=\"radio\" class=\"optbox\" name=\"lang\" "); buf.append("<input type=\"radio\" class=\"optbox\" name=\"lang\" ");
if (langs[i].equals(current)) if (langs[i].equals(current))
buf.append("checked=\"true\" "); buf.append("checked=\"true\" ");
buf.append("value=\"").append(langs[i]).append("\">").append(_(xlangs[i])).append("<br>\n"); buf.append("value=\"").append(langs[i]).append("\">")
.append("<img height=\"11\" width=\"16\" alt=\"\" src=\"/flags.jsp?c=").append(flags[i]).append("\"> ")
.append(_(xlangs[i])).append("<br>\n");
} }
return buf.toString(); return buf.toString();
} }

View File

@ -51,25 +51,28 @@ public class ConfigUpdateHandler extends FormHandler {
@Override @Override
protected void processForm() { protected void processForm() {
if (_action != null && _action.startsWith("Check")) { if (_action == null)
return;
if (_action.equals(_("Check for updates"))) {
NewsFetcher fetcher = NewsFetcher.getInstance(I2PAppContext.getGlobalContext()); NewsFetcher fetcher = NewsFetcher.getInstance(I2PAppContext.getGlobalContext());
fetcher.fetchNews(); fetcher.fetchNews();
if (fetcher.shouldFetchUnsigned()) if (fetcher.shouldFetchUnsigned())
fetcher.fetchUnsignedHead(); fetcher.fetchUnsignedHead();
if (fetcher.updateAvailable() || fetcher.unsignedUpdateAvailable()) { if (fetcher.updateAvailable() || fetcher.unsignedUpdateAvailable()) {
if ( (_updatePolicy == null) || (!_updatePolicy.equals("notify")) ) if ( (_updatePolicy == null) || (!_updatePolicy.equals("notify")) )
addFormNotice("Update available, attempting to download now"); addFormNotice(_("Update available, attempting to download now"));
else else
addFormNotice("Update available, click button on left to download"); addFormNotice(_("Update available, click button on left to download"));
} else } else
addFormNotice("No update available"); addFormNotice(_("No update available"));
return;
} }
if ( (_newsURL != null) && (_newsURL.length() > 0) ) { if ( (_newsURL != null) && (_newsURL.length() > 0) ) {
String oldURL = ConfigUpdateHelper.getNewsURL(_context); String oldURL = ConfigUpdateHelper.getNewsURL(_context);
if ( (oldURL == null) || (!_newsURL.equals(oldURL)) ) { if ( (oldURL == null) || (!_newsURL.equals(oldURL)) ) {
_context.router().setConfigSetting(PROP_NEWS_URL, _newsURL); _context.router().setConfigSetting(PROP_NEWS_URL, _newsURL);
addFormNotice("Updating news URL to " + _newsURL); addFormNotice(_("Updating news URL to") + " " + _newsURL);
} }
} }
@ -77,7 +80,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldHost = _context.router().getConfigSetting(PROP_PROXY_HOST); String oldHost = _context.router().getConfigSetting(PROP_PROXY_HOST);
if ( (oldHost == null) || (!_proxyHost.equals(oldHost)) ) { if ( (oldHost == null) || (!_proxyHost.equals(oldHost)) ) {
_context.router().setConfigSetting(PROP_PROXY_HOST, _proxyHost); _context.router().setConfigSetting(PROP_PROXY_HOST, _proxyHost);
addFormNotice("Updating proxy host to " + _proxyHost); addFormNotice(_("Updating proxy host to") + " " + _proxyHost);
} }
} }
@ -85,7 +88,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldPort = _context.router().getConfigSetting(PROP_PROXY_PORT); String oldPort = _context.router().getConfigSetting(PROP_PROXY_PORT);
if ( (oldPort == null) || (!_proxyPort.equals(oldPort)) ) { if ( (oldPort == null) || (!_proxyPort.equals(oldPort)) ) {
_context.router().setConfigSetting(PROP_PROXY_PORT, _proxyPort); _context.router().setConfigSetting(PROP_PROXY_PORT, _proxyPort);
addFormNotice("Updating proxy port to " + _proxyPort); addFormNotice(_("Updating proxy port to") + " " + _proxyPort);
} }
} }
@ -98,14 +101,14 @@ public class ConfigUpdateHandler extends FormHandler {
try { oldFreq = Long.parseLong(oldFreqStr); } catch (NumberFormatException nfe) {} try { oldFreq = Long.parseLong(oldFreqStr); } catch (NumberFormatException nfe) {}
if (_refreshFrequency != oldFreq) { if (_refreshFrequency != oldFreq) {
_context.router().setConfigSetting(PROP_REFRESH_FREQUENCY, ""+_refreshFrequency); _context.router().setConfigSetting(PROP_REFRESH_FREQUENCY, ""+_refreshFrequency);
addFormNotice("Updating refresh frequency to " + DataHelper.formatDuration(_refreshFrequency)); addFormNotice(_("Updating refresh frequency to") + " " + DataHelper.formatDuration(_refreshFrequency));
} }
if ( (_updatePolicy != null) && (_updatePolicy.length() > 0) ) { if ( (_updatePolicy != null) && (_updatePolicy.length() > 0) ) {
String oldPolicy = _context.router().getConfigSetting(PROP_UPDATE_POLICY); String oldPolicy = _context.router().getConfigSetting(PROP_UPDATE_POLICY);
if ( (oldPolicy == null) || (!_updatePolicy.equals(oldPolicy)) ) { if ( (oldPolicy == null) || (!_updatePolicy.equals(oldPolicy)) ) {
_context.router().setConfigSetting(PROP_UPDATE_POLICY, _updatePolicy); _context.router().setConfigSetting(PROP_UPDATE_POLICY, _updatePolicy);
addFormNotice("Updating update policy to " + _updatePolicy); addFormNotice(_("Updating update policy to") + " " + _updatePolicy);
} }
} }
@ -114,7 +117,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldURL = _context.router().getConfigSetting(PROP_UPDATE_URL); String oldURL = _context.router().getConfigSetting(PROP_UPDATE_URL);
if ( (oldURL == null) || (!_updateURL.equals(oldURL)) ) { if ( (oldURL == null) || (!_updateURL.equals(oldURL)) ) {
_context.router().setConfigSetting(PROP_UPDATE_URL, _updateURL); _context.router().setConfigSetting(PROP_UPDATE_URL, _updateURL);
addFormNotice("Updating update URLs."); addFormNotice(_("Updating update URLs."));
} }
} }
@ -122,7 +125,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldKeys = new TrustedUpdate(_context).getTrustedKeysString(); String oldKeys = new TrustedUpdate(_context).getTrustedKeysString();
if ( (oldKeys == null) || (!_trustedKeys.equals(oldKeys)) ) { if ( (oldKeys == null) || (!_trustedKeys.equals(oldKeys)) ) {
_context.router().setConfigSetting(PROP_TRUSTED_KEYS, _trustedKeys); _context.router().setConfigSetting(PROP_TRUSTED_KEYS, _trustedKeys);
addFormNotice("Updating trusted keys."); addFormNotice(_("Updating trusted keys."));
} }
} }
@ -130,7 +133,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldURL = _context.router().getConfigSetting(PROP_ZIP_URL); String oldURL = _context.router().getConfigSetting(PROP_ZIP_URL);
if ( (oldURL == null) || (!_zipURL.equals(oldURL)) ) { if ( (oldURL == null) || (!_zipURL.equals(oldURL)) ) {
_context.router().setConfigSetting(PROP_ZIP_URL, _zipURL); _context.router().setConfigSetting(PROP_ZIP_URL, _zipURL);
addFormNotice("Updating unsigned update URL to " + _zipURL); addFormNotice(_("Updating unsigned update URL to") + " " + _zipURL);
} }
} }

View File

@ -72,9 +72,9 @@ public class ConfigUpdateHelper extends HelperBase {
buf.append("\" selected=\"true\""); buf.append("\" selected=\"true\"");
if (PERIODS[i] == -1) if (PERIODS[i] == -1)
buf.append("\">Never</option>\n"); buf.append("\">" + _("Never") + "</option>\n");
else else
buf.append("\">Every ").append(DataHelper.formatDuration(PERIODS[i])).append("</option>\n"); buf.append("\">" + _("Every") + " ").append(DataHelper.formatDuration(PERIODS[i])).append("</option>\n");
} }
buf.append("</select>\n"); buf.append("</select>\n");
return buf.toString(); return buf.toString();
@ -89,18 +89,18 @@ public class ConfigUpdateHelper extends HelperBase {
if ("notify".equals(policy)) if ("notify".equals(policy))
buf.append("<option value=\"notify\" selected=\"true\">").append(_("Notify only")).append("</option>"); buf.append("<option value=\"notify\" selected=\"true\">").append(_("Notify only")).append("</option>");
else else
buf.append("<option value=\"notify\">Notify only</option>"); buf.append("<option value=\"notify\">" + _("Notify only") + "</option>");
if ("download".equals(policy)) if ("download".equals(policy))
buf.append("<option value=\"download\" selected=\"true\">Download and verify only</option>"); buf.append("<option value=\"download\" selected=\"true\">" + _("Download and verify only") + "</option>");
else else
buf.append("<option value=\"download\">Download and verify only</option>"); buf.append("<option value=\"download\">" + _("Download and verify only") + "</option>");
if (System.getProperty("wrapper.version") != null) { if (System.getProperty("wrapper.version") != null) {
if ("install".equals(policy)) if ("install".equals(policy))
buf.append("<option value=\"install\" selected=\"true\">Download, verify, and restart</option>"); buf.append("<option value=\"install\" selected=\"true\">" + _("Download, verify, and restart") + "</option>");
else else
buf.append("<option value=\"install\">Download, verify, and restart</option>"); buf.append("<option value=\"install\">" + _("Download, verify, and restart") + "</option>");
} }
buf.append("</select>\n"); buf.append("</select>\n");

View File

@ -104,33 +104,24 @@ public class GraphHelper extends HelperBase {
} }
public String getForm() { public String getForm() {
try { try {
_out.write("<br><h3>Configure Graph Display [<a href=\"configstats.jsp\">Select Stats</a>]</h3>"); _out.write("<br><h3>" + _("Configure Graph Display") + " [<a href=\"configstats.jsp\">" + _("Select Stats") + "</a>]</h3>");
_out.write("<form action=\"graphs.jsp\" method=\"GET\">"); _out.write("<form action=\"graphs.jsp\" method=\"GET\">");
_out.write("Periods: <input size=\"3\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\"><br>\n"); _out.write(_("Periods") + ": <input size=\"3\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\"><br>\n");
_out.write("Plot averages: <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"true\" ") + "> "); _out.write(_("Plot averages") + ": <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"true\" ") + "> ");
_out.write("or plot events: <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? "checked=\"true\" " : "") + "><br>\n"); _out.write(_("or")+ " " +_("plot events") + ": <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? "checked=\"true\" " : "") + "><br>\n");
_out.write("Image sizes: width: <input size=\"4\" type=\"text\" name=\"width\" value=\"" + _width _out.write(_("Image sizes") + ": " + _("width") + ": <input size=\"4\" type=\"text\" name=\"width\" value=\"" + _width
+ "\"> pixels, height: <input size=\"4\" type=\"text\" name=\"height\" value=\"" + _height + "\"> " + _("pixels") + ", " + _("height") + ": <input size=\"4\" type=\"text\" name=\"height\" value=\"" + _height
+ "\"><br>\n"); + "\"> " + _("pixels") + "<br>\n");
_out.write("Refresh delay: <select name=\"refreshDelay\"><option value=\"60\">1 minute</option><option value=\"120\">2 minutes</option><option value=\"300\">5 minutes</option><option value=\"600\">10 minutes</option><option value=\"1800\">30 minutes</option><option value=\"3600\">1 hour</option><option value=\"-1\">Never</option></select><br>\n"); _out.write(_("Refresh delay") + ": <select name=\"refreshDelay\"><option value=\"60\">1 " + _("minute") + "</option><option value=\"120\">2 " + _("minutes") + "</option><option value=\"300\">5 " + _("minutes") + "</option><option value=\"600\">10 " + _("minutes") + "</option><option value=\"1800\">30 " + _("minutes") + "</option><option value=\"3600\">1 " + _("hour") + "</option><option value=\"-1\">" + _("Never") + "</option></select><br>\n");
_out.write("<hr><div class=\"formaction\"><input type=\"submit\" value=\"Redraw\"></div></form>"); _out.write("<hr><div class=\"formaction\"><input type=\"submit\" value=\"" + _("Redraw") + "\"></div></form>");
} catch (IOException ioe) { } catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
} }
return ""; return "";
} }
public String getPeerSummary() {
try {
_context.commSystem().renderStatusHTML(_out);
_context.bandwidthLimiter().renderStatusHTML(_out);
} catch (IOException ioe) {
ioe.printStackTrace();
}
return "";
}
}
class AlphaComparator implements Comparator { /** inner class, don't bother reindenting */
private static class AlphaComparator implements Comparator {
public int compare(Object lhs, Object rhs) { public int compare(Object lhs, Object rhs) {
SummaryListener l = (SummaryListener)lhs; SummaryListener l = (SummaryListener)lhs;
SummaryListener r = (SummaryListener)rhs; SummaryListener r = (SummaryListener)rhs;
@ -139,3 +130,5 @@ class AlphaComparator implements Comparator {
return lName.compareTo(rName); return lName.compareTo(rName);
} }
} }
}

View File

@ -10,7 +10,7 @@ public class LogsHelper extends HelperBase {
public String getLogs() { public String getLogs() {
String str = formatMessages(_context.logManager().getBuffer().getMostRecentMessages()); String str = formatMessages(_context.logManager().getBuffer().getMostRecentMessages());
return "Location: <code>" + _context.logManager().currentFile() + "</code><br><br>" + str; return "Location: <b><code>" + _context.logManager().currentFile() + "</code></b><br><br>" + str;
} }
public String getCriticalLogs() { public String getCriticalLogs() {
@ -34,7 +34,7 @@ public class LogsHelper extends HelperBase {
return ""; return "";
else { else {
str = str.replaceAll("<", "&lt;").replaceAll(">", "&gt;"); str = str.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
return "Location:<code> " + f.getAbsolutePath() + "</code> <pre>" + str + "</pre>"; return "Location:<b><code> " + f.getAbsolutePath() + "</code></b> <pre>" + str + "</pre>";
} }
} }

View File

@ -25,8 +25,12 @@ public class Messages {
private static final String _localeLang = Locale.getDefault().getLanguage(); private static final String _localeLang = Locale.getDefault().getLanguage();
private static final Map<String, ResourceBundle> _bundles = new ConcurrentHashMap(2); private static final Map<String, ResourceBundle> _bundles = new ConcurrentHashMap(2);
private static final Set<String> _missing = new ConcurrentHashSet(2); private static final Set<String> _missing = new ConcurrentHashSet(2);
/** use to look for untagged strings */
private static final String TEST_LANG = "xx";
private static final String TEST_STRING = "XXXX";
/** current locale **/ /** current locale **/
/* unused
public static String getString(String key) { public static String getString(String key) {
if (_localeLang.equals("en")) if (_localeLang.equals("en"))
return key; return key;
@ -39,12 +43,15 @@ public class Messages {
return key; return key;
} }
} }
*/
/** lang in routerconsole.lang property, else current locale */ /** lang in routerconsole.lang property, else current locale */
public static String getString(String key, I2PAppContext ctx) { public static String getString(String key, I2PAppContext ctx) {
String lang = getLanguage(ctx); String lang = getLanguage(ctx);
if (lang.equals("en")) if (lang.equals("en"))
return key; return key;
else if (lang.equals(TEST_LANG))
return TEST_STRING;
ResourceBundle bundle = findBundle(lang); ResourceBundle bundle = findBundle(lang);
if (bundle == null) if (bundle == null)
return key; return key;
@ -68,17 +75,20 @@ public class Messages {
* Use autoboxing to call with ints, longs, floats, etc. * Use autoboxing to call with ints, longs, floats, etc.
*/ */
public static String getString(String s, Object o, I2PAppContext ctx) { public static String getString(String s, Object o, I2PAppContext ctx) {
String lang = getLanguage(ctx);
if (lang.equals(TEST_LANG))
return TEST_STRING + '(' + o + ')' + TEST_STRING;
String x = getString(s, ctx); String x = getString(s, ctx);
Object[] oArray = new Object[1]; Object[] oArray = new Object[1];
oArray[0] = o; oArray[0] = o;
try { try {
MessageFormat fmt = new MessageFormat(x, new Locale(getLanguage(ctx))); MessageFormat fmt = new MessageFormat(x, new Locale(lang));
return fmt.format(oArray, new StringBuffer(), null).toString(); return fmt.format(oArray, new StringBuffer(), null).toString();
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
System.err.println("Bad format: orig: \"" + s + System.err.println("Bad format: orig: \"" + s +
"\" trans: \"" + x + "\" trans: \"" + x +
"\" param: \"" + o + "\" param: \"" + o +
"\" lang: " + getLanguage(ctx)); "\" lang: " + lang);
return "FIXME: " + x + ' ' + o; return "FIXME: " + x + ' ' + o;
} }
} }

View File

@ -7,13 +7,17 @@ import java.io.OutputStreamWriter;
public class NetDbHelper extends HelperBase { public class NetDbHelper extends HelperBase {
private String _routerPrefix; private String _routerPrefix;
private boolean _full = false; private int _full;
private boolean _lease = false; private boolean _lease = false;
public NetDbHelper() {} public NetDbHelper() {}
public void setRouter(String r) { _routerPrefix = r; } public void setRouter(String r) { _routerPrefix = r; }
public void setFull(String f) { _full = "1".equals(f); } public void setFull(String f) {
try {
_full = Integer.parseInt(f);
} catch (NumberFormatException nfe) {}
}
public void setLease(String l) { _lease = "1".equals(l); } public void setLease(String l) { _lease = "1".equals(l); }
public String getNetDbSummary() { public String getNetDbSummary() {

View File

@ -18,6 +18,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import net.i2p.crypto.TrustedUpdate;
import net.i2p.data.DataHelper; import net.i2p.data.DataHelper;
import net.i2p.data.Destination; import net.i2p.data.Destination;
import net.i2p.data.Hash; import net.i2p.data.Hash;
@ -55,7 +56,7 @@ public class NetDbRenderer {
public void renderRouterInfoHTML(Writer out, String routerPrefix) throws IOException { public void renderRouterInfoHTML(Writer out, String routerPrefix) throws IOException {
StringBuilder buf = new StringBuilder(4*1024); StringBuilder buf = new StringBuilder(4*1024);
buf.append("<h2>Network Database RouterInfo Lookup</h2>\n"); buf.append("<h2>" + _("Network Database RouterInfo Lookup") + "</h2>\n");
if (".".equals(routerPrefix)) { if (".".equals(routerPrefix)) {
renderRouterInfo(buf, _context.router().getRouterInfo(), true, true); renderRouterInfo(buf, _context.router().getRouterInfo(), true, true);
} else { } else {
@ -70,21 +71,17 @@ public class NetDbRenderer {
} }
} }
if (notFound) if (notFound)
buf.append("Router ").append(routerPrefix).append(" not found in network database"); buf.append(_("Router") + ' ').append(routerPrefix).append(' ' + _("not found in network database") );
} }
out.write(buf.toString()); out.write(buf.toString());
out.flush(); out.flush();
} }
public void renderStatusHTML(Writer out) throws IOException {
renderStatusHTML(out, true);
}
public void renderLeaseSetHTML(Writer out) throws IOException { public void renderLeaseSetHTML(Writer out) throws IOException {
StringBuilder buf = new StringBuilder(4*1024); StringBuilder buf = new StringBuilder(4*1024);
buf.append("<h2>Network Database Contents</h2>\n"); buf.append("<h2>" + _("Network Database Contents") + "</h2>\n");
buf.append("<a href=\"netdb.jsp\">View RouterInfo</a>"); buf.append("<a href=\"netdb.jsp\">" + _("View RouterInfo") + "</a>");
buf.append("<h3>LeaseSets</h3>\n"); buf.append("<h3>").append(_("LeaseSets")).append("</h3>\n");
Set leases = new TreeSet(new LeaseSetComparator()); Set leases = new TreeSet(new LeaseSetComparator());
leases.addAll(_context.netDb().getLeases()); leases.addAll(_context.netDb().getLeases());
long now = _context.clock().now(); long now = _context.clock().now();
@ -92,19 +89,19 @@ public class NetDbRenderer {
LeaseSet ls = (LeaseSet)iter.next(); LeaseSet ls = (LeaseSet)iter.next();
Destination dest = ls.getDestination(); Destination dest = ls.getDestination();
Hash key = dest.calculateHash(); Hash key = dest.calculateHash();
buf.append("<b>LeaseSet: ").append(key.toBase64()); buf.append("<b>").append(_("LeaseSet")).append(": ").append(key.toBase64());
if (_context.clientManager().isLocal(dest)) { if (_context.clientManager().isLocal(dest)) {
buf.append(" (<a href=\"tunnels.jsp#" + key.toBase64().substring(0,4) + "\">Local</a> "); buf.append(" (<a href=\"tunnels.jsp#" + key.toBase64().substring(0,4) + "\">" + _("Local") + "</a> ");
if (! _context.clientManager().shouldPublishLeaseSet(key)) if (! _context.clientManager().shouldPublishLeaseSet(key))
buf.append("Unpublished "); buf.append(_("Unpublished") + ' ');
buf.append("Destination "); buf.append(_("Destination") + ' ');
TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(key); TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(key);
if (in != null && in.getDestinationNickname() != null) if (in != null && in.getDestinationNickname() != null)
buf.append(in.getDestinationNickname()); buf.append(in.getDestinationNickname());
else else
buf.append(dest.toBase64().substring(0, 6)); buf.append(dest.toBase64().substring(0, 6));
} else { } else {
buf.append(" (Destination "); buf.append(" (" + _("Destination") + ' ');
String host = _context.namingService().reverseLookup(dest); String host = _context.namingService().reverseLookup(dest);
if (host != null) if (host != null)
buf.append(host); buf.append(host);
@ -114,13 +111,13 @@ public class NetDbRenderer {
buf.append(")</b><br>\n"); buf.append(")</b><br>\n");
long exp = ls.getEarliestLeaseDate()-now; long exp = ls.getEarliestLeaseDate()-now;
if (exp > 0) if (exp > 0)
buf.append("Expires in ").append(DataHelper.formatDuration(exp)).append("<br>\n"); buf.append(_("Expires in {0}", DataHelper.formatDuration(exp))).append("<br>\n");
else else
buf.append("Expired ").append(DataHelper.formatDuration(0-exp)).append(" ago<br>\n"); buf.append(_("Expired {0} ago", DataHelper.formatDuration(0-exp))).append("<br>\n");
for (int i = 0; i < ls.getLeaseCount(); i++) { for (int i = 0; i < ls.getLeaseCount(); i++) {
buf.append("Lease ").append(i + 1).append(": Gateway "); buf.append(_("Lease")).append(' ').append(i + 1).append(": " + _("Gateway") + ' ');
buf.append(_context.commSystem().renderPeerHTML(ls.getLease(i).getGateway())); buf.append(_context.commSystem().renderPeerHTML(ls.getLease(i).getGateway()));
buf.append(" Tunnel ").append(ls.getLease(i).getTunnelId().getTunnelId()).append("<br>\n"); buf.append(' ' + _("Tunnel") + ' ').append(ls.getLease(i).getTunnelId().getTunnelId()).append("<br>\n");
} }
buf.append("<hr>\n"); buf.append("<hr>\n");
out.write(buf.toString()); out.write(buf.toString());
@ -130,27 +127,29 @@ public class NetDbRenderer {
out.flush(); out.flush();
} }
public void renderStatusHTML(Writer out, boolean full) throws IOException { /**
int size = _context.netDb().getKnownRouters() * 512; * @param mode 0: our info and charts only; 1: full routerinfos and charts; 2: abbreviated routerinfos and charts
if (full) */
size *= 4; public void renderStatusHTML(Writer out, int mode) throws IOException {
StringBuilder buf = new StringBuilder(size); out.write("<h2>" + _("Network Database Contents") + " (<a href=\"netdb.jsp?l=1\">" + _("View LeaseSets") + "</a>)</h2>\n");
out.write("<h2>Network Database Contents (<a href=\"netdb.jsp?l=1\">View LeaseSets</a>)</h2>\n");
if (!_context.netDb().isInitialized()) { if (!_context.netDb().isInitialized()) {
buf.append("Not initialized\n"); out.write(_("Not initialized"));
out.write(buf.toString());
out.flush(); out.flush();
return; return;
} }
boolean full = mode == 1;
boolean shortStats = mode == 2;
boolean showStats = full || shortStats;
Hash us = _context.routerHash(); Hash us = _context.routerHash();
out.write("<a name=\"routers\" ></a><h3>Routers (<a href=\"netdb.jsp"); out.write("<a name=\"routers\" ></a><h3>" + _("Routers") + " (<a href=\"netdb.jsp");
if (full) if (full || !showStats)
out.write("#routers\" >view without"); out.write("?f=2#routers\" >" + _("Show all routers"));
else else
out.write("?f=1#routers\" >view with"); out.write("?f=1#routers\" >" + _("Show all routers with full stats"));
out.write(" stats</a>)</h3>\n"); out.write("</a>)</h3>\n");
StringBuilder buf = new StringBuilder(8192);
RouterInfo ourInfo = _context.router().getRouterInfo(); RouterInfo ourInfo = _context.router().getRouterInfo();
renderRouterInfo(buf, ourInfo, true, true); renderRouterInfo(buf, ourInfo, true, true);
out.write(buf.toString()); out.write(buf.toString());
@ -158,6 +157,7 @@ public class NetDbRenderer {
ObjectCounter<String> versions = new ObjectCounter(); ObjectCounter<String> versions = new ObjectCounter();
ObjectCounter<String> countries = new ObjectCounter(); ObjectCounter<String> countries = new ObjectCounter();
int[] transportCount = new int[8];
Set routers = new TreeSet(new RouterInfoComparator()); Set routers = new TreeSet(new RouterInfoComparator());
routers.addAll(_context.netDb().getRouters()); routers.addAll(_context.netDb().getRouters());
@ -166,24 +166,28 @@ public class NetDbRenderer {
Hash key = ri.getIdentity().getHash(); Hash key = ri.getIdentity().getHash();
boolean isUs = key.equals(us); boolean isUs = key.equals(us);
if (!isUs) { if (!isUs) {
renderRouterInfo(buf, ri, false, full); if (showStats) {
out.write(buf.toString()); renderRouterInfo(buf, ri, false, full);
buf.setLength(0); out.write(buf.toString());
buf.setLength(0);
}
String routerVersion = ri.getOption("router.version"); String routerVersion = ri.getOption("router.version");
if (routerVersion != null) if (routerVersion != null)
versions.increment(routerVersion); versions.increment(routerVersion);
String country = _context.commSystem().getCountry(key); String country = _context.commSystem().getCountry(key);
if(country != null) if(country != null)
countries.increment(country); countries.increment(country);
transportCount[classifyTransports(ri)]++;
} }
} }
buf.append("<table border=\"0\" cellspacing=\"30\"><tr><td>"); buf.append("<table border=\"0\" cellspacing=\"30\"><tr><th colspan=\"3\">").append(_("Network Database Router Statistics")).append("</th><tr><td>");
// versions table
List<String> versionList = new ArrayList(versions.objects()); List<String> versionList = new ArrayList(versions.objects());
if (versionList.size() > 0) { if (versionList.size() > 0) {
Collections.sort(versionList, Collections.reverseOrder()); Collections.sort(versionList, Collections.reverseOrder(new TrustedUpdate.VersionComparator()));
buf.append("<table>\n"); buf.append("<table>\n");
buf.append("<tr><th>Version</th><th>Count</th></tr>\n"); buf.append("<tr><th>" + _("Version") + "</th><th>" + _("Count") + "</th></tr>\n");
for (String routerVersion : versionList) { for (String routerVersion : versionList) {
int num = versions.count(routerVersion); int num = versions.count(routerVersion);
buf.append("<tr><td align=\"center\">").append(DataHelper.stripHTML(routerVersion)); buf.append("<tr><td align=\"center\">").append(DataHelper.stripHTML(routerVersion));
@ -195,25 +199,50 @@ public class NetDbRenderer {
out.write(buf.toString()); out.write(buf.toString());
buf.setLength(0); buf.setLength(0);
// transports table
buf.append("<table>\n");
buf.append("<tr><th align=\"left\">" + _("Transports") + "</th><th>" + _("Count") + "</th></tr>\n");
for (int i = 0; i < 8; i++) {
int num = transportCount[i];
if (num > 0) {
buf.append("<tr><td>").append(_(TNAMES[i]));
buf.append("</td><td align=\"center\">").append(num).append("</td></tr>\n");
}
}
buf.append("</table>\n");
buf.append("</td><td>");
out.write(buf.toString());
buf.setLength(0);
// country table
List<String> countryList = new ArrayList(countries.objects()); List<String> countryList = new ArrayList(countries.objects());
if (countryList.size() > 0) { if (countryList.size() > 0) {
Collections.sort(countryList); Collections.sort(countryList, new CountryComparator());
buf.append("<table>\n"); buf.append("<table>\n");
buf.append("<tr><th align=\"left\">Country</th><th>Count</th></tr>\n"); buf.append("<tr><th align=\"left\">" + _("Country") + "</th><th>" + _("Count") + "</th></tr>\n");
for (String country : countryList) { for (String country : countryList) {
int num = countries.count(country); int num = countries.count(country);
buf.append("<tr><td><img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase()).append("\""); buf.append("<tr><td><img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase()).append("\"");
buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> "); buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> ");
buf.append(_context.commSystem().getCountryName(country)); buf.append(_(_context.commSystem().getCountryName(country)));
buf.append("</td><td align=\"center\">").append(num).append("</td></tr>\n"); buf.append("</td><td align=\"center\">").append(num).append("</td></tr>\n");
} }
buf.append("</table>\n"); buf.append("</table>\n");
} }
buf.append("</td></tr></table>"); buf.append("</td></tr></table>");
out.write(buf.toString()); out.write(buf.toString());
out.flush(); out.flush();
} }
/** sort by translated country name */
private class CountryComparator implements Comparator {
public int compare(Object l, Object r) {
return _(_context.commSystem().getCountryName((String)l))
.compareTo(_(_context.commSystem().getCountryName((String)r)));
}
}
/** /**
* Be careful to use stripHTML for any displayed routerInfo data * Be careful to use stripHTML for any displayed routerInfo data
* to prevent vulnerabilities * to prevent vulnerabilities
@ -222,32 +251,37 @@ public class NetDbRenderer {
String hash = info.getIdentity().getHash().toBase64(); String hash = info.getIdentity().getHash().toBase64();
buf.append("<table><tr><th><a name=\"").append(hash.substring(0, 6)).append("\" ></a>"); buf.append("<table><tr><th><a name=\"").append(hash.substring(0, 6)).append("\" ></a>");
if (isUs) { if (isUs) {
buf.append("<a name=\"our-info\" ></a><b>Our info: ").append(hash).append("</b></th></tr><tr><td>\n"); buf.append("<a name=\"our-info\" ></a><b>" + _("Our info") + ": ").append(hash).append("</b></th></tr><tr><td>\n");
} else { } else {
buf.append("<b>Peer info for:</b> ").append(hash).append("\n"); buf.append("<b>" + _("Peer info for") + ":</b> ").append(hash).append("\n");
if (full) { if (full) {
buf.append("[<a href=\"netdb.jsp\" >Back</a>]</th></tr><td>\n"); buf.append("[<a href=\"netdb.jsp\" >Back</a>]</th></tr><td>\n");
} else { } else {
buf.append("[<a href=\"netdb.jsp?r=").append(hash.substring(0, 6)).append("\" >Full entry</a>]</th></tr><td>\n"); buf.append("[<a href=\"netdb.jsp?r=").append(hash.substring(0, 6)).append("\" >").append(_("Full entry")).append("</a>]</th></tr><td>\n");
} }
} }
long age = _context.clock().now() - info.getPublished(); long age = _context.clock().now() - info.getPublished();
if (isUs && _context.router().isHidden()) if (isUs && _context.router().isHidden()) {
buf.append("<b>Hidden, Updated:</b> ").append(DataHelper.formatDuration(age)).append(" ago<br>\n"); buf.append("<b>").append(_("Hidden")).append(", ").append(_("Updated")).append(":</b> ")
else if (age > 0) .append(_("{0} ago", DataHelper.formatDuration(age))).append("<br>\n");
buf.append("<b>Published:</b> ").append(DataHelper.formatDuration(age)).append(" ago<br>\n"); } else if (age > 0) {
else buf.append("<b>").append(_("Published")).append(":</b> ")
buf.append("<b>Published:</b> in ").append(DataHelper.formatDuration(0-age)).append("???<br>\n"); .append(_("{0} ago", DataHelper.formatDuration(age))).append("<br>\n");
buf.append("<b>Address(es):</b> "); } else {
// shouldnt happen
buf.append("<b>" + _("Published") + ":</b> in ").append(DataHelper.formatDuration(0-age)).append("???<br>\n");
}
buf.append("<b>" + _("Address(es)") + ":</b> ");
String country = _context.commSystem().getCountry(info.getIdentity().getHash()); String country = _context.commSystem().getCountry(info.getIdentity().getHash());
if(country != null) { if(country != null) {
buf.append("<img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase()).append("\""); buf.append("<img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase()).append('\"');
buf.append(" title=\"").append(_(_context.commSystem().getCountryName(country))).append('\"');
buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> "); buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> ");
} }
for (Iterator iter = info.getAddresses().iterator(); iter.hasNext(); ) { for (Iterator iter = info.getAddresses().iterator(); iter.hasNext(); ) {
RouterAddress addr = (RouterAddress)iter.next(); RouterAddress addr = (RouterAddress)iter.next();
buf.append(DataHelper.stripHTML(addr.getTransportStyle())).append(": "); buf.append("<b>").append(DataHelper.stripHTML(addr.getTransportStyle())).append(":</b> ");
for (Iterator optIter = addr.getOptions().keySet().iterator(); optIter.hasNext(); ) { for (Iterator optIter = addr.getOptions().keySet().iterator(); optIter.hasNext(); ) {
String name = (String)optIter.next(); String name = (String)optIter.next();
String val = addr.getOptions().getProperty(name); String val = addr.getOptions().getProperty(name);
@ -256,7 +290,7 @@ public class NetDbRenderer {
} }
buf.append("</td></tr>\n"); buf.append("</td></tr>\n");
if (full) { if (full) {
buf.append("<tr><td>Stats: <br><code>\n"); buf.append("<tr><td>" + _("Stats") + ": <br><code>\n");
for (Iterator iter = info.getOptions().keySet().iterator(); iter.hasNext(); ) { for (Iterator iter = info.getOptions().keySet().iterator(); iter.hasNext(); ) {
String key = (String)iter.next(); String key = (String)iter.next();
String val = info.getOption(key); String val = info.getOption(key);
@ -268,8 +302,55 @@ public class NetDbRenderer {
buf.append("</td></tr>\n"); buf.append("</td></tr>\n");
} }
private static final int SSU = 1;
private static final int SSUI = 2;
private static final int NTCP = 4;
private static final String[] TNAMES = { _x("Hidden or starting up"), _x("SSU"), _x("SSU with introducers"), "",
_x("NTCP"), _x("NTCP and SSU"), _x("NTCP and SSU with introducers"), "" };
/**
* what transport types
*/
private int classifyTransports(RouterInfo info) {
int rv = 0;
String hash = info.getIdentity().getHash().toBase64();
for (Iterator iter = info.getAddresses().iterator(); iter.hasNext(); ) {
RouterAddress addr = (RouterAddress)iter.next();
String style = addr.getTransportStyle();
if (style.equals("NTCP")) {
rv |= NTCP;
} else if (style.equals("SSU")) {
if (addr.getOptions().getProperty("iport0") != null)
rv |= SSUI;
else
rv |= SSU;
}
}
return rv;
}
/** translate a string */ /** translate a string */
private String _(String s) { private String _(String s) {
return Messages.getString(s, _context); return Messages.getString(s, _context);
} }
/** tag only */
private static final String _x(String s) {
return s;
}
/**
* translate a string with a parameter
* This is a lot more expensive than _(s), so use sparingly.
*
* @param s string to be translated containing {0}
* The {0} will be replaced by the parameter.
* Single quotes must be doubled, i.e. ' -> '' in the string.
* @param o parameter, not translated.
* To tranlslate parameter also, use _("foo {0} bar", _("baz"))
* Do not double the single quotes in the parameter.
* Use autoboxing to call with ints, longs, floats, etc.
*/
private String _(String s, Object o) {
return Messages.getString(s, o, _context);
}
} }

View File

@ -74,10 +74,20 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
public String unsignedUpdateVersion() { return _unsignedUpdateVersion; } public String unsignedUpdateVersion() { return _unsignedUpdateVersion; }
public String status() { public String status() {
StringBuilder buf = new StringBuilder(128);
long now = _context.clock().now(); long now = _context.clock().now();
return if (_lastUpdated > 0) {
(_lastUpdated > 0 ? "News last updated " + DataHelper.formatDuration(now - _lastUpdated) + " ago" : "") + buf.append(Messages.getString("News last updated {0} ago.",
(_lastFetch > _lastUpdated ? ", last checked " + DataHelper.formatDuration(now - _lastFetch) + " ago" : ""); DataHelper.formatDuration(now - _lastUpdated),
_context))
.append('\n');
}
if (_lastFetch > _lastUpdated) {
buf.append(Messages.getString("News last checked {0} ago.",
DataHelper.formatDuration(now - _lastFetch),
_context));
}
return buf.toString();
} }
public void run() { public void run() {

View File

@ -25,7 +25,8 @@ public class PeerHelper extends HelperBase {
public String getPeerSummary() { public String getPeerSummary() {
try { try {
_context.commSystem().renderStatusHTML(_out, _urlBase, _sortFlags); _context.commSystem().renderStatusHTML(_out, _urlBase, _sortFlags);
_context.bandwidthLimiter().renderStatusHTML(_out); // boring and not worth translating
//_context.bandwidthLimiter().renderStatusHTML(_out);
} catch (IOException ioe) { } catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
} }

View File

@ -32,7 +32,7 @@ class ProfileOrganizerRenderer {
_organizer = organizer; _organizer = organizer;
_comparator = new ProfileComparator(); _comparator = new ProfileComparator();
} }
public void renderStatusHTML(Writer out) throws IOException { public void renderStatusHTML(Writer out, boolean full) throws IOException {
Set peers = _organizer.selectAllPeers(); Set peers = _organizer.selectAllPeers();
long now = _context.clock().now(); long now = _context.clock().now();
@ -40,6 +40,8 @@ class ProfileOrganizerRenderer {
TreeSet order = new TreeSet(_comparator); TreeSet order = new TreeSet(_comparator);
TreeSet integratedPeers = new TreeSet(_comparator); TreeSet integratedPeers = new TreeSet(_comparator);
int older = 0;
int standard = 0;
for (Iterator iter = peers.iterator(); iter.hasNext();) { for (Iterator iter = peers.iterator(); iter.hasNext();) {
Hash peer = (Hash)iter.next(); Hash peer = (Hash)iter.next();
if (_organizer.getUs().equals(peer)) continue; if (_organizer.getUs().equals(peer)) continue;
@ -51,7 +53,14 @@ class ProfileOrganizerRenderer {
if (info != null && info.getCapabilities().indexOf("f") >= 0) if (info != null && info.getCapabilities().indexOf("f") >= 0)
integratedPeers.add(prof); integratedPeers.add(prof);
} }
if (prof.getLastSendSuccessful() <= hideBefore) continue; if (prof.getLastSendSuccessful() <= hideBefore) {
older++;
continue;
}
if ((!full) && !_organizer.isHighCapacity(peer)) {
standard++;
continue;
}
order.add(prof); order.add(prof);
} }
@ -60,20 +69,23 @@ class ProfileOrganizerRenderer {
int integrated = 0; int integrated = 0;
int failing = 0; int failing = 0;
StringBuilder buf = new StringBuilder(16*1024); StringBuilder buf = new StringBuilder(16*1024);
buf.append("<h2>Peer Profiles</h2>\n<p>"); buf.append("<h2>").append(_("Peer Profiles")).append("</h2>\n<p>");
buf.append(_("Showing {0} recent profiles.", order.size())).append('\n'); buf.append(_("Showing {0} recent profiles.", order.size())).append('\n');
buf.append(_("Hiding {0} older profiles.", peers.size()-order.size())); if (older > 0)
buf.append("</p>" + buf.append(_("Hiding {0} older profiles.", older)).append('\n');
"<table>" + if (standard > 0)
"<tr>" + buf.append("<a href=\"/profiles.jsp?f=1\">").append(_("Hiding {0} standard profiles.", standard)).append("</a>\n");
"<th>").append(_("Peer")).append("</th>" + buf.append("</p>");
"<th>").append(_("Groups (Caps)")).append("</th>" + buf.append("<table>");
"<th>").append(_("Speed")).append("</th>" + buf.append("<tr>");
"<th>").append(_("Capacity")).append("</th>" + buf.append("<th>").append(_("Peer")).append("</th>");
"<th>").append(_("Integration")).append("</th>" + buf.append("<th>").append(_("Groups (Caps)")).append("</th>");
"<th>").append(_("Status")).append("</th>" + buf.append("<th>").append(_("Speed")).append("</th>");
"<th>&nbsp;</th>" + buf.append("<th>").append(_("Capacity")).append("</th>");
"</tr>"); buf.append("<th>").append(_("Integration")).append("</th>");
buf.append("<th>").append(_("Status")).append("</th>");
buf.append("<th>&nbsp;</th>");
buf.append("</tr>");
int prevTier = 1; int prevTier = 1;
for (Iterator iter = order.iterator(); iter.hasNext();) { for (Iterator iter = order.iterator(); iter.hasNext();) {
PeerProfile prof = (PeerProfile)iter.next(); PeerProfile prof = (PeerProfile)iter.next();
@ -105,15 +117,18 @@ class ProfileOrganizerRenderer {
buf.append("<tr><td align=\"center\" nowrap>"); buf.append("<tr><td align=\"center\" nowrap>");
buf.append(_context.commSystem().renderPeerHTML(peer)); buf.append(_context.commSystem().renderPeerHTML(peer));
// debug
//if(prof.getIsExpandedDB())
// buf.append(" ** ");
buf.append("</td><td align=\"center\">"); buf.append("</td><td align=\"center\">");
switch (tier) { switch (tier) {
case 1: buf.append("Fast, High Capacity"); break; case 1: buf.append(_("Fast, High Capacity")); break;
case 2: buf.append("High Capacity"); break; case 2: buf.append(_("High Capacity")); break;
case 3: buf.append("Not Failing"); break; case 3: buf.append(_("Standard")); break;
default: buf.append("Failing"); break; default: buf.append(_("Failing")); break;
} }
if (isIntegrated) buf.append(", Integrated"); if (isIntegrated) buf.append(", ").append(_("Integrated"));
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer); RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
if (info != null) { if (info != null) {
// prevent HTML injection in the caps and version // prevent HTML injection in the caps and version
@ -144,19 +159,20 @@ class ProfileOrganizerRenderer {
} }
buf.append("</td><td align=\"right\">").append(num(prof.getIntegrationValue())); buf.append("</td><td align=\"right\">").append(num(prof.getIntegrationValue()));
buf.append("</td><td align=\"center\">"); buf.append("</td><td align=\"center\">");
if (_context.shitlist().isShitlisted(peer)) buf.append("Banned"); if (_context.shitlist().isShitlisted(peer)) buf.append(_("Banned"));
if (prof.getIsFailing()) buf.append(" Failing"); if (prof.getIsFailing()) buf.append(' ').append(_("Failing"));
if (_context.commSystem().wasUnreachable(peer)) buf.append(" Unreachable"); if (_context.commSystem().wasUnreachable(peer)) buf.append(' ').append(_("Unreachable"));
Rate failed = prof.getTunnelHistory().getFailedRate().getRate(30*60*1000); Rate failed = prof.getTunnelHistory().getFailedRate().getRate(30*60*1000);
long fails = failed.getCurrentEventCount() + failed.getLastEventCount(); long fails = failed.getCurrentEventCount() + failed.getLastEventCount();
if (fails > 0) { if (fails > 0) {
Rate accepted = prof.getTunnelCreateResponseTime().getRate(30*60*1000); Rate accepted = prof.getTunnelCreateResponseTime().getRate(30*60*1000);
long total = fails + accepted.getCurrentEventCount() + accepted.getLastEventCount(); long total = fails + accepted.getCurrentEventCount() + accepted.getLastEventCount();
if (total / fails <= 10) // hide if < 10% if (total / fails <= 10) // hide if < 10%
buf.append(' ').append(fails).append('/').append(total).append(" Test Fails"); buf.append(' ').append(fails).append('/').append(total).append(' ').append(_("Test Fails"));
} }
buf.append("&nbsp;</td>"); buf.append("&nbsp;</td>");
buf.append("<td nowrap align=\"center\"><a target=\"_blank\" href=\"dumpprofile.jsp?peer=").append(peer.toBase64().substring(0,6)).append("\">profile</a>"); buf.append("<td nowrap align=\"center\"><a target=\"_blank\" href=\"dumpprofile.jsp?peer=")
.append(peer.toBase64().substring(0,6)).append("\">").append(_("profile")).append("</a>");
buf.append("&nbsp;<a href=\"configpeer.jsp?peer=").append(peer.toBase64()).append("\">+-</a></td>\n"); buf.append("&nbsp;<a href=\"configpeer.jsp?peer=").append(peer.toBase64()).append("\">+-</a></td>\n");
buf.append("</tr>"); buf.append("</tr>");
// let's not build the whole page in memory (~500 bytes per peer) // let's not build the whole page in memory (~500 bytes per peer)
@ -165,30 +181,26 @@ class ProfileOrganizerRenderer {
} }
buf.append("</table>"); buf.append("</table>");
buf.append("<h2>Floodfill and Integrated Peers</h2>\n" + buf.append("<h2><a name=\"flood\"></a>").append(_("Floodfill and Integrated Peers")).append("</h2>\n");
"<table>" + buf.append("<table>");
"<tr>" + buf.append("<tr>");
"<th class=\"smallhead\">Peer</th>" + buf.append("<th class=\"smallhead\">").append(_("Peer")).append("</th>");
"<th class=\"smallhead\">Caps</th>" + buf.append("<th class=\"smallhead\">").append(_("Caps")).append("</th>");
"<th class=\"smallhead\">Integ. Value</th>" + buf.append("<th class=\"smallhead\">").append(_("Integ. Value")).append("</th>");
"<th class=\"smallhead\">Last Heard About</th>" + buf.append("<th class=\"smallhead\">").append(_("Last Heard About")).append("</th>");
"<th class=\"smallhead\">Last Heard From</th>" + buf.append("<th class=\"smallhead\">").append(_("Last Heard From")).append("</th>");
// "<th class=\"smallhead\">Last Successful Send</th>" + buf.append("<th class=\"smallhead\">").append(_("Last Good Send")).append("</th>");
"<th class=\"smallhead\">Last Good Send</th>" + buf.append("<th class=\"smallhead\">").append(_("Last Bad Send")).append("</th>");
// "<th class=\"smallhead\">Last Failed Send</th>" + buf.append("<th class=\"smallhead\">").append(_("10m Resp. Time")).append("</th>");
"<th class=\"smallhead\">Last Bad Send</th>" + buf.append("<th class=\"smallhead\">").append(_("1h Resp. Time")).append("</th>");
"<th class=\"smallhead\">10m Resp. Time</th>" + buf.append("<th class=\"smallhead\">").append(_("1d Resp. Time")).append("</th>");
"<th class=\"smallhead\">1h Resp. Time</th>" + buf.append("<th class=\"smallhead\">").append(_("Last Good Lookup")).append("</th>");
"<th class=\"smallhead\">1d Resp. Time</th>" + buf.append("<th class=\"smallhead\">").append(_("Last Bad Lookup")).append("</th>");
// "<th class=\"smallhead\">Successful Lookups</th>" + buf.append("<th class=\"smallhead\">").append(_("Last Good Store")).append("</th>");
"<th class=\"smallhead\">Good Lookups</th>" + buf.append("<th class=\"smallhead\">").append(_("Last Bad Store")).append("</th>");
// "<th>Failed Lookups</th>" + buf.append("<th class=\"smallhead\">").append(_("1h Fail Rate")).append("</th>");
"<th class=\"smallhead\">Bad Lookups</th>" + buf.append("<th class=\"smallhead\">").append(_("1d Fail Rate")).append("</th>");
"<th class=\"smallhead\">New Stores</th>" + buf.append("</tr>");
"<th class=\"smallhead\">Old Stores</th>" +
"<th class=\"smallhead\">1h Fail Rate</th>" +
"<th class=\"smallhead\">1d Fail Rate</th>" +
"</tr>");
for (Iterator iter = integratedPeers.iterator(); iter.hasNext();) { for (Iterator iter = integratedPeers.iterator(); iter.hasNext();) {
PeerProfile prof = (PeerProfile)iter.next(); PeerProfile prof = (PeerProfile)iter.next();
Hash peer = prof.getPeer(); Hash peer = prof.getPeer();
@ -217,28 +229,39 @@ class ProfileOrganizerRenderer {
buf.append("<td align=\"right\">").append(avg(prof, 24*60*60*1000l)).append("</td>"); buf.append("<td align=\"right\">").append(avg(prof, 24*60*60*1000l)).append("</td>");
DBHistory dbh = prof.getDBHistory(); DBHistory dbh = prof.getDBHistory();
if (dbh != null) { if (dbh != null) {
buf.append("<td align=\"right\">").append(dbh.getSuccessfulLookups()).append("</td>"); time = now - dbh.getLastLookupSuccessful();
buf.append("<td align=\"right\">").append(dbh.getFailedLookups()).append("</td>"); buf.append("<td align=\"right\">").append(DataHelper.formatDuration(time)).append("</td>");
buf.append("<td align=\"right\">").append(dbh.getUnpromptedDbStoreNew()).append("</td>"); time = now - dbh.getLastLookupFailed();
buf.append("<td align=\"right\">").append(dbh.getUnpromptedDbStoreOld()).append("</td>"); buf.append("<td align=\"right\">").append(DataHelper.formatDuration(time)).append("</td>");
time = now - dbh.getLastStoreSuccessful();
buf.append("<td align=\"right\">").append(DataHelper.formatDuration(time)).append("</td>");
time = now - dbh.getLastStoreFailed();
buf.append("<td align=\"right\">").append(DataHelper.formatDuration(time)).append("</td>");
buf.append("<td align=\"right\">").append(davg(dbh, 60*60*1000l)).append("</td>"); buf.append("<td align=\"right\">").append(davg(dbh, 60*60*1000l)).append("</td>");
buf.append("<td align=\"right\">").append(davg(dbh, 24*60*60*1000l)).append("</td>"); buf.append("<td align=\"right\">").append(davg(dbh, 24*60*60*1000l)).append("</td>");
} else {
for (int i = 0; i < 6; i++)
buf.append("<td align=\"right\">").append(_(NA));
} }
buf.append("</tr>\n");
} }
buf.append("</table>"); buf.append("</table>");
buf.append("<h3>Thresholds:</h3>"); buf.append("<h3>").append(_("Thresholds")).append("</h3>");
buf.append("<b>Speed:</b> ").append(num(_organizer.getSpeedThreshold())).append(" (").append(fast).append(" fast peers)<br>"); buf.append("<p><b>").append(_("Speed")).append(":</b> ").append(num(_organizer.getSpeedThreshold()))
buf.append("<b>Capacity:</b> ").append(num(_organizer.getCapacityThreshold())).append(" (").append(reliable).append(" high capacity peers)<br>"); .append(" (").append(fast).append(' ').append(_("fast peers")).append(")<br>");
buf.append("<b>Integration:</b> ").append(num(_organizer.getIntegrationThreshold())).append(" (").append(integrated).append(" well integrated peers)"); buf.append("<b>").append(_("Capacity")).append(":</b> ").append(num(_organizer.getCapacityThreshold()))
buf.append("<h3>Definitions:</h3><ul>" + .append(" (").append(reliable).append(' ').append(_("high capacity peers")).append(")<br>");
"<li><b>groups</b>: as determined by the profile organizer</li>" + buf.append("<b>").append(_("Integration")).append(":</b> ").append(num(_organizer.getIntegrationThreshold()))
"<li><b>caps</b>: capabilities in the netDb, not used to determine profiles</li>" + .append(" (").append(integrated).append(' ').append(_(" well integrated peers")).append(")</p>");
"<li><b>speed</b>: peak throughput (bytes per second) over a 1 minute period that the peer has sustained in a single tunnel</li>" + buf.append("<h3>").append(_("Definitions")).append("</h3><ul>");
"<li><b>capacity</b>: how many tunnels can we ask them to join in an hour?</li>" + buf.append("<li><b>").append(_("groups")).append("</b>: ").append(_("as determined by the profile organizer")).append("</li>");
"<li><b>integration</b>: how many new peers have they told us about lately?</li>" + buf.append("<li><b>").append(_("caps")).append("</b>: ").append(_("capabilities in the netDb, not used to determine profiles")).append("</li>");
"<li><b>status</b>: is the peer banned, or unreachable, or failing tunnel tests?</li>" + buf.append("<li><b>").append(_("speed")).append("</b>: ").append(_("peak throughput (bytes per second) over a 1 minute period that the peer has sustained in a single tunnel")).append("</li>");
"</ul></i>"); buf.append("<li><b>").append(_("capacity")).append("</b>: ").append(_("how many tunnels can we ask them to join in an hour?")).append("</li>");
buf.append("<li><b>").append(_("integration")).append("</b>: ").append(_("how many new peers have they told us about lately?")).append("</li>");
buf.append("<li><b>").append(_("status")).append("</b>: ").append(_("is the peer banned, or unreachable, or failing tunnel tests?")).append("</li>");
buf.append("</ul></i>");
out.write(buf.toString()); out.write(buf.toString());
out.flush(); out.flush();
} }
@ -295,31 +318,34 @@ class ProfileOrganizerRenderer {
private final static DecimalFormat _fmt = new DecimalFormat("###,##0.00"); private final static DecimalFormat _fmt = new DecimalFormat("###,##0.00");
private final static String num(double num) { synchronized (_fmt) { return _fmt.format(num); } } private final static String num(double num) { synchronized (_fmt) { return _fmt.format(num); } }
private final static String na = "n/a"; private final static String NA = HelperBase._x("n/a");
private static String avg (PeerProfile prof, long rate) { private String avg (PeerProfile prof, long rate) {
RateStat rs = prof.getDbResponseTime(); RateStat rs = prof.getDbResponseTime();
if (rs == null) if (rs == null)
return na; return _(NA);
Rate r = rs.getRate(rate); Rate r = rs.getRate(rate);
if (r == null) if (r == null)
return na; return _(NA);
long c = r.getCurrentEventCount() + r.getLastEventCount(); long c = r.getCurrentEventCount() + r.getLastEventCount();
if (c == 0) if (c == 0)
return na; return _(NA);
double d = r.getCurrentTotalValue() + r.getLastTotalValue(); double d = r.getCurrentTotalValue() + r.getLastTotalValue();
return Math.round(d/c) + "ms"; return Math.round(d/c) + "ms";
} }
private static String davg (DBHistory dbh, long rate) { private String davg (DBHistory dbh, long rate) {
RateStat rs = dbh.getFailedLookupRate(); RateStat rs = dbh.getFailedLookupRate();
if (rs == null) if (rs == null)
return na; return "0%";
Rate r = rs.getRate(rate); Rate r = rs.getRate(rate);
if (r == null) if (r == null)
return na; return "0%";
long c = r.getCurrentEventCount() + r.getLastEventCount(); long c = r.getCurrentEventCount() + r.getLastEventCount();
return "" + c; if (c <= 0)
return "0%";
double avg = 0.5 + 100 * (r.getCurrentTotalValue() + r.getLastTotalValue()) / c;
return ((int) avg) + "%";
} }
/** translate a string */ /** translate a string */
@ -339,7 +365,7 @@ class ProfileOrganizerRenderer {
* Do not double the single quotes in the parameter. * Do not double the single quotes in the parameter.
* Use autoboxing to call with ints, longs, floats, etc. * Use autoboxing to call with ints, longs, floats, etc.
*/ */
public String _(String s, Object o) { private String _(String s, Object o) {
return Messages.getString(s, o, _context); return Messages.getString(s, o, _context);
} }
} }

View File

@ -4,13 +4,19 @@ import java.io.IOException;
public class ProfilesHelper extends HelperBase { public class ProfilesHelper extends HelperBase {
private boolean _full;
public ProfilesHelper() {} public ProfilesHelper() {}
public void setFull(String f) {
_full = f != null;
}
/** @return empty string, writes directly to _out */ /** @return empty string, writes directly to _out */
public String getProfileSummary() { public String getProfileSummary() {
try { try {
ProfileOrganizerRenderer rend = new ProfileOrganizerRenderer(_context.profileOrganizer(), _context); ProfileOrganizerRenderer rend = new ProfileOrganizerRenderer(_context.profileOrganizer(), _context);
rend.renderStatusHTML(_out); rend.renderStatusHTML(_out, _full);
} catch (IOException ioe) { } catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
} }
@ -20,7 +26,8 @@ public class ProfilesHelper extends HelperBase {
/** @return empty string, writes directly to _out */ /** @return empty string, writes directly to _out */
public String getShitlistSummary() { public String getShitlistSummary() {
try { try {
_context.shitlist().renderStatusHTML(_out); ShitlistRenderer rend = new ShitlistRenderer(_context);
rend.renderStatusHTML(_out);
} catch (IOException ioe) { } catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
} }

View File

@ -0,0 +1,99 @@
package net.i2p.router.web;
/*
* free (adj.): unencumbered; not under the control of others
* Written by jrandom in 2003 and released into the public domain
* with no warranty of any kind, either expressed or implied.
* It probably won't make your computer catch on fire, or eat
* your children, but it might. Use at your own risk.
*
*/
import java.io.IOException;
import java.io.Writer;
import java.util.Comparator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import net.i2p.data.DataHelper;
import net.i2p.data.Hash;
import net.i2p.router.RouterContext;
import net.i2p.router.Shitlist;
/**
* Moved from Shitlist.java
*/
public class ShitlistRenderer {
private RouterContext _context;
public ShitlistRenderer(RouterContext context) {
_context = context;
}
private static class HashComparator implements Comparator {
public int compare(Object l, Object r) {
return ((Hash)l).toBase64().compareTo(((Hash)r).toBase64());
}
}
public void renderStatusHTML(Writer out) throws IOException {
StringBuilder buf = new StringBuilder(1024);
// move to the jsp
//buf.append("<h2>Banned Peers</h2>");
Map<Hash, Shitlist.Entry> entries = new TreeMap(new HashComparator());
entries.putAll(_context.shitlist().getEntries());
buf.append("<ul>");
for (Map.Entry<Hash, Shitlist.Entry> e : entries.entrySet()) {
Hash key = e.getKey();
Shitlist.Entry entry = e.getValue();
buf.append("<li>").append(_context.commSystem().renderPeerHTML(key));
buf.append(' ');
long expires = entry.expireOn-_context.clock().now();
String expireString = DataHelper.formatDuration(expires);
if (expires < 5l*24*60*60*1000)
buf.append(_("Temporary ban expiring in {0}", expireString));
else
buf.append(_("Banned until restart or in {0}", expireString));
Set transports = entry.transports;
if ( (transports != null) && (transports.size() > 0) )
buf.append(" on the following transport: ").append(transports);
if (entry.cause != null) {
buf.append("<br>\n");
if (entry.causeCode != null)
buf.append(_(entry.cause, entry.causeCode));
else
buf.append(_(entry.cause));
}
buf.append(" (<a href=\"configpeer.jsp?peer=").append(key.toBase64())
.append("#unsh\">").append(_("unban now")).append("</a>)");
buf.append("</li>\n");
}
buf.append("</ul>\n");
out.write(buf.toString());
out.flush();
}
/** translate a string */
private String _(String s) {
return Messages.getString(s, _context);
}
/**
* translate a string with a parameter
* This is a lot more expensive than _(s), so use sparingly.
*
* @param s string to be translated containing {0}
* The {0} will be replaced by the parameter.
* Single quotes must be doubled, i.e. ' -> '' in the string.
* @param o parameter, not translated.
* To tranlslate parameter also, use _("foo {0} bar", _("baz"))
* Do not double the single quotes in the parameter.
* Use autoboxing to call with ints, longs, floats, etc.
*/
private String _(String s, Object o) {
return Messages.getString(s, o, _context);
}
}

View File

@ -29,7 +29,7 @@ public class StatsGenerator {
public void generateStatsPage(Writer out) throws IOException { public void generateStatsPage(Writer out) throws IOException {
StringBuilder buf = new StringBuilder(16*1024); StringBuilder buf = new StringBuilder(16*1024);
buf.append("<div class=\"joblog\"><form action=\"/oldstats.jsp\">"); buf.append("<div class=\"joblog\"><form action=\"/stats.jsp\">");
buf.append("<select name=\"go\" onChange='location.href=this.value'>"); buf.append("<select name=\"go\" onChange='location.href=this.value'>");
out.write(buf.toString()); out.write(buf.toString());
buf.setLength(0); buf.setLength(0);
@ -39,11 +39,11 @@ public class StatsGenerator {
Map.Entry entry = (Map.Entry)iter.next(); Map.Entry entry = (Map.Entry)iter.next();
String group = (String)entry.getKey(); String group = (String)entry.getKey();
Set stats = (Set)entry.getValue(); Set stats = (Set)entry.getValue();
buf.append("<option value=\"/oldstats.jsp#").append(group).append("\">"); buf.append("<option value=\"/stats.jsp#").append(group).append("\">");
buf.append(group).append("</option>\n"); buf.append(group).append("</option>\n");
for (Iterator statIter = stats.iterator(); statIter.hasNext(); ) { for (Iterator statIter = stats.iterator(); statIter.hasNext(); ) {
String stat = (String)statIter.next(); String stat = (String)statIter.next();
buf.append("<option value=\"/oldstats.jsp#"); buf.append("<option value=\"/stats.jsp#");
buf.append(stat); buf.append(stat);
buf.append("\">..."); buf.append("\">...");
buf.append(stat); buf.append(stat);
@ -55,10 +55,10 @@ public class StatsGenerator {
buf.append("</select> <input type=\"submit\" value=\"GO\" />"); buf.append("</select> <input type=\"submit\" value=\"GO\" />");
buf.append("</form>"); buf.append("</form>");
buf.append("Statistics gathered during this router's uptime ("); buf.append(_("Statistics gathered during this router's uptime")).append(" (");
long uptime = _context.router().getUptime(); long uptime = _context.router().getUptime();
buf.append(DataHelper.formatDuration(uptime)); buf.append(DataHelper.formatDuration(uptime));
buf.append("). The data gathered is quantized over a 1 minute period, so should just be used as an estimate<p />"); buf.append("). ").append( _("The data gathered is quantized over a 1 minute period, so should just be used as an estimate."));
out.write(buf.toString()); out.write(buf.toString());
buf.setLength(0); buf.setLength(0);
@ -138,7 +138,7 @@ public class StatsGenerator {
buf.append("</i><br>"); buf.append("</i><br>");
} }
if (rate.getLifetimeEventCount() <= 0) { if (rate.getLifetimeEventCount() <= 0) {
buf.append("No lifetime events<br>&nbsp;<br>"); buf.append("No lifetime events<br>");
return; return;
} }
long now = _context.clock().now(); long now = _context.clock().now();

View File

@ -37,7 +37,7 @@ public class SummaryBarRenderer {
buf.append(linkhelper.getContent()); buf.append(linkhelper.getContent());
} else { } else {
buf.append("<h3><a href=\"/configclients.jsp\" target=\"_top\" title=\"") buf.append("<h3><a href=\"/configclients.jsp\" target=\"_top\" title=\"")
.append("Configure startup of clients and webapps (services); manually start dormant services") .append(_("Configure startup of clients and webapps (services); manually start dormant services"))
.append("\">") .append("\">")
.append(_("I2P Services")) .append(_("I2P Services"))
.append("</a></h3>\n" + .append("</a></h3>\n" +
@ -118,7 +118,7 @@ public class SummaryBarRenderer {
.append(_("Graphs")) .append(_("Graphs"))
.append("</a>\n" + .append("</a>\n" +
"<a href=\"oldstats.jsp\" target=\"_top\" title=\"") "<a href=\"stats.jsp\" target=\"_top\" title=\"")
.append(_("Textual router performance statistics")) .append(_("Textual router performance statistics"))
.append("\">") .append("\">")
.append(_("Stats")) .append(_("Stats"))
@ -143,7 +143,7 @@ public class SummaryBarRenderer {
.append(_("never reveal it to anyone")) .append(_("never reveal it to anyone"))
.append("\" href=\"netdb.jsp?r=.\" target=\"_top\">") .append("\" href=\"netdb.jsp?r=.\" target=\"_top\">")
.append(_("Local Identity")) .append(_("Local Identity"))
.append("<a></h4><hr>\n" + .append("</a></h4><hr>\n" +
"<table><tr><td align=\"left\">" + "<table><tr><td align=\"left\">" +
"<b>") "<b>")
@ -287,9 +287,9 @@ public class SummaryBarRenderer {
if (prev != null) System.setProperty("net.i2p.router.web.ReseedHandler.noncePrev", prev); if (prev != null) System.setProperty("net.i2p.router.web.ReseedHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ReseedHandler.nonce", nonce+""); System.setProperty("net.i2p.router.web.ReseedHandler.nonce", nonce+"");
String uri = _helper.getRequestURI(); String uri = _helper.getRequestURI();
buf.append("<form action=\"").append(uri).append("\" method=\"GET\">\n"); buf.append("<p><form action=\"").append(uri).append("\" method=\"GET\">\n");
buf.append("<input type=\"hidden\" name=\"reseedNonce\" value=\"").append(nonce).append("\" >\n"); buf.append("<input type=\"hidden\" name=\"reseedNonce\" value=\"").append(nonce).append("\" >\n");
buf.append("<button type=\"submit\" >Reseed</button></form>\n"); buf.append("<button type=\"submit\" value=\"Reseed\" >").append(_("Reseed")).append("</button></form></p>\n");
} }
anotherLine = true; anotherLine = true;
} }
@ -401,7 +401,7 @@ public class SummaryBarRenderer {
.append("</td></tr>\n" + .append("</td></tr>\n" +
"</table><hr><h4>") "</table><hr><h4>")
.append(_helper.getTunnelStatus()) .append(_(_helper.getTunnelStatus()))
.append("</h4><hr>\n") .append("</h4><hr>\n")
.append(_helper.getDestinations()); .append(_helper.getDestinations());

View File

@ -70,7 +70,7 @@ public class SummaryHelper extends HelperBase {
long diff = Math.abs(ms); long diff = Math.abs(ms);
if (diff < 3000) if (diff < 3000)
return ""; return "";
return " (" + DataHelper.formatDuration(diff) + " skew)"; return " (" + DataHelper.formatDuration(diff) + " " + _("skew") + ")";
} }
public boolean allowReseed() { public boolean allowReseed() {
@ -89,42 +89,42 @@ public class SummaryHelper extends HelperBase {
private String reachability() { private String reachability() {
if (_context.router().getUptime() > 60*1000 && (!_context.router().gracefulShutdownInProgress()) && if (_context.router().getUptime() > 60*1000 && (!_context.router().gracefulShutdownInProgress()) &&
!_context.clientManager().isAlive()) !_context.clientManager().isAlive())
return "ERR-Client Manager I2CP Error - check logs"; // not a router problem but the user should know return _("ERR-Client Manager I2CP Error - check logs"); // not a router problem but the user should know
if (!_context.clock().getUpdatedSuccessfully()) if (!_context.clock().getUpdatedSuccessfully())
return "ERR-ClockSkew"; return _("ERR-ClockSkew");
if (_context.router().isHidden()) if (_context.router().isHidden())
return "Hidden"; return _("Hidden");
int status = _context.commSystem().getReachabilityStatus(); int status = _context.commSystem().getReachabilityStatus();
switch (status) { switch (status) {
case CommSystemFacade.STATUS_OK: case CommSystemFacade.STATUS_OK:
RouterAddress ra = _context.router().getRouterInfo().getTargetAddress("NTCP"); RouterAddress ra = _context.router().getRouterInfo().getTargetAddress("NTCP");
if (ra == null || (new NTCPAddress(ra)).isPubliclyRoutable()) if (ra == null || (new NTCPAddress(ra)).isPubliclyRoutable())
return "OK"; return _("OK");
return "ERR-Private TCP Address"; return _("ERR-Private TCP Address");
case CommSystemFacade.STATUS_DIFFERENT: case CommSystemFacade.STATUS_DIFFERENT:
return "ERR-SymmetricNAT"; return _("ERR-SymmetricNAT");
case CommSystemFacade.STATUS_REJECT_UNSOLICITED: case CommSystemFacade.STATUS_REJECT_UNSOLICITED:
if (_context.router().getRouterInfo().getTargetAddress("NTCP") != null) if (_context.router().getRouterInfo().getTargetAddress("NTCP") != null)
return "WARN-Firewalled with Inbound TCP Enabled"; return _("WARN-Firewalled with Inbound TCP Enabled");
if (((FloodfillNetworkDatabaseFacade)_context.netDb()).floodfillEnabled()) if (((FloodfillNetworkDatabaseFacade)_context.netDb()).floodfillEnabled())
return "WARN-Firewalled and Floodfill"; return _("WARN-Firewalled and Floodfill");
if (_context.router().getRouterInfo().getCapabilities().indexOf('O') >= 0) if (_context.router().getRouterInfo().getCapabilities().indexOf('O') >= 0)
return "WARN-Firewalled and Fast"; return _("WARN-Firewalled and Fast");
return "Firewalled"; return _("Firewalled");
case CommSystemFacade.STATUS_HOSED: case CommSystemFacade.STATUS_HOSED:
return "ERR-UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart"; return _("ERR-UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart");
case CommSystemFacade.STATUS_UNKNOWN: // fallthrough case CommSystemFacade.STATUS_UNKNOWN: // fallthrough
default: default:
ra = _context.router().getRouterInfo().getTargetAddress("SSU"); ra = _context.router().getRouterInfo().getTargetAddress("SSU");
if (ra == null && _context.router().getUptime() > 5*60*1000) { if (ra == null && _context.router().getUptime() > 5*60*1000) {
if (_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME) == null || if (_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME) == null ||
_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT) == null) _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT) == null)
return "ERR-UDP Disabled and Inbound TCP host/port not set"; return _("ERR-UDP Disabled and Inbound TCP host/port not set");
else else
return "WARN-Firewalled with UDP Disabled"; return _("WARN-Firewalled with UDP Disabled");
} }
return "Testing"; return _("Testing");
} }
} }
@ -357,7 +357,7 @@ public class SummaryHelper extends HelperBase {
Collections.sort(clients, new AlphaComparator()); Collections.sort(clients, new AlphaComparator());
StringBuilder buf = new StringBuilder(512); StringBuilder buf = new StringBuilder(512);
buf.append("<h3><a href=\"i2ptunnel/index.jsp\" target=\"_blank\" title=\"Add/remove/edit &amp; control your client and server tunnels (local destinations).\" title=\"View existing tunnels and tunnel build status.\">Local destinations</a></h3><hr><table>"); buf.append("<h3><a href=\"i2ptunnel/index.jsp\" target=\"_blank\" title=\"").append(_("Add/remove/edit &amp; control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr><div class=\"tunnels\"><table>");
for (Iterator iter = clients.iterator(); iter.hasNext(); ) { for (Iterator iter = clients.iterator(); iter.hasNext(); ) {
Destination client = (Destination)iter.next(); Destination client = (Destination)iter.next();
@ -366,11 +366,11 @@ public class SummaryHelper extends HelperBase {
buf.append("<tr><td align=\"right\"><img src=\"/themes/console/images/"); buf.append("<tr><td align=\"right\"><img src=\"/themes/console/images/");
if (_context.clientManager().shouldPublishLeaseSet(h)) if (_context.clientManager().shouldPublishLeaseSet(h))
buf.append("server.png\" alt=\"Server\" title=\"Server\">"); buf.append("server.png\" alt=\"Server\" title=\"" + _("Server") + "\">");
else else
buf.append("client.png\" alt=\"Client\" title=\"Client\">"); buf.append("client.png\" alt=\"Client\" title=\"" + _("Client") + "\">");
buf.append("</td><td align=\"left\"><b><a href=\"tunnels.jsp#").append(h.toBase64().substring(0,4)); buf.append("</td><td align=\"left\"><b><a href=\"tunnels.jsp#").append(h.toBase64().substring(0,4));
buf.append("\" target=\"_top\" title=\"Show tunnels\">"); buf.append("\" target=\"_top\" title=\"" + _("Show tunnels") + "\">");
if (name.length() < 16) if (name.length() < 16)
buf.append(name); buf.append(name);
else else
@ -381,33 +381,36 @@ public class SummaryHelper extends HelperBase {
long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now(); long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now();
if (timeToExpire < 0) { if (timeToExpire < 0) {
// red or yellow light // red or yellow light
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"Rebuilding&hellip;\" title=\"Leases expired ").append(DataHelper.formatDuration(0-timeToExpire)); buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_("Rebuilding")).append("&hellip;\" title=\"").append(_("Leases expired")).append(" ").append(DataHelper.formatDuration(0-timeToExpire));
buf.append(" ago. Rebuilding&hellip;\"></td></tr>\n"); buf.append(" ").append(_("ago")).append(". ").append(_("Rebuilding")).append("&hellip;\"></td></tr>\n");
} else { } else {
// green light // green light
buf.append("<td><img src=\"/themes/console/images/local_up.png\" alt=\"Ready\" title=\"Ready\"></td></tr>\n"); buf.append("<td><img src=\"/themes/console/images/local_up.png\" alt=\"Ready\" title=\"").append(_("Ready")).append("\"></td></tr>\n");
} }
} else { } else {
// yellow light // yellow light
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"Building&hellip;\" title=\"Tunnel building in progress&hellip;\"></td></tr>\n"); buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_("Building")).append("&hellip;\" title=\"").append(_("Building tunnels")).append("&hellip;\"></td></tr>\n");
} }
} }
buf.append("</table><hr>\n"); buf.append("</table></div><hr>\n");
return buf.toString(); return buf.toString();
} }
/** compare translated nicknames - put "shared clients" first in the sort */
private class AlphaComparator implements Comparator { private class AlphaComparator implements Comparator {
public int compare(Object lhs, Object rhs) { public int compare(Object lhs, Object rhs) {
String lname = getName((Destination)lhs); String lname = getName((Destination)lhs);
String rname = getName((Destination)rhs); String rname = getName((Destination)rhs);
if (lname.equals("shared clients")) String xsc = _("shared clients");
if (lname.equals(xsc))
return -1; return -1;
if (rname.equals("shared clients")) if (rname.equals(xsc))
return 1; return 1;
return Collator.getInstance().compare(lname, rname); return Collator.getInstance().compare(lname, rname);
} }
} }
/** translate here so collation works above */
private String getName(Destination d) { private String getName(Destination d) {
TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(d.calculateHash()); TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(d.calculateHash());
String name = (in != null ? in.getDestinationNickname() : null); String name = (in != null ? in.getDestinationNickname() : null);
@ -416,6 +419,10 @@ public class SummaryHelper extends HelperBase {
name = (out != null ? out.getDestinationNickname() : null); name = (out != null ? out.getDestinationNickname() : null);
if (name == null) if (name == null)
name = d.calculateHash().toBase64().substring(0,6); name = d.calculateHash().toBase64().substring(0,6);
else
name = _(name);
} else {
name = _(name);
} }
return name; return name;
} }

View File

@ -37,7 +37,7 @@ public class TunnelRenderer {
} }
public void renderStatusHTML(Writer out) throws IOException { public void renderStatusHTML(Writer out) throws IOException {
out.write("<div class=\"wideload\"><h2><a name=\"exploratory\" ></a>Exploratory tunnels (<a href=\"/configtunnels.jsp#exploratory\">config</a>):</h2>\n"); out.write("<div class=\"wideload\"><h2><a name=\"exploratory\" ></a>" + _("Exploratory tunnels") + " (<a href=\"/configtunnels.jsp#exploratory\">" + _("configure") + "</a>)</h2>\n");
renderPool(out, _context.tunnelManager().getInboundExploratoryPool(), _context.tunnelManager().getOutboundExploratoryPool()); renderPool(out, _context.tunnelManager().getInboundExploratoryPool(), _context.tunnelManager().getOutboundExploratoryPool());
List<Hash> destinations = null; List<Hash> destinations = null;
@ -50,26 +50,27 @@ public class TunnelRenderer {
TunnelPool outPool = null; TunnelPool outPool = null;
in = clientInboundPools.get(client); in = clientInboundPools.get(client);
outPool = clientOutboundPools.get(client); outPool = clientOutboundPools.get(client);
// TODO the following code is duplicated in SummaryHelper
String name = (in != null ? in.getSettings().getDestinationNickname() : null); String name = (in != null ? in.getSettings().getDestinationNickname() : null);
if ( (name == null) && (outPool != null) ) if ( (name == null) && (outPool != null) )
name = outPool.getSettings().getDestinationNickname(); name = outPool.getSettings().getDestinationNickname();
if (name == null) if (name == null)
name = client.toBase64().substring(0,4); name = client.toBase64().substring(0,4);
out.write("<h2><a name=\"" + client.toBase64().substring(0,4) out.write("<h2><a name=\"" + client.toBase64().substring(0,4)
+ "\" ></a>Client tunnels for " + name); + "\" ></a>" + _("Client tunnels for") + ' ' + _(name));
if (_context.clientManager().isLocal(client)) if (_context.clientManager().isLocal(client))
out.write(" (<a href=\"/configtunnels.jsp#" + client.toBase64().substring(0,4) +"\">config</a>):</h2>\n"); out.write(" (<a href=\"/configtunnels.jsp#" + client.toBase64().substring(0,4) +"\">" + _("configure") + "</a>)</h2>\n");
else else
out.write(" (dead):</h2>\n"); out.write(" (" + _("dead") + ")</h2>\n");
renderPool(out, in, outPool); renderPool(out, in, outPool);
} }
List participating = _context.tunnelDispatcher().listParticipatingTunnels(); List participating = _context.tunnelDispatcher().listParticipatingTunnels();
Collections.sort(participating, new TunnelComparator()); Collections.sort(participating, new TunnelComparator());
out.write("<h2><a name=\"participating\"></a>Participating tunnels:</h2><table>\n"); out.write("<h2><a name=\"participating\"></a>" + _("Participating tunnels") + "</h2><table>\n");
out.write("<tr><th>Receive on</th><th>From</th><th>" out.write("<tr><th>" + _("Receive on") + "</th><th>" + _("From") + "</th><th>"
+ "Send on</th><th>To</th><th>Expiration</th>" + _("Send on") + "</th><th>" + _("To") + "</th><th>" + _("Expiration") + "</th>"
+ "<th>Usage</th><th>Rate</th><th>Role</th></tr>\n"); + "<th>" + _("Usage") + "</th><th>" + _("Rate") + "</th><th>" + _("Role") + "</th></tr>\n");
long processed = 0; long processed = 0;
RateStat rs = _context.statManager().getRate("tunnel.participatingMessageCount"); RateStat rs = _context.statManager().getRate("tunnel.participatingMessageCount");
if (rs != null) if (rs != null)
@ -103,7 +104,7 @@ public class TunnelRenderer {
if (timeLeft > 0) if (timeLeft > 0)
out.write(" <td class=\"cells\" align=\"center\">" + DataHelper.formatDuration(timeLeft) + "</td>"); out.write(" <td class=\"cells\" align=\"center\">" + DataHelper.formatDuration(timeLeft) + "</td>");
else else
out.write(" <td class=\"cells\" align=\"center\">(grace period)</td>"); out.write(" <td class=\"cells\" align=\"center\">(" + _("grace period") + ")</td>");
out.write(" <td class=\"cells\" align=\"center\">" + cfg.getProcessedMessagesCount() + "KB</td>"); out.write(" <td class=\"cells\" align=\"center\">" + cfg.getProcessedMessagesCount() + "KB</td>");
int lifetime = (int) ((_context.clock().now() - cfg.getCreation()) / 1000); int lifetime = (int) ((_context.clock().now() - cfg.getCreation()) / 1000);
if (lifetime <= 0) if (lifetime <= 0)
@ -113,17 +114,17 @@ public class TunnelRenderer {
int bps = 1024 * (int) cfg.getProcessedMessagesCount() / lifetime; int bps = 1024 * (int) cfg.getProcessedMessagesCount() / lifetime;
out.write(" <td class=\"cells\" align=\"center\">" + bps + "Bps</td>"); out.write(" <td class=\"cells\" align=\"center\">" + bps + "Bps</td>");
if (cfg.getSendTo() == null) if (cfg.getSendTo() == null)
out.write(" <td class=\"cells\" align=\"center\">Outbound Endpoint</td>"); out.write(" <td class=\"cells\" align=\"center\">" + _("Outbound Endpoint") + "</td>");
else if (cfg.getReceiveFrom() == null) else if (cfg.getReceiveFrom() == null)
out.write(" <td class=\"cells\" align=\"center\">Inbound Gateway</td>"); out.write(" <td class=\"cells\" align=\"center\">" + _("Inbound Gateway") + "</td>");
else else
out.write(" <td class=\"cells\" align=\"center\">Participant</td>"); out.write(" <td class=\"cells\" align=\"center\">" + _("Participant") + "</td>");
out.write("</tr>\n"); out.write("</tr>\n");
processed += cfg.getProcessedMessagesCount(); processed += cfg.getProcessedMessagesCount();
} }
out.write("</table>\n"); out.write("</table>\n");
out.write("<div class=\"statusnotes\"><b>Inactive participating tunnels: " + inactive + "</b></div>\n"); out.write("<div class=\"statusnotes\"><b>" + _("Inactive participating tunnels") + ": " + inactive + "</b></div>\n");
out.write("<div class=\"statusnotes\"><b>Lifetime bandwidth usage: " + DataHelper.formatSize(processed*1024) + "B</b></div>\n"); out.write("<div class=\"statusnotes\"><b>" + _("Lifetime bandwidth usage") + ": " + DataHelper.formatSize(processed*1024) + "B</b></div>\n");
renderPeers(out); renderPeers(out);
} }
@ -152,16 +153,16 @@ public class TunnelRenderer {
if (info.getLength() > maxLength) if (info.getLength() > maxLength)
maxLength = info.getLength(); maxLength = info.getLength();
} }
out.write("<table><tr><th>In/Out</th><th>Expiry</th><th>Usage</th><th>Gateway</th>"); out.write("<table><tr><th>" + _("In/Out") + "</th><th>" + _("Expiry") + "</th><th>" + _("Usage") + "</th><th>" + _("Gateway") + "</th>");
if (maxLength > 3) { if (maxLength > 3) {
out.write("<th align=\"center\" colspan=\"" + (maxLength - 2)); out.write("<th align=\"center\" colspan=\"" + (maxLength - 2));
out.write("\">Participants</th>"); out.write("\">" + _("Participants") + "</th>");
} }
else if (maxLength == 3) { else if (maxLength == 3) {
out.write("<th>Participant</th>"); out.write("<th>" + _("Participant") + "</th>");
} }
if (maxLength > 1) { if (maxLength > 1) {
out.write("<th>Endpoint</th>"); out.write("<th>" + _("Endpoint") + "</th>");
} }
out.write("</tr>\n"); out.write("</tr>\n");
for (int i = 0; i < tunnels.size(); i++) { for (int i = 0; i < tunnels.size(); i++) {
@ -201,19 +202,19 @@ public class TunnelRenderer {
if (in != null) { if (in != null) {
List pending = in.listPending(); List pending = in.listPending();
if (pending.size() > 0) if (pending.size() > 0)
out.write("<div class=\"statusnotes\"><center><b>Build in progress: " + pending.size() + " inbound</b></center></div>\n"); out.write("<div class=\"statusnotes\"><center><b>" + _("Build in progress") + ": " + pending.size() + " " + _("inbound") + "</b></center></div>\n");
live += pending.size(); live += pending.size();
} }
if (outPool != null) { if (outPool != null) {
List pending = outPool.listPending(); List pending = outPool.listPending();
if (pending.size() > 0) if (pending.size() > 0)
out.write("<div class=\"statusnotes\"><center><b>Build in progress: " + pending.size() + " outbound</b></center></div>\n"); out.write("<div class=\"statusnotes\"><center><b>" + _("Build in progress") + ": " + pending.size() + " " + _("outbound") + "</b></center></div>\n");
live += pending.size(); live += pending.size();
} }
if (live <= 0) if (live <= 0)
out.write("<div class=\"statusnotes\"><center><b>No tunnels; waiting for the grace period to end.</center></b></div>\n"); out.write("<div class=\"statusnotes\"><center><b>" + _("No tunnels; waiting for the grace period to end.") + "</center></b></div>\n");
out.write("<div class=\"statusnotes\"><center><b>Lifetime bandwidth usage: " + DataHelper.formatSize(processedIn*1024) + "B in, " + out.write("<div class=\"statusnotes\"><center><b>" + _("Lifetime bandwidth usage") + ": " + DataHelper.formatSize(processedIn*1024) + "B " + _("in") + ", " +
DataHelper.formatSize(processedOut*1024) + "B out</b></center></div>"); DataHelper.formatSize(processedOut*1024) + "B " + _("out") + "</b></center></div>");
} }
private void renderPeers(Writer out) throws IOException { private void renderPeers(Writer out) throws IOException {
@ -230,8 +231,8 @@ public class TunnelRenderer {
List<Hash> peerList = new ArrayList(peers); List<Hash> peerList = new ArrayList(peers);
Collections.sort(peerList, new HashComparator()); Collections.sort(peerList, new HashComparator());
out.write("<h2><a name=\"peers\"></a>Tunnel Counts By Peer:</h2>\n"); out.write("<h2><a name=\"peers\"></a>" + _("Tunnel Counts By Peer") + "</h2>\n");
out.write("<table><tr><th>Peer</th><th>Expl. + Client</th><th>% of total</th><th>Part. from + to</th><th>% of total</th></tr>\n"); out.write("<table><tr><th>" + _("Peer") + "</th><th>" + _("Expl. + Client") + "</th><th>" + _("% of total") + "</th><th>" + _("Part. from + to") + "</th><th>" + _("% of total") + "</th></tr>\n");
for (Hash h : peerList) { for (Hash h : peerList) {
out.write("<tr> <td class=\"cells\" align=\"center\">"); out.write("<tr> <td class=\"cells\" align=\"center\">");
out.write(netDbLink(h)); out.write(netDbLink(h));
@ -249,7 +250,7 @@ public class TunnelRenderer {
out.write('0'); out.write('0');
out.write('\n'); out.write('\n');
} }
out.write("<tr class=\"tablefooter\"> <td align=\"center\"><b>Tunnels</b> <td align=\"center\"><b>" + tunnelCount); out.write("<tr class=\"tablefooter\"> <td align=\"center\"><b>" + _("Tunnels") + "</b> <td align=\"center\"><b>" + tunnelCount);
out.write("</b> <td>&nbsp;</td> <td align=\"center\"><b>" + partCount); out.write("</b> <td>&nbsp;</td> <td align=\"center\"><b>" + partCount);
out.write("</b> <td>&nbsp;</td></tr></table></div>\n"); out.write("</b> <td>&nbsp;</td></tr></table></div>\n");
} }

View File

@ -0,0 +1,56 @@
package dummy;
/**
* Just more strings for xgettext, that don't appear in the source anywhere.
* I'm sure there's easier ways to do this, but this will do for now.
*
* Obviously, do not compile this.
*/
class Dummy {
void dummy {
// wars for ConfigClientsHelper
_("addressbook");
_("i2psnark");
_("i2ptunnel");
_("susimail");
_("susidns");
_("routerconsole");
// clients, taken from clients.config, for ConfigClientsHelper
// note that if the wording changes in clients.config, we have to
// keep the old string here as well for existing installs
_("Web console");
_("SAM application bridge");
_("Application tunnels");
_("My eepsite web server");
_("I2P webserver (eepsite)");
_("Browser launch at startup");
_("BOB application bridge");
_("I2P Router Console");
_("Open Router Console in web browser at startup");
// tunnel nicknames, taken from i2ptunnel.config so they will display
// nicely under 'local destinations' in the summary bar
// note that if the wording changes in i2ptunnel.config, we have to
// keep the old string here as well for existing installs
_("shared clients");
_("IRC proxy");
_("eepsite");
_("I2P webserver");
_("HTTP Proxy");
// older names for pre-0.7.4 installs
_("eepProxy");
_("ircProxy");
// hardcoded in i2psnark
_("I2PSnark");
// hardcoded in iMule?
_("iMule");
// standard themes for ConfigUIHelper
_("classic");
_("dark");
_("light");
_("midnight");
}
}

View File

@ -1,18 +1,19 @@
<%@page contentType="text/html" %> <%@page contentType="text/html" %>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head> <html><head>
<title>I2P Router Console - config networking</title> <%@include file="css.jsi" %>
<%@include file="css.jsp" %> <%=intl.title("config networking")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigNetHelper" id="nethelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigNetHelper" id="nethelper" scope="request" />
<jsp:setProperty name="nethelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="nethelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<h1>I2P Network Configuration</h1> <h1><%=intl._("I2P Network Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigNetHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigNetHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" /> <jsp:setProperty name="formhandler" property="*" />
@ -25,10 +26,11 @@
System.setProperty("net.i2p.router.web.ConfigNetHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigNetHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigNetHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigNetHandler.nonce")%>" />
<input type="hidden" name="action" value="blah" /> <input type="hidden" name="action" value="blah" />
<h3>Bandwidth limiter</h3><p> <h3><%=intl._("Bandwidth limiter")%></h3><p>
<b>I2P will work best if you configure your rates to match the speed of your internet connection.</b> <b><%=intl._("I2P will work best if you configure your rates to match the speed of your internet connection.")%></b>
</p> </p>
<div class="wideload"><table><tr><td><input style="text-align: right; width: 5em;" name="inboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="inboundRate" />" /> KBps In <div class="wideload"><p><table><tr><td><input style="text-align: right; width: 5em;" name="inboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="inboundRate" />" />
<%=intl._("KBps In")%>
</td><td>(<jsp:getProperty name="nethelper" property="inboundRateBits" />)</td> </td><td>(<jsp:getProperty name="nethelper" property="inboundRateBits" />)</td>
<!-- let's keep this simple... <!-- let's keep this simple...
bursting up to bursting up to
@ -36,7 +38,8 @@
<jsp:getProperty name="nethelper" property="inboundBurstFactorBox" /><br> <jsp:getProperty name="nethelper" property="inboundBurstFactorBox" /><br>
--> -->
</tr><tr> </tr><tr>
<td><input style="text-align: right; width: 5em;" name="outboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="outboundRate" />" /> KBps Out <td><input style="text-align: right; width: 5em;" name="outboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="outboundRate" />" />
<%=intl._("KBps Out")%>
</td><td>(<jsp:getProperty name="nethelper" property="outboundRateBits" />)</td> </td><td>(<jsp:getProperty name="nethelper" property="outboundRateBits" />)</td>
<!-- let's keep this simple... <!-- let's keep this simple...
bursting up to bursting up to
@ -46,22 +49,30 @@
A negative rate sets the default.</i><br> A negative rate sets the default.</i><br>
--> -->
</tr><tr> </tr><tr>
<td><jsp:getProperty name="nethelper" property="sharePercentageBox" /> Share</td> <td><jsp:getProperty name="nethelper" property="sharePercentageBox" /> <%=intl._("Share")%></td>
<td>(<jsp:getProperty name="nethelper" property="shareRateBits" />) <td>(<jsp:getProperty name="nethelper" property="shareRateBits" />)
</td></tr></table></div></p> </td></tr></table></p></div></p>
<% int share = nethelper.getShareBandwidth(); <% int share = nethelper.getShareBandwidth();
if (share < 12) { if (share < 12) {
out.print("<b>NOTE</b>: You have configured I2P to share only " + share + "KBps. "); out.print("<p><b>");
out.print("I2P requires at least 12KBps to enable sharing. "); out.print(intl._("NOTE"));
out.print("Please enable sharing (participating in tunnels) by configuring more bandwidth. "); out.print("</b>: ");
out.print("It improves your anonymity by creating cover traffic, and helps the network.<br>"); out.print(intl._("You have configured I2P to share only {0} KBps.", share));
out.print("\n");
out.print(intl._("I2P requires at least 12KBps to enable sharing. "));
out.print(intl._("Please enable sharing (participating in tunnels) by configuring more bandwidth. "));
out.print(intl._("It improves your anonymity by creating cover traffic, and helps the network.")+"</p>");
} else { } else {
out.print("You have configured I2P to share<b> " + share + "KBps</b>. "); out.print("<p>");
out.print("The higher the share bandwidth the more you improve your anonymity and help the network.<hr>"); out.print(intl._("You have configured I2P to share {0} KBps.", share));
out.print("\n");
out.print(intl._("The higher the share bandwidth the more you improve your anonymity and help the network.")+"</p><hr>");
} }
%> %>
<div class="formaction"> <div class="formaction">
<input type="submit" name="save" value="Save changes" /> <input type="reset" value="Cancel" /></div> <input type="submit" name="save" value="<%=intl._("Save changes")%>" /> <input type="reset" value="<%=intl._("Cancel")%>" /></div>
<!-- <!--
<b>Enable load testing: </b> <b>Enable load testing: </b>
<input type="checkbox" class="optbox" name="enableloadtesting" value="true" <jsp:getProperty name="nethelper" property="enableLoadTesting" /> /> <input type="checkbox" class="optbox" name="enableloadtesting" value="true" <jsp:getProperty name="nethelper" property="enableLoadTesting" /> />
@ -72,27 +83,28 @@
<a href="oldstats.jsp#test.rtt">test.rtt</a> and related stats.</p> <a href="oldstats.jsp#test.rtt">test.rtt</a> and related stats.</p>
<br> <br>
--> -->
<h3>IP and Transport Configuration</h3><p> <h3><%=intl._("IP and Transport Configuration")%></h3><p>
<b>The default settings will work for most people. There is <a href="#chelp">help below</a>.</b> <b><%=intl._("The default settings will work for most people.")%>
</p><p><b>UPnP Configuration:</b><br> <a href="#chelp"><%=intl._("There is help below.")%></a></b>
</p><p><b><%=intl._("UPnP Configuration")%>:</b><br>
<input type="checkbox" class="optbox" name="upnp" value="true" <jsp:getProperty name="nethelper" property="upnpChecked" /> /> <input type="checkbox" class="optbox" name="upnp" value="true" <jsp:getProperty name="nethelper" property="upnpChecked" /> />
Enable UPnP to open firewall ports - <a href="peers.jsp#upnp">UPnP status</a> <%=intl._("Enable UPnP to open firewall ports")%> - <a href="peers.jsp#upnp"><%=intl._("UPnP status")%></a>
</p><p><b>IP Configuration:</b><br> </p><p><b><%=intl._("IP Configuration")%>:</b><br>
Externally reachable hostname or IP address:<br> <%=intl._("Externally reachable hostname or IP address")%>:<br>
<input type="radio" class="optbox" name="udpAutoIP" value="local,upnp,ssu" <%=nethelper.getUdpAutoIPChecked(3) %> /> <input type="radio" class="optbox" name="udpAutoIP" value="local,upnp,ssu" <%=nethelper.getUdpAutoIPChecked(3) %> />
Use all auto-detect methods<br> <%=intl._("Use all auto-detect methods")%><br>
<input type="radio" class="optbox" name="udpAutoIP" value="local,ssu" <%=nethelper.getUdpAutoIPChecked(4) %> /> <input type="radio" class="optbox" name="udpAutoIP" value="local,ssu" <%=nethelper.getUdpAutoIPChecked(4) %> />
Disable UPnP IP address detection<br> <%=intl._("Disable UPnP IP address detection")%><br>
<input type="radio" class="optbox" name="udpAutoIP" value="upnp,ssu" <%=nethelper.getUdpAutoIPChecked(5) %> /> <input type="radio" class="optbox" name="udpAutoIP" value="upnp,ssu" <%=nethelper.getUdpAutoIPChecked(5) %> />
Ignore local interface IP address<br> <%=intl._("Ignore local interface IP address")%><br>
<input type="radio" class="optbox" name="udpAutoIP" value="ssu" <%=nethelper.getUdpAutoIPChecked(0) %> /> <input type="radio" class="optbox" name="udpAutoIP" value="ssu" <%=nethelper.getUdpAutoIPChecked(0) %> />
Use SSU IP address detection only<br> <%=intl._("Use SSU IP address detection only")%><br>
<input type="radio" class="optbox" name="udpAutoIP" value="fixed" <%=nethelper.getUdpAutoIPChecked(1) %> /> <input type="radio" class="optbox" name="udpAutoIP" value="fixed" <%=nethelper.getUdpAutoIPChecked(1) %> />
Specify hostname or IP: <%=intl._("Specify hostname or IP")%>:
<input name ="udpHost1" type="text" size="16" value="<jsp:getProperty name="nethelper" property="udphostname" />" /> <input name ="udpHost1" type="text" size="16" value="<jsp:getProperty name="nethelper" property="udphostname" />" />
<% String[] ips = nethelper.getAddresses(); <% String[] ips = nethelper.getAddresses();
if (ips.length > 0) { if (ips.length > 0) {
out.print(" or <select name=\"udpHost2\"><option value=\"\" selected=\"true\">Select Interface</option>\n"); out.print(intl._("or") + " <select name=\"udpHost2\"><option value=\"\" selected=\"true\">"+intl._("Select Interface")+"</option>\n");
for (int i = 0; i < ips.length; i++) { for (int i = 0; i < ips.length; i++) {
out.print("<option value=\""); out.print("<option value=\"");
out.print(ips[i]); out.print(ips[i]);
@ -105,9 +117,9 @@
%> %>
<br> <br>
<input type="radio" class="optbox" name="udpAutoIP" value="hidden" <%=nethelper.getUdpAutoIPChecked(2) %> /> <input type="radio" class="optbox" name="udpAutoIP" value="hidden" <%=nethelper.getUdpAutoIPChecked(2) %> />
Hidden mode - do not publish IP <i>(prevents participating traffic)</i><br> <%=intl._("Hidden mode - do not publish IP")%> <i><%=intl._("(prevents participating traffic)")%></i><br>
</p><p><b>UDP Configuration:</b><br> </p><p><b><%=intl._("UDP Configuration:")%></b><br>
UDP port: <%=intl._("UDP port:")%>
<input name ="udpPort" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="configuredUdpPort" />" /><br> <input name ="udpPort" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="configuredUdpPort" />" /><br>
<!-- let's keep this simple... <!-- let's keep this simple...
<input type="checkbox" class="optbox" name="requireIntroductions" value="true" <jsp:getProperty name="nethelper" property="requireIntroductionsChecked" /> /> <input type="checkbox" class="optbox" name="requireIntroductions" value="true" <jsp:getProperty name="nethelper" property="requireIntroductionsChecked" /> />
@ -117,123 +129,118 @@
Current External UDP address: <i><jsp:getProperty name="nethelper" property="udpAddress" /></i><br> Current External UDP address: <i><jsp:getProperty name="nethelper" property="udpAddress" /></i><br>
--> -->
</p><p> </p><p>
<b>TCP Configuration:</b><br> <b><%=intl._("TCP Configuration")%>:</b><br>
Externally reachable hostname or IP address:<br> <%=intl._("Externally reachable hostname or IP address")%>:<br>
<input type="radio" class="optbox" name="ntcpAutoIP" value="true" <%=nethelper.getTcpAutoIPChecked(2) %> /> <input type="radio" class="optbox" name="ntcpAutoIP" value="true" <%=nethelper.getTcpAutoIPChecked(2) %> />
Use auto-detected IP address <%=intl._("Use auto-detected IP address")%>
<i>(currently <jsp:getProperty name="nethelper" property="udpIP" />)</i> <i>(<%=intl._("currently")%> <jsp:getProperty name="nethelper" property="udpIP" />)</i>
if we are not firewalled<br> <%=intl._("if we are not firewalled")%><br>
<input type="radio" class="optbox" name="ntcpAutoIP" value="always" <%=nethelper.getTcpAutoIPChecked(3) %> /> <input type="radio" class="optbox" name="ntcpAutoIP" value="always" <%=nethelper.getTcpAutoIPChecked(3) %> />
Always use auto-detected IP address (Not firewalled)<br> <%=intl._("Always use auto-detected IP address (Not firewalled)")%><br>
<input type="radio" class="optbox" name="ntcpAutoIP" value="false" <%=nethelper.getTcpAutoIPChecked(1) %> /> <input type="radio" class="optbox" name="ntcpAutoIP" value="false" <%=nethelper.getTcpAutoIPChecked(1) %> />
Specify hostname or IP: <%=intl._("Specify hostname or IP")%>:
<input name ="ntcphost" type="text" size="16" value="<jsp:getProperty name="nethelper" property="ntcphostname" />" /><br> <input name ="ntcphost" type="text" size="16" value="<jsp:getProperty name="nethelper" property="ntcphostname" />" /><br>
<input type="radio" class="optbox" name="ntcpAutoIP" value="false" <%=nethelper.getTcpAutoIPChecked(0) %> /> <input type="radio" class="optbox" name="ntcpAutoIP" value="false" <%=nethelper.getTcpAutoIPChecked(0) %> />
Disable inbound (Firewalled)<br> <%=intl._("Disable inbound (Firewalled)")%><br>
<input type="radio" class="optbox" name="ntcpAutoIP" value="disabled" <%=nethelper.getTcpAutoIPChecked(4) %> /> <input type="radio" class="optbox" name="ntcpAutoIP" value="disabled" <%=nethelper.getTcpAutoIPChecked(4) %> />
Completely disable <i>(select only if behind a firewall that throttles or blocks outbound TCP)</i><br> <%=intl._("Completely disable")%> <i><%=intl._("(select only if behind a firewall that throttles or blocks outbound TCP)")%></i><br>
</p><p> </p><p>
Externally reachable TCP port:<br> <%=intl._("Externally reachable TCP port")%>:<br>
<input type="radio" class="optbox" name="ntcpAutoPort" value="2" <%=nethelper.getTcpAutoPortChecked(2) %> /> <input type="radio" class="optbox" name="ntcpAutoPort" value="2" <%=nethelper.getTcpAutoPortChecked(2) %> />
Use the same port configured for UDP <%=intl._("Use the same port configured for UDP")%>
<i>(currently <jsp:getProperty name="nethelper" property="udpPort" />)</i><br> <i>(<%=intl._("currently")%> <jsp:getProperty name="nethelper" property="udpPort" />)</i><br>
<input type="radio" class="optbox" name="ntcpAutoPort" value="1" <%=nethelper.getTcpAutoPortChecked(1) %> /> <input type="radio" class="optbox" name="ntcpAutoPort" value="1" <%=nethelper.getTcpAutoPortChecked(1) %> />
Specify Port: <%=intl._("Specify Port")%>:
<input name ="ntcpport" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="ntcpport" />" /><br> <input name ="ntcpport" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="ntcpport" />" /><br>
</p><p><b>Note: Changing these settings will restart your router.</b></p> </p><p><b><%=intl._("Note")%>: <%=intl._("Changing these settings will restart your router.")%></b></p>
<hr><div class="formaction"> <hr><div class="formaction">
<input type="submit" name="save" value="Save changes" /> <input type="reset" value="Cancel" /> <input type="submit" name="save" value="<%=intl._("Save changes")%>" /> <input type="reset" value="<%=intl._("Cancel")%>" />
</div><h3><a name="chelp">Configuration Help:</a></h3><div align="justify"><p> </div><h3><a name="chelp"><%=intl._("Configuration Help")%>:</a></h3><div align="justify"><p>
While I2P will work fine behind most firewalls, your speeds and network integration will generally improve <%=intl._("While I2P will work fine behind most firewalls, your speeds and network integration will generally improve if the I2P port is forwarded for both UDP and TCP.")%>
if the I2P port (generally 8887) is forwarded for both UDP and TCP.
</p><p> </p><p>
If you can, please poke a hole in your firewall to allow unsolicited UDP and TCP packets to reach <%=intl._("If you can, please poke a hole in your firewall to allow unsolicited UDP and TCP packets to reach you.")%>
you. If you can't, I2P supports UPnP (Universal Plug and Play) and UDP hole punching <%=intl._("If you can't, I2P supports UPnP (Universal Plug and Play) and UDP hole punching with \"SSU introductions\" to relay traffic.")%>
with "SSU introductions" to relay traffic. Most of the options above are for special situations, <%=intl._("Most of the options above are for special situations, for example where UPnP does not work correctly, or a firewall not under your control is doing harm.")%>
for example where UPnP does not work correctly, or a firewall not under your control is doing <%=intl._("Certain firewalls such as symmetric NATs may not work well with I2P.")%>
harm. Certain firewalls such as symmetric NATs may not work well with I2P.
</p> </p>
<!-- let's keep this simple... <!-- let's keep this simple...
<input type="submit" name="recheckReachability" value="Check network reachability..." /> <input type="submit" name="recheckReachability" value="Check network reachability..." />
</p> </p>
--> -->
<p> <p>
UPnP is used to communicate with Internet Gateway Devices (IGDs) to detect the external IP address <%=intl._("UPnP is used to communicate with Internet Gateway Devices (IGDs) to detect the external IP address and forward ports.")%>
and forward ports. <%=intl._("UPnP support is beta, and may not work for any number of reasons")%>:
UPnP support is beta, and may not work for any number of reasons:
<ul> <ul>
<li class="tidylist">No UPnP-compatible device present <li class="tidylist"><%=intl._("No UPnP-compatible device present")%>
<li class="tidylist">UPnP disabled on the device <li class="tidylist"><%=intl._("UPnP disabled on the device")%>
<li class="tidylist">Software firewall interference with UPnP <li class="tidylist"><%=intl._("Software firewall interference with UPnP")%>
<li class="tidylist">Bugs in the device's UPnP implementation <li class="tidylist"><%=intl._("Bugs in the device's UPnP implementation")%>
<li class="tidylist">Multiple firewall/routers in the internet connection path <li class="tidylist"><%=intl._("Multiple firewall/routers in the internet connection path")%>
<li class="tidylist">UPnP device change, reset, or address change <li class="tidylist"><%=intl._("UPnP device change, reset, or address change")%>
</ul><br> </ul></p><p>
Reviewing the <a href="peers.jsp#upnp">UPnP status</a> may help. <a href="peers.jsp#upnp"><%=intl._("Review the UPnP status here.")%></a>
UPnP may be enabled or disabled above, but a change requires a router restart to take effect. <%=intl._("UPnP may be enabled or disabled above, but a change requires a router restart to take effect.")%></p>
<p>Hostnames entered above will be published in the network database. <p><%=intl._("Hostnames entered above will be published in the network database.")%>
They are <b>not private</b>. <%=intl._("They are <b>not private</b>.")%>
Also, <b>do not enter a private IP address</b> like 127.0.0.1 or 192.168.1.1. <%=intl._("Also, <b>do not enter a private IP address</b> like 127.0.0.1 or 192.168.1.1.")%>
If you specify the wrong IP address or <%=intl._("If you specify the wrong IP address or hostname, or do not properly configure your NAT or firewall, your network performance will degrade substantially.")%>
hostname, or do not properly configure your NAT or firewall, your network performance will degrade <%=intl._("When in doubt, leave the settings at the defaults.")%>
substantially. When in doubt, leave the settings at the defaults.
</p> </p>
<h3><a name="help">Reachability Help:</a></h3><p> <h3><a name="help"><%=intl._("Reachability Help")%>:</a></h3><p>
While I2P will work fine behind most firewalls, your speeds and network integration will generally improve <%=intl._("While I2P will work fine behind most firewalls, your speeds and network integration will generally improve if the I2P port is forwarded for both UDP and TCP.")%>
if the I2P port (generally 8887) to both UDP and TCP. <%=intl._("If you think you have opened up your firewall and I2P still thinks you are firewalled, remember that you may have multiple firewalls, for example both software packages and external hardware routers.")%>
If you think you have opened up your firewall and I2P still thinks you are firewalled, remember <%=intl._("If there is an error, the <a href=\"logs.jsp\">logs</a> may also help diagnose the problem.")%>
that you may have multiple firewalls, for example both software packages and external hardware routers.
If there is an error, the <a href="logs.jsp">logs</a> may also help diagnose the problem.
<ul> <ul>
<li class="tidylist"><b>OK</b> - Your UDP port does not appear to be firewalled. <li class="tidylist"><b><%=intl._("OK")%></b> -
<li class="tidylist"><b>Firewalled</b> - Your UDP port appears to be firewalled. <%=intl._("Your UDP port does not appear to be firewalled.")%>
As the firewall detection methods are not 100% reliable, this may occasionally be displayed in error. <li class="tidylist"><b><%=intl._("Firewalled")%></b> -
However, if it appears consistently, you should check whether both your external and internal <%=intl._("Your UDP port appears to be firewalled.")%>
firewalls are open on port 8887. I2P will work fine when firewalled, there is no reason for concern. <%=intl._("As the firewall detection methods are not 100% reliable, this may occasionally be displayed in error.")%>
When firewalled, the router uses "introducers" to relay inbound connections. <%=intl._("However, if it appears consistently, you should check whether both your external and internal firewalls are open for your port.")%>
However, you will get more participating traffic and help the network more if you can open your <%=intl._("I2P will work fine when firewalled, there is no reason for concern. When firewalled, the router uses \"introducers\" to relay inbound connections.")%>
firewall(s). If you think you have already done so, remember that you may have both a hardware <%=intl._("However, you will get more participating traffic and help the network more if you can open your firewall(s).")%>
and a software firewall, or be behind an additional, institutional firewall you cannot control. <%=intl._("If you think you have already done so, remember that you may have both a hardware and a software firewall, or be behind an additional, institutional firewall you cannot control.")%>
Also, some routers cannot correctly forward both TCP and UDP on a single port, or may have other <%=intl._("Also, some routers cannot correctly forward both TCP and UDP on a single port, or may have other limitations or bugs that prevent them from passing traffic through to I2P.")%>
limitations or bugs that prevent them from passing traffic through to I2P. <li class="tidylist"><b><%=intl._("Testing")%></b> -
<li class="tidylist"><b>Testing</b> - The router is currently testing whether your UDP port is firewalled. <%=intl._("The router is currently testing whether your UDP port is firewalled.")%>
<li class="tidylist"><b>Hidden</b> - The router is not configured to publish its address, <li class="tidylist"><b><%=intl._("Hidden")%></b> -
therefore it does not expect incoming connections. <%=intl._("The router is not configured to publish its address, therefore it does not expect incoming connections.")%>
<li class="tidylist"><b>WARN - Firewalled and Fast</b> - You have configured I2P to share more than 128KBps of bandwidth, <li class="tidylist"><b><%=intl._("WARN - Firewalled and Fast")%></b> -
but you are firewalled. While I2P will work fine in this configuration, if you really have <%=intl._("You have configured I2P to share more than 128KBps of bandwidth, but you are firewalled.")%>
over 128KBps of bandwidth to share, it will be much more helpful to the network if <%=intl._("While I2P will work fine in this configuration, if you really have over 128KBps of bandwidth to share, it will be much more helpful to the network if you open your firewall.")%>
you open your firewall. <li class="tidylist"><b><%=intl._("WARN - Firewalled and Floodfill")%></b> -
<li class="tidylist"><b>WARN - Firewalled and Floodfill</b> - You have configured I2P to be a floodfill router, but <%=intl._("You have configured I2P to be a floodfill router, but you are firewalled.")%>
you are firewalled. For best participation as a floodfill router, you should open your firewall. <%=intl._("For best participation as a floodfill router, you should open your firewall.")%>
<li class="tidylist"><b>WARN - Firewalled with Inbound TCP Enabled</b> - You have configured inbound TCP, however <li class="tidylist"><b><%=intl._("WARN - Firewalled with Inbound TCP Enabled")%></b> -
your UDP port is firewalled, and therefore it is likely that your TCP port is firewalled as well. <%=intl._("You have configured inbound TCP, however your UDP port is firewalled, and therefore it is likely that your TCP port is firewalled as well.")%>
If your TCP port is firewalled with inbound TCP enabled, routers will not be able to contact <%=intl._("If your TCP port is firewalled with inbound TCP enabled, routers will not be able to contact you via TCP, which will hurt the network.")%>
you via TCP, which will hurt the network. Please open your firewall or disable inbound TCP above. <%=intl._("Please open your firewall or disable inbound TCP above.")%>
<li class="tidylist"><b>WARN - Firewalled with UDP Disabled</b> - <li class="tidylist"><b><%=intl._("WARN - Firewalled with UDP Disabled")%></b> -
You have configured inbound TCP, however <%=intl._("You have configured inbound TCP, however you have disabled UDP.")%>
you have disabled UDP. You appear to be firewalled on TCP, therefore your router cannot <%=intl._("You appear to be firewalled on TCP, therefore your router cannot accept inbound connections.")%>
accept inbound connections. <%=intl._("Please open your firewall or enable UDP.")%>
Please open your firewall or enable UDP. <li class="tidylist"><b><%=intl._("ERR - Clock Skew")%></b> -
<li class="tidylist"><b>ERR - Clock Skew</b> - Your system's clock is skewed, which will make it difficult <%=intl._("Your system's clock is skewed, which will make it difficult to participate in the network.")%>
to participate in the network. Correct your clock setting if this error persists. <%=intl._("Correct your clock setting if this error persists.")%>
<li class="tidylist"><b>ERR - Private TCP Address</b> - You must never advertise an unroutable IP address such as <li class="tidylist"><b><%=intl._("ERR - Private TCP Address")%></b> -
127.0.0.1 or 192.168.1.1 as your external address. Correct the address or disable inbound TCP above. <%=intl._("You must never advertise an unroutable IP address such as 127.0.0.1 or 192.168.1.1 as your external address.")%>
<li class="tidylist"><b>ERR - SymmetricNAT</b> - I2P detected that you are firewalled by a Symmetric NAT. <%=intl._("Correct the address or disable inbound TCP above.")%>
I2P does not work well behind this type of firewall. You will probably not be able to <li class="tidylist"><b><%=intl._("ERR - SymmetricNAT")%></b> -
accept inbound connections, which will limit your participation in the network. <%=intl._("I2P detected that you are firewalled by a Symmetric NAT.")%>
<li class="tidylist"><b>ERR - UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart</b> - <%=intl._("I2P does not work well behind this type of firewall. You will probably not be able to accept inbound connections, which will limit your participation in the network.")%>
I2P was unable to bind to port 8887 or other configured port. <li class="tidylist"><b><%=intl._("ERR - UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart")%></b> -
Check to see if another program is using port 8887. If so, stop that program or configure <%=intl._("I2P was unable to bind to port 8887 or other configured port.")%>
I2P to use a different port. This may be a transient error, if the other program is no longer <%=intl._("Check to see if another program is using the configured port. If so, stop that program or configure I2P to use a different port.")%>
using the port. However, a restart is always required after this error. <%=intl._("This may be a transient error, if the other program is no longer using the port.")%>
<li class="tidylist"><b>ERR - UDP Disabled and Inbound TCP host/port not set</b> - <%=intl._("However, a restart is always required after this error.")%>
You have not configured inbound TCP with a hostname and port above, however <li class="tidylist"><b><%=intl._("ERR - UDP Disabled and Inbound TCP host/port not set")%></b> -
you have disabled UDP. Therefore your router cannot accept inbound connections. <%=intl._("You have not configured inbound TCP with a hostname and port above, however you have disabled UDP.")%>
Please configure a TCP host and port above or enable UDP. <%=intl._("Therefore your router cannot accept inbound connections.")%>
<li class="tidylist"><b>ERR - Client Manager I2CP Error - check logs</b> - <%=intl._("Please configure a TCP host and port above or enable UDP.")%>
This is usually due to a port 7654 conflict. Check the logs to verify. Do you have another I2P instance running? <li class="tidylist"><b><%=intl._("ERR - Client Manager I2CP Error - check logs")%></b> -
Stop the conflicting program and restart I2P. <%=intl._("This is usually due to a port 7654 conflict. Check the logs to verify.")%>
</ul><hr> <%=intl._("Do you have another I2P instance running? Stop the conflicting program and restart I2P.")%>
</ul></p><hr>
<!-- <!--
<b>Dynamic Router Keys: </b> <b>Dynamic Router Keys: </b>
<input type="checkbox" class="optbox" name="dynamicKeys" value="true" <jsp:getProperty name="nethelper" property="dynamicKeysChecked" /> /><br> <input type="checkbox" class="optbox" name="dynamicKeys" value="true" <jsp:getProperty name="nethelper" property="dynamicKeysChecked" /> /><br>

View File

@ -2,19 +2,20 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - config advanced</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("config advanced")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigAdvancedHelper" id="advancedhelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigAdvancedHelper" id="advancedhelper" scope="request" />
<jsp:setProperty name="advancedhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="advancedhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<h1>I2P Advanced Configuration</h1> <h1><%=intl._("I2P Advanced Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigAdvancedHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigAdvancedHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" /> <jsp:setProperty name="formhandler" property="*" />
@ -28,10 +29,10 @@
System.setProperty("net.i2p.router.web.ConfigAdvancedHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigAdvancedHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigAdvancedHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigAdvancedHandler.nonce")%>" />
<input type="hidden" name="action" value="blah" /> <input type="hidden" name="action" value="blah" />
<h3>Advanced I2P Configuration</h3> <h3><%=intl._("Advanced I2P Configuration")%></h3>
<textarea rows="32" cols="60" name="config" wrap="off"><jsp:getProperty name="advancedhelper" property="settings" /></textarea><br><hr> <textarea rows="32" cols="60" name="config" wrap="off"><jsp:getProperty name="advancedhelper" property="settings" /></textarea><br><hr>
<div class="formaction"> <div class="formaction">
<input type="submit" name="shouldsave" value="Apply" /> <input type="submit" name="shouldsave" value="<%=intl._("Apply")%>" />
<input type="reset" value="Cancel" /><br> <input type="reset" value="<%=intl._("Cancel")%>" /><br>
<b>NOTE:</b> Some changes may require a restart to take effect. <b><%=intl._("NOTE")%>:</b> <%=intl._("Some changes may require a restart to take effect.")%>
</div></form></div></div></div></body></html> </div></form></div></div></div></body></html>

View File

@ -2,21 +2,22 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - config clients</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("config clients")%>
<style type='text/css'> <style type='text/css'>
button span.hide{ button span.hide{
display:none; display:none;
} }
</style></head><body> </style></head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigClientsHelper" id="clientshelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigClientsHelper" id="clientshelper" scope="request" />
<jsp:setProperty name="clientshelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="clientshelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<h1>I2P Client Configuration</h1> <h1><%=intl._("I2P Client Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigClientsHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigClientsHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
@ -29,29 +30,23 @@ button span.hide{
if (prev != null) System.setProperty("net.i2p.router.web.ConfigClientsHandler.noncePrev", prev); if (prev != null) System.setProperty("net.i2p.router.web.ConfigClientsHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ConfigClientsHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigClientsHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigClientsHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigClientsHandler.nonce")%>" />
<h3>Client Configuration</h3><p> <h3><%=intl._("Client Configuration")%></h3><p>
The Java clients listed below are started by the router and run in the same JVM. <%=intl._("The Java clients listed below are started by the router and run in the same JVM.")%>
</p><div class="wideload"> </p><div class="wideload">
<p><jsp:getProperty name="clientshelper" property="form1" /> <p><jsp:getProperty name="clientshelper" property="form1" />
</p><p><i>To change other client options, edit the file </p><p><i><%=intl._("To change other client options, edit the file")%>
<%=net.i2p.router.startup.ClientAppConfig.configFile(net.i2p.I2PAppContext.getGlobalContext()).getAbsolutePath()%>. <%=net.i2p.router.startup.ClientAppConfig.configFile(net.i2p.I2PAppContext.getGlobalContext()).getAbsolutePath()%>.
All changes require restart to take effect.</i> <%=intl._("All changes require restart to take effect.")%></i>
</p><hr><div class="formaction"> </p><hr><div class="formaction">
<input type="submit" name="action" value="Save Client Configuration" /> <input type="submit" name="action" value="<%=intl._("Save Client Configuration")%>" />
</div></div><h3>WebApp Configuration</h3><p> </div></div><h3><%=intl._("WebApp Configuration")%></h3><p>
The Java web applications listed below are started by the webConsole client and run in the same JVM as the router. <%=intl._("The Java web applications listed below are started by the webConsole client and run in the same JVM as the router. They are usually web applications accessible through the router console. They may be complete applications (e.g. i2psnark),front-ends to another client or application which must be separately enabled (e.g. susidns, i2ptunnel), or have no web interface at all (e.g. addressbook).")%>
They are usually web applications accessible through the router console.
They may be complete applications (e.g. i2psnark),
front-ends to another client or application which must be separately enabled (e.g. susidns, i2ptunnel),
or have no web interface at all (e.g. addressbook).
</p><p> </p><p>
A web app may also be disabled by removing the .war file from the webapps directory; <%=intl._("A web app may also be disabled by removing the .war file from the webapps directory; however the .war file and web app will reappear when you update your router to a newer version, so disabling the web app here is the preferred method.")%>
however the .war file and web app will reappear when you update your router to a newer version,
so disabling the web app here is the preferred method.
</p><div class="wideload"><p> </p><div class="wideload"><p>
<jsp:getProperty name="clientshelper" property="form2" /> <jsp:getProperty name="clientshelper" property="form2" />
</p><p> </p><p>
<i>All changes require restart to take effect.</i> <i><%=intl._("All changes require restart to take effect.")%></i>
</p><hr><div class="formaction"> </p><hr><div class="formaction">
<input type="submit" name="action" value="Save WebApp Configuration" /> <input type="submit" name="action" value="<%=intl._("Save WebApp Configuration")%>" />
</div></div></form></div></div></body></html> </div></div></form></div></div></body></html>

View File

@ -2,14 +2,15 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - config keyring</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("config keyring")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Keyring Configuration</h1> <h1><%=intl._("I2P Keyring Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigKeyringHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigKeyringHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" /> <jsp:setProperty name="formhandler" property="*" />
@ -17,32 +18,30 @@
<jsp:getProperty name="formhandler" property="allMessages" /> <jsp:getProperty name="formhandler" property="allMessages" />
<jsp:useBean class="net.i2p.router.web.ConfigKeyringHelper" id="keyringhelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigKeyringHelper" id="keyringhelper" scope="request" />
<jsp:setProperty name="keyringhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="keyringhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<div class="configure"><p><h3>Keyring</h3> <div class="configure"><h2><%=intl._("Keyring")%></h2><p>
The router keyring is used to decrypt encrypted leaseSets. <%=intl._("The router keyring is used to decrypt encrypted leaseSets.")%>
The keyring may contain keys for local or remote encrypted destinations. <%=intl._("The keyring may contain keys for local or remote encrypted destinations.")%></p>
<div class="wideload"><p> <div class="wideload"><p>
<jsp:getProperty name="keyringhelper" property="summary" /> <jsp:getProperty name="keyringhelper" property="summary" />
</p></div> </p></div>
<br>
<form action="configkeyring.jsp" method="POST"> <form action="configkeyring.jsp" method="POST">
<% String prev = System.getProperty("net.i2p.router.web.ConfigKeyringHandler.nonce"); <% String prev = System.getProperty("net.i2p.router.web.ConfigKeyringHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.ConfigKeyringHandler.noncePrev", prev); if (prev != null) System.setProperty("net.i2p.router.web.ConfigKeyringHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ConfigKeyringHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigKeyringHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigKeyringHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigKeyringHandler.nonce")%>" />
<h3>Manual Keyring Addition</h3> <h3><%=intl._("Manual Keyring Addition")%></h3><p>
Enter keys for encrypted remote destinations here. <%=intl._("Enter keys for encrypted remote destinations here.")%>
Keys for local destinations must be entered on the <a href="i2ptunnel/index.jsp">I2PTunnel page</a>. <%=intl._("Keys for local destinations must be entered on the")%> <a href="i2ptunnel/index.jsp"><%=intl._("I2PTunnel page")%></a>.
<p> </p>
<div class="wideload"> <div class="wideload">
<table><tr> <p><table><tr>
<td class="mediumtags" align="right">Dest. name, hash, or full key:</td> <td class="mediumtags" align="right"><%=intl._("Dest. name, hash, or full key")%>:</td>
<td><textarea name="peer" cols="44" rows="1" style="height: 3em;" wrap="off"></textarea></td> <td><textarea name="peer" cols="44" rows="1" style="height: 3em;" wrap="off"></textarea></td>
</tr><tr> </tr><tr>
<td class="mediumtags" align="right">Encryption Key:</td> <td class="mediumtags" align="right"><%=intl._("Encryption Key")%>:</td>
<td><input type="text" size="55" name="key" /></td> <td><input type="text" size="55" name="key" /></td>
</tr><tr> </tr><tr>
<td align="right" colspan="2"><input type="submit" name="action" value="Add key" /> <td align="right" colspan="2"><input type="submit" name="action" value="<%=intl._("Add key")%>" />
<input type="submit" name="action" value="Delete key" /> <input type="reset" value="Cancel" /></td> <input type="submit" name="action" value="<%=intl._("Delete key")%>" /> <input type="reset" value="<%=intl._("Cancel")%>" /></td>
</tr></table></div></form></div></div></body></html> </tr></table></p></div></form></div></div></body></html>

View File

@ -3,16 +3,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head> <html><head>
<title>I2P Router Console - config logging</title> <%@include file="css.jsi" %>
<%@include file="css.jsp" %> <%=intl.title("config logging")%>
</head><body> </head><body>
<jsp:useBean class="net.i2p.router.web.ConfigLoggingHelper" id="logginghelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigLoggingHelper" id="logginghelper" scope="request" />
<jsp:setProperty name="logginghelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="logginghelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Logging Configuration</h1> <h1><%=intl._("I2P Logging Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigLoggingHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigLoggingHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" /> <jsp:setProperty name="formhandler" property="*" />
@ -25,29 +25,29 @@
System.setProperty("net.i2p.router.web.ConfigLoggingHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigLoggingHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigLoggingHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigLoggingHandler.nonce")%>" />
<input type="hidden" name="action" value="blah" /> <input type="hidden" name="action" value="blah" />
<h3>Configure I2P Logging Options</h3> <h3><%=intl._("Configure I2P Logging Options")%></h3>
<div class="wideload"> <div class="wideload">
<table border="0" cellspacing="5"> <table border="0" cellspacing="5">
<tr><td class="mediumtags" align="right"><b>Logging filename:</b></td> <tr><td class="mediumtags" align="right"><b><%=intl._("Logging filename")%>:</b></td>
<td><input type="text" name="logfilename" size="40" value="<jsp:getProperty name="logginghelper" property="logFilePattern" />" /> <td><input type="text" name="logfilename" size="40" value="<jsp:getProperty name="logginghelper" property="logFilePattern" />" />
<br><i>(the symbol '@' will be replaced during log rotation)</i></td> <br> <i><%=intl._("(the symbol '@' will be replaced during log rotation)")%></i></td>
</tr><tr><td class="mediumtags" align="right"><b>Log record format:</b></td> </tr><tr><td class="mediumtags" align="right"><b><%=intl._("Log record format")%>:</b></td>
<td><input type="text" name="logformat" size="20" value="<jsp:getProperty name="logginghelper" property="recordPattern" />" /> <td><input type="text" name="logformat" size="20" value="<jsp:getProperty name="logginghelper" property="recordPattern" />" />
<br> <i>(use 'd' = date, 'c' = class, 't' = thread, 'p' = priority, <br> <i><%=intl._("(use 'd' = date, 'c' = class, 't' = thread, 'p' = priority, 'm' = message)")%>
'm' = message)</i></td> </i></td>
</tr><tr><td class="mediumtags" align="right"><b>Log date format:</b></td> </tr><tr><td class="mediumtags" align="right"><b><%=intl._("Log date format")%>:</b></td>
<td><input type="text" name="logdateformat" size="20" value="<jsp:getProperty name="logginghelper" property="datePattern" />" /> <td><input type="text" name="logdateformat" size="20" value="<jsp:getProperty name="logginghelper" property="datePattern" />" />
<br> <i>('MM' = month, 'dd' = day, 'HH' = hour, 'mm' = minute, 'ss' <br> <i><%=intl._("('MM' = month, 'dd' = day, 'HH' = hour, 'mm' = minute, 'ss' = second, 'SSS' = millisecond)")%>
= second, 'SSS' = millisecond)</i></td> </i></td>
</tr><tr><td class="mediumtags" align="right"><b>Max log file size:</b></td> </tr><tr><td class="mediumtags" align="right"><b><%=intl._("Max log file size")%>:</b></td>
<td><input type="text" name="logfilesize" size="4" value="<jsp:getProperty name="logginghelper" property="maxFileSize" />" /><br></td> <td><input type="text" name="logfilesize" size="4" value="<jsp:getProperty name="logginghelper" property="maxFileSize" />" /><br></td>
</tr><tr><td class="mediumtags" align="right"><b>Default log level:</b></td> </tr><tr><td class="mediumtags" align="right"><b><%=intl._("Default log level")%>:</b></td>
<td><jsp:getProperty name="logginghelper" property="defaultLogLevelBox" /><br><i>(DEBUG and INFO are not recommended defaults, <td><jsp:getProperty name="logginghelper" property="defaultLogLevelBox" /><br><i><%=intl._("(DEBUG and INFO are not recommended defaults, as they will drastically slow down your router)")%>
as they will drastically slow down your router)</i></td> </i></td>
</tr><tr><td class="mediumtags" align="right"><b>Log level overrides:</b></td> </tr><tr><td class="mediumtags" align="right"><b><%=intl._("Log level overrides")%>:</b></td>
<td><jsp:getProperty name="logginghelper" property="logLevelTable" /></td> <td><jsp:getProperty name="logginghelper" property="logLevelTable" /></td>
</tr><tr><td colspan="2"><hr></td> </tr><tr><td colspan="2"><hr></td>
</tr><tr class="tablefooter"><td colspan="2"> <div class="formaction"> </tr><tr class="tablefooter"><td colspan="2"> <div class="formaction">
<input type="submit" name="shouldsave" value="Save changes" /> <input type="submit" name="shouldsave" value="<%=intl._("Save changes")%>" />
<input type="reset" value="Cancel" /> <input type="reset" value="<%=intl._("Cancel")%>" />
</div></td></tr></table></div></form></div></div></body></html> </div></td></tr></table></div></form></div></div></body></html>

View File

@ -2,14 +2,15 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - config peers</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("config peers")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Peer Configuration</h1> <h1><%=intl._("I2P Peer Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigPeerHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigPeerHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" /> <jsp:setProperty name="formhandler" property="*" />
@ -31,50 +32,41 @@
if (prev != null) System.setProperty("net.i2p.router.web.ConfigPeerHandler.noncePrev", prev); if (prev != null) System.setProperty("net.i2p.router.web.ConfigPeerHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ConfigPeerHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigPeerHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigPeerHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigPeerHandler.nonce")%>" />
<p>
<a name="sh"> </a> <a name="sh"> </a>
<a name="unsh"> </a> <a name="unsh"> </a>
<a name="bonus"> </a> <a name="bonus"> </a>
<h2>Manual Peer Controls</h2> <h2><%=intl._("Manual Peer Controls")%></h2>
<div class="mediumtags">Router Hash: <div class="mediumtags"><p><%=intl._("Router Hash")%>:
<input type="text" size="55" name="peer" value="<%=peer%>" /></div> <input type="text" size="55" name="peer" value="<%=peer%>" /></p></div>
<h3>Manually Ban / Unban a Peer</h3> <h3><%=intl._("Manually Ban / Unban a Peer")%></h3>
Banning will prevent the participation of this peer in tunnels you create. <p><%=intl._("Banning will prevent the participation of this peer in tunnels you create.")%></p>
<hr>
<div class="formaction"> <div class="formaction">
<input type="submit" name="action" value="Ban peer until restart" /> <input type="submit" name="action" value="<%=intl._("Ban peer until restart")%>" />
<input type="submit" name="action" value="Unban peer" /> <input type="submit" name="action" value="<%=intl._("Unban peer")%>" />
<% if (! "".equals(peer)) { %> <% if (! "".equals(peer)) { %>
<!-- <font color="blue">&lt;---- click to verify action</font> --> <!-- <font color="blue">&lt;---- click to verify action</font> -->
<% } %> <% } %>
</div> </div>
<h3>Adjust Profile Bonuses</h3> <h3><%=intl._("Adjust Profile Bonuses")%></h3>
Bonuses may be positive or negative, and affect the peer's inclusion in Fast <p><%=intl._("Bonuses may be positive or negative, and affect the peer's inclusion in Fast and High Capacity tiers. Fast peers are used for client tunnels, and High Capacity peers are used for some exploratory tunnels. Current bonuses are displayed on the")%> <a href="profiles.jsp"><%=intl._("profiles page")%></a>.</p>
and High Capacity tiers. Fast peers are used for client tunnels, and High
Capacity peers are used for some exploratory tunnels. Current bonuses are
displayed on the <a href="profiles.jsp">profiles page</a>.
<p>
<% long speed = 0; long capacity = 0; <% long speed = 0; long capacity = 0;
if (! "".equals(peer)) { if (! "".equals(peer)) {
// get existing bonus values? // get existing bonus values?
} }
%> %>
<hr> <div class="mediumtags"><p><%=intl._("Speed")%>:
<div class="mediumtags">Speed:
<input type="text" size="8" name="speed" value="<%=speed%>" /> <input type="text" size="8" name="speed" value="<%=speed%>" />
Capacity: <%=intl._("Capacity")%>:
<input type="text" size="8" name="capacity" value="<%=capacity%>" /> <input type="text" size="8" name="capacity" value="<%=capacity%>" />
<input type="submit" name="action" value="Adjust peer bonuses" /></div> <input type="submit" name="action" value="<%=intl._("Adjust peer bonuses")%>" /></p></div>
</p>
</form> </form>
<a name="shitlist"> </a> <a name="shitlist"> </a><h2><%=intl._("Banned Peers")%></h2>
<jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" />
<jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" /> <jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" />
<jsp:getProperty name="profilesHelper" property="shitlistSummary" /> <jsp:getProperty name="profilesHelper" property="shitlistSummary" />
<hr> <div class="wideload"><h2><%=intl._("Banned IPs")%></h2>
<div class="wideload">
<jsp:getProperty name="peerhelper" property="blocklistSummary" /> <jsp:getProperty name="peerhelper" property="blocklistSummary" />
</div></div></div></body></html> </div><hr></div></div></body></html>

View File

@ -2,14 +2,15 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - config service</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("config service")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Service Configuration</h1> <h1><%=intl._("I2P Service Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigServiceHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigServiceHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" /> <jsp:setProperty name="formhandler" property="*" />
@ -20,65 +21,59 @@
<% String prev = System.getProperty("net.i2p.router.web.ConfigServiceHandler.nonce"); <% String prev = System.getProperty("net.i2p.router.web.ConfigServiceHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.ConfigServiceHandler.noncePrev", prev); if (prev != null) System.setProperty("net.i2p.router.web.ConfigServiceHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ConfigServiceHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigServiceHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigServiceHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigServiceHandler.nonce")%>" >
<h3>Shutdown the router</h3> <h3><%=intl._("Shutdown the router")%></h3>
<p>Graceful shutdown lets the router satisfy the agreements it has already made <p><%=intl._("Graceful shutdown lets the router satisfy the agreements it has already made before shutting down, but may take a few minutes.")%>
before shutting down, but may take a few minutes. If you need to kill the <%=intl._("If you need to kill the router immediately, that option is available as well.")%></p>
router immediately, that option is available as well.</p>
<hr><div class="formaction"> <hr><div class="formaction">
<input type="submit" name="action" value="Shutdown gracefully" /> <input type="submit" name="action" value="<%=intl._("Shutdown gracefully")%>" >
<input type="submit" name="action" value="Shutdown immediately" /> <input type="submit" name="action" value="<%=intl._("Shutdown immediately")%>" >
<input type="submit" name="action" value="Cancel graceful shutdown" /> <input type="submit" name="action" value="<%=intl._("Cancel graceful shutdown")%>" >
</div> </div>
<% if (System.getProperty("wrapper.version") != null) { %> <% if (System.getProperty("wrapper.version") != null) { %>
<p>If you want the router to restart itself after shutting down, you can choose one of <p><%=intl._("If you want the router to restart itself after shutting down, you can choose one of the following.")%>
the following. This is useful in some situations - for example, if you changed <%=intl._("This is useful in some situations")%> -
some settings that client applications only read at startup, such as the routerconsole password <%=intl._("for example, if you changed some settings that client applications only read at startup, such as the routerconsole password or the interface it listens on.")%>
or the interface it listens on. A graceful restart will take a few minutes (but your peers <%=intl._("A graceful restart will take a few minutes (but your peers will appreciate your patience), while a hard restart does so immediately.")%>
will appreciate your patience), while a hard restart does so immediately. After tearing down <%=intl._("After tearing down the router, it will wait 1 minute before starting back up again.")%></p>
the router, it will wait 1 minute before starting back up again.</p>
<hr><div class="formaction"> <hr><div class="formaction">
<input type="submit" name="action" value="Graceful restart" /> <input type="submit" name="action" value="<%=intl._("Graceful restart")%>" >
<input type="submit" name="action" value="Hard restart" /> <input type="submit" name="action" value="<%=intl._("Hard restart")%>" >
<% } %></div> <% } %></div>
<% if ( (System.getProperty("os.name") != null) && (System.getProperty("os.name").startsWith("Win")) ) { %> <% if ( (System.getProperty("os.name") != null) && (System.getProperty("os.name").startsWith("Win")) ) { %>
<h3>Systray integration</h3> <h3><%=intl._("Systray integration")%></h3>
<p>On the windows platform, there is a small application to sit in the system <p><%=intl._("On the windows platform, there is a small application to sit in the system tray, allowing you to view the router's status")%>
tray, allowing you to view the router's status (later on, I2P client applications <%=intl._("(later on, I2P client applications will be able to integrate their own functionality into the system tray as well).")%>
will be able to integrate their own functionality into the system tray as well). <%=intl._("If you are on windows, you can either enable or disable that icon here.")%></p>
If you are on windows, you can either enable or disable that icon here.</p>
<hr><div class="formaction"> <hr><div class="formaction">
<input type="submit" name="action" value="Show systray icon" /> <input type="submit" name="action" value="<%=intl._("Show systray icon")%>" >
<input type="submit" name="action" value="Hide systray icon" /> <input type="submit" name="action" value="<%=intl._("Hide systray icon")%>" >
</div><h3>Run on startup</h3> </div><h3><%=intl._("Run on startup")%></h3>
<p>You can control whether I2P is run on startup or not by selecting one of the <p><%=intl._("You can control whether I2P is run on startup or not by selecting one of the following options")%> -
following options - I2P will install (or remove) a service accordingly. You can <%=intl._("I2P will install (or remove) a service accordingly.")%>
also run the <code>install_i2p_service_winnt.bat</code> (or <%=intl._("If you prefer the command line, you can also run the ")%> <code>install_i2p_service_winnt.bat</code> (<%=intl._("or")%>
<code>uninstall_i2p_service_winnt.bat</code>) from the command line, if you prefer.</p> <code>uninstall_i2p_service_winnt.bat</code>).</p>
<hr><div class="formaction"> <hr><div class="formaction">
<input type="submit" name="action" value="Run I2P on startup" /> <input type="submit" name="action" value="<%=intl._("Run I2P on startup")%>" >
<input type="submit" name="action" value="Don't run I2P on startup" /></div> <input type="submit" name="action" value="<%=intl._("Don't run I2P on startup")%>" ></div>
<p><b>Note:</b> If you are running I2P as service right now, removing it will shut <p><b><%=intl._("Note")%>:</b> <%=intl._("If you are running I2P as service right now, removing it will shut down your router immediately.")%>
down your router immediately. You may want to consider shutting down gracefully, as <%=intl._("You may want to consider shutting down gracefully, as above, then running uninstall_i2p_service_winnt.bat.")%></p>
above, then running uninstall_i2p_service_winnt.bat.</p>
<% } %> <% } %>
<% if (System.getProperty("wrapper.version") != null) { %> <% if (System.getProperty("wrapper.version") != null) { %>
<h3>Debugging</h3> <h3><%=intl._("Debugging")%></h3>
<p>At times, it may be helpful to debug I2P by getting a thread dump. To do so, <p> At times, it may be helpful to debug I2P by getting a thread dump.
please select the following option and review the thread dumped to To do so, please select the following option and review the thread dumped to
<a href="logs.jsp#servicelogs">wrapper.log</a>.</p> <a href="logs.jsp#servicelogs">wrapper.log</a>.</p>
<hr><div class="formaction"> <hr><div class="formaction">
<input type="submit" name="action" value="Dump threads" /> <input type="submit" name="action" value="<%=intl._("Dump threads")%>" >
<% } %></div> <% } %></div>
<h3>Launch browser on router startup?</h3> <h3><%=intl._("Launch browser on router startup?")%></h3>
<p>I2P's main configuration interface is this web console, so for your convenience <p><%=intl._("I2P's main configuration interface is this web console, so for your convenience I2P can launch a web browser on startup pointing at")%>
I2P can launch a web browser pointing at <a href="http://127.0.0.1:7657/index.jsp">http://127.0.0.1:7657/index.jsp</a> .</p>
<a href="http://127.0.0.1:7657/index.jsp">http://127.0.0.1:7657/index.jsp</a> whenever
the router starts up.</p>
<hr><div class="formaction"> <hr><div class="formaction">
<input type="submit" name="action" value="View console on startup" /> <input type="submit" name="action" value="<%=intl._("View console on startup")%>" >
<input type="submit" name="action" value="Do not view console on startup" /> <input type="submit" name="action" value="<%=intl._("Do not view console on startup")%>" >
</div></form></div></div></body></html> </div></form></div></div></body></html>

View File

@ -2,8 +2,9 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - config stats</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("config stats")%>
<script type="text/javascript"> <script type="text/javascript">
function init() function init()
{ {
@ -51,10 +52,10 @@ function toggleAll(category)
} }
</script> </script>
</head><body onLoad="init();"> </head><body onLoad="init();">
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Stats Configuration</h1> <h1><%=intl._("I2P Stats Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigStatsHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigStatsHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
@ -70,25 +71,25 @@ function toggleAll(category)
System.setProperty("net.i2p.router.web.ConfigStatsHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigStatsHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="action" value="foo" /> <input type="hidden" name="action" value="foo" />
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigStatsHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigStatsHandler.nonce")%>" />
<h3>Configure I2P Stat Collection</h3> <h3><%=intl._("Configure I2P Stat Collection")%></h3>
Enable full stats? <p><%=intl._("Enable full stats?")%>
<input type="checkbox" class="optbox" name="isFull" value="true" <% <input type="checkbox" class="optbox" name="isFull" value="true" <%
if (statshelper.getIsFull()) { %>checked="true" <% } %>/> if (statshelper.getIsFull()) { %>checked="true" <% } %>/>
(change requires restart to take effect)<br> (<%=intl._("change requires restart to take effect")%>)<br>
Stat file: <input type="text" name="filename" value="<%=statshelper.getFilename()%>" /><br> <%=intl._("Stat file")%>: <input type="text" name="filename" value="<%=statshelper.getFilename()%>" /><br>
Filter: (<a href="javascript: void(null);" onclick="toggleAll('*')">toggle all</a>)<br> <%=intl._("Filter")%>: (<a href="javascript: void(null);" onclick="toggleAll('*')"><%=intl._("toggle all")%></a>)<br></p>
<div class="wideload"> <div class="wideload">
<table> <p><table>
<% while (statshelper.hasMoreStats()) { <% while (statshelper.hasMoreStats()) {
while (statshelper.groupRequired()) { %> while (statshelper.groupRequired()) { %>
<tr class="tablefooter"> <tr class="tablefooter">
<td align="left" colspan="3"> <td align="left" colspan="3">
<b><%=statshelper.getCurrentGroupName()%></b> <b><%=statshelper.getCurrentGroupName()%></b>
(<a href="javascript: void(null);" onclick="toggleAll('<%=statshelper.getCurrentGroupName()%>')">toggle all</a>) (<a href="javascript: void(null);" onclick="toggleAll('<%=statshelper.getCurrentGroupName()%>')"><%=intl._("toggle all")%></a>)
</td></tr> </td></tr>
<tr class="tablefooter"> <tr class="tablefooter">
<td align="center"><b>Log</b></td> <td align="center"><b><%=intl._("Log")%></b></td>
<td align="center"><b>Graph</b></td> <td align="center"><b><%=intl._("Graph")%></b></td>
<td></td></tr> <td></td></tr>
<% <%
} // end iterating over required groups for the current stat %> } // end iterating over required groups for the current stat %>
@ -105,7 +106,7 @@ function toggleAll(category)
} // end iterating over all stats %> } // end iterating over all stats %>
<tr><td colspan="3"></td></tr> <tr><td colspan="3"></td></tr>
<tr><td align="center"><input type="checkbox" class="optbox" name="explicitFilter" /></td> <tr><td align="center"><input type="checkbox" class="optbox" name="explicitFilter" /></td>
<td colspan="2">Advanced filter: <td colspan="2"><%=intl._("Advanced filter")%>:
<input type="text" name="explicitFilterValue" value="<%=statshelper.getExplicitFilter()%>" size="40" /></td></tr> <input type="text" name="explicitFilterValue" value="<%=statshelper.getExplicitFilter()%>" size="40" /></td></tr>
<tr class="tablefooter"><td colspan="3" align="right"><input type="submit" name="shouldsave" value="Save changes" /><input type="reset" value="Cancel" /></td></tr> <tr class="tablefooter"><td colspan="3" align="right"><input type="submit" name="shouldsave" value="<%=intl._("Save changes")%>" /><input type="reset" value="<%=intl._("Cancel")%>" /></td></tr>
</table></div></form></div></div></body></html> </table></p></div></form></div></div></body></html>

View File

@ -2,17 +2,18 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - config tunnels</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("config tunnels")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigTunnelsHelper" id="tunnelshelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigTunnelsHelper" id="tunnelshelper" scope="request" />
<jsp:setProperty name="tunnelshelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="tunnelshelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<h1>I2P Tunnel Configuration</h1> <h1><%=intl._("I2P Tunnel Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigTunnelsHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigTunnelsHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="formhandler" property="shouldsave" value="<%=request.getParameter("shouldsave")%>" /> <jsp:setProperty name="formhandler" property="shouldsave" value="<%=request.getParameter("shouldsave")%>" />
@ -20,23 +21,23 @@
<jsp:setProperty name="formhandler" property="nonce" value="<%=request.getParameter("nonce")%>" /> <jsp:setProperty name="formhandler" property="nonce" value="<%=request.getParameter("nonce")%>" />
<jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" /> <jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" />
<jsp:getProperty name="formhandler" property="allMessages" /> <jsp:getProperty name="formhandler" property="allMessages" />
<div class="configure"><p><i> <div class="configure"><p>
NOTE: The default settings work for most people. <%=intl._("NOTE")%>:
There is a fundamental tradeoff between anonymity and performance. <%=intl._("The default settings work for most people.")%>
Tunnels longer than 3 hops (for example 2 hops + 0-2 hops, 3 hops + 0-1 hops, 3 hops + 0-2 hops), <%=intl._("There is a fundamental tradeoff between anonymity and performance.")%>
or a high quantity + backup quantity, may severely reduce performance or reliability. <%=intl._("Tunnels longer than 3 hops (for example 2 hops + 0-2 hops, 3 hops + 0-1 hops, 3 hops + 0-2 hops), or a high quantity + backup quantity, may severely reduce performance or reliability.")%>
High CPU and/or high outbound bandwidth usage may result. <%=intl._("High CPU and/or high outbound bandwidth usage may result.")%>
Change these settings with care, and adjust them if you have problems. <%=intl._("Change these settings with care, and adjust them if you have problems.")%>
</i></p><div class="wideload"> <div class="wideload">
<form action="configtunnels.jsp" method="POST"> <form action="configtunnels.jsp" method="POST">
<% String prev = System.getProperty("net.i2p.router.web.ConfigTunnelsHandler.nonce"); <% String prev = System.getProperty("net.i2p.router.web.ConfigTunnelsHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.ConfigTunnelsHandler.noncePrev", prev); if (prev != null) System.setProperty("net.i2p.router.web.ConfigTunnelsHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ConfigTunnelsHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigTunnelsHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigTunnelsHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigTunnelsHandler.nonce")%>" />
<input type="hidden" name="action" value="blah" /> <input type="hidden" name="action" value="blah" />
<jsp:getProperty name="tunnelshelper" property="form" /> <jsp:getProperty name="tunnelshelper" property="form" />
<i>Note - Exploratory tunnel setting changes are stored in the router.config file.</i><br> <%=intl._("Note")%>: <%=intl._("Exploratory tunnel setting changes are stored in the router.config file.")%>
<i>Client tunnel changes are temporary and are not saved.</i><br> <%=intl._("Client tunnel changes are temporary and are not saved.")%>
<i>To make permanent client tunnel changes see the </i><a href="i2ptunnel/index.jsp">i2ptunnel page</a>.<br> <%=intl._("To make permanent client tunnel changes see the")%> <a href="i2ptunnel/index.jsp"><%=intl._("i2ptunnel page")%></a>.
<hr><div class="formaction"><input type="submit" name="shouldsave" value="Save changes" /> <input type="reset" value="Cancel" /></div> <hr><div class="formaction"><input type="submit" name="shouldsave" value="<%=intl._("Save changes")%>" /> <input type="reset" value="<%=intl._("Cancel")%>" /></div>
</form></div></div></div></body></html> </form></p></div></div></div></body></html>

View File

@ -3,11 +3,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=cssHelper.title("config UI")%> <%=intl.title("config UI")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigUIHelper" id="uihelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigUIHelper" id="uihelper" scope="request" />
<jsp:setProperty name="uihelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="uihelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
@ -15,13 +15,13 @@
<h1><%=uihelper._("I2P UI Configuration")%></h1> <h1><%=uihelper._("I2P UI Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigUIHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigUIHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" /> <jsp:setProperty name="formhandler" property="*" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:getProperty name="formhandler" property="allMessages" /> <jsp:getProperty name="formhandler" property="allMessages" />
<div class="configure"><h3><%=uihelper._("Router Console Theme")%></h3> <div class="configure"><div class="topshimten"><h3><%=uihelper._("Router Console Theme")%></h3></div>
<form action="configui.jsp" method="POST"> <form action="configui.jsp" method="POST">
<% String prev = System.getProperty("net.i2p.router.web.ConfigUIHandler.nonce"); <% String prev = System.getProperty("net.i2p.router.web.ConfigUIHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.ConfigUIHandler.noncePrev", prev); if (prev != null) System.setProperty("net.i2p.router.web.ConfigUIHandler.noncePrev", prev);
@ -42,6 +42,6 @@
<jsp:getProperty name="uihelper" property="langSettings" /> <jsp:getProperty name="uihelper" property="langSettings" />
<%=uihelper._("Please contribute to the router console translation project! Contact the developers on IRC #i2p to help.")%> <%=uihelper._("Please contribute to the router console translation project! Contact the developers on IRC #i2p to help.")%>
<hr><div class="formaction"> <hr><div class="formaction">
<input type="submit" name="shouldsave" value="Apply" > <input type="reset" value="Cancel" > <input type="submit" name="shouldsave" value="<%=intl._("Apply")%>" > <input type="reset" value="<%=intl._("Cancel")%>" >
</div></form></div> </div></form></div>
</div></body></html> </div></body></html>

View File

@ -3,14 +3,14 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=cssHelper.title("config update")%> <%=intl.title("config update")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Update Configuration</h1> <h1><%=intl._("I2P Update Configuration")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<%@include file="confignav.jsp" %> <%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigUpdateHandler" id="formhandler" scope="request" /> <jsp:useBean class="net.i2p.router.web.ConfigUpdateHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" /> <jsp:setProperty name="formhandler" property="*" />
@ -26,35 +26,35 @@
if (prev != null) System.setProperty("net.i2p.router.web.ConfigUpdateHandler.noncePrev", prev); if (prev != null) System.setProperty("net.i2p.router.web.ConfigUpdateHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ConfigUpdateHandler.nonce", new java.util.Random().nextLong()+""); %> System.setProperty("net.i2p.router.web.ConfigUpdateHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigUpdateHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigUpdateHandler.nonce")%>" />
<h3>Check for I2P and news updates</h3> <h3><%=intl._("Check for I2P and news updates")%></h3>
<div class="wideload"><table border="0" cellspacing="5"> <div class="wideload"><table border="0" cellspacing="5">
<tr><td colspan="2"></tr> <tr><td colspan="2"></tr>
<tr><td class= "mediumtags" align="right"><b>News &amp; I2P Updates:</b></td> <tr><td class= "mediumtags" align="right"><b><%=intl._("News &amp; I2P Updates")%>:</b></td>
<td> <% if ("true".equals(System.getProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false"))) { %> <i>Update In Progress</i><br> <% } else { %> <input type="submit" name="action" value="Check for updates" /> <td> <% if ("true".equals(System.getProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false"))) { %> <i><%=intl._("Update In Progress")%></i><br> <% } else { %> <input type="submit" name="action" value="<%=intl._("Check for updates")%>" />
<% } %></td></tr> <% } %></td></tr>
<tr><td colspan="2"><br></td></tr> <tr><td colspan="2"><br></td></tr>
<tr><td class= "mediumtags" align="right"><b>News URL:</b></td> <tr><td class= "mediumtags" align="right"><b><%=intl._("News URL")%>:</b></td>
<td><input type="text" size="60" name="newsURL" value="<jsp:getProperty name="updatehelper" property="newsURL" />"></td> <td><input type="text" size="60" name="newsURL" value="<jsp:getProperty name="updatehelper" property="newsURL" />"></td>
</tr><tr><td class= "mediumtags" align="right"><b>Refresh frequency:</b> </tr><tr><td class= "mediumtags" align="right"><b><%=intl._("Refresh frequency")%>:</b>
<td><jsp:getProperty name="updatehelper" property="refreshFrequencySelectBox" /></td><tr> <td><jsp:getProperty name="updatehelper" property="refreshFrequencySelectBox" /></td><tr>
<td class= "mediumtags" align="right"><b><%=formhandler._("Update policy")%>:</b></td> <td class= "mediumtags" align="right"><b><%=formhandler._("Update policy")%>:</b></td>
<td><jsp:getProperty name="updatehelper" property="updatePolicySelectBox" /></td> <td><jsp:getProperty name="updatehelper" property="updatePolicySelectBox" /></td>
<tr><td class= "mediumtags" align="right"><b>Update through the eepProxy?</b></td> <tr><td class= "mediumtags" align="right"><b><%=intl._("Update through the eepProxy?")%></b></td>
<td><jsp:getProperty name="updatehelper" property="updateThroughProxy" /></td> <td><jsp:getProperty name="updatehelper" property="updateThroughProxy" /></td>
</tr><tr><td class= "mediumtags" align="right"><b>eepProxy host:</b></td> </tr><tr><td class= "mediumtags" align="right"><b><%=intl._("eepProxy host")%>:</b></td>
<td><input type="text" size="10" name="proxyHost" value="<jsp:getProperty name="updatehelper" property="proxyHost" />" /></td> <td><input type="text" size="10" name="proxyHost" value="<jsp:getProperty name="updatehelper" property="proxyHost" />" /></td>
</tr><tr><td class= "mediumtags" align="right"><b>eepProxy port:</b></td> </tr><tr><td class= "mediumtags" align="right"><b><%=intl._("eepProxy port")%>:</b></td>
<td><input type="text" size="4" name="proxyPort" value="<jsp:getProperty name="updatehelper" property="proxyPort" />" /></td> <td><input type="text" size="4" name="proxyPort" value="<jsp:getProperty name="updatehelper" property="proxyPort" />" /></td>
</tr><tr><td class= "mediumtags" align="right"><b>Update URLs:</b></td> </tr><tr><td class= "mediumtags" align="right"><b><%=intl._("Update URLs")%>:</b></td>
<td><textarea name="updateURL" wrap="off"><jsp:getProperty name="updatehelper" property="updateURL" /></textarea></td> <td><textarea name="updateURL" wrap="off"><jsp:getProperty name="updatehelper" property="updateURL" /></textarea></td>
</tr><tr><td class= "mediumtags" align="right"><b>Trusted keys:</b></td> </tr><tr><td class= "mediumtags" align="right"><b><%=intl._("Trusted keys")%>:</b></td>
<td><textarea name="trustedKeys" wrap="off"><jsp:getProperty name="updatehelper" property="trustedKeys" /></textarea></td> <td><textarea name="trustedKeys" wrap="off"><jsp:getProperty name="updatehelper" property="trustedKeys" /></textarea></td>
</tr><tr><td class= "mediumtags" align="right"><b>Update with unsigned development builds?</b></td> </tr><tr><td class= "mediumtags" align="right"><b><%=intl._("Update with unsigned development builds?")%></b></td>
<td><jsp:getProperty name="updatehelper" property="updateUnsigned" /></td> <td><jsp:getProperty name="updatehelper" property="updateUnsigned" /></td>
</tr><tr><td class= "mediumtags" align="right"><b>Unsigned Build URL:</b></td> </tr><tr><td class= "mediumtags" align="right"><b><%=intl._("Unsigned Build URL")%>:</b></td>
<td><input type="text" size="60" name="zipURL" value="<jsp:getProperty name="updatehelper" property="zipURL" />"></td> <td><input type="text" size="60" name="zipURL" value="<jsp:getProperty name="updatehelper" property="zipURL" />"></td>
</tr><tr class="tablefooter"><td colspan="2"> </tr><tr class="tablefooter"><td colspan="2">
<div class="formaction"> <div class="formaction">
<input type="submit" name="action" value="Save" /> <input type="submit" name="action" value="<%=intl._("Save")%>" />
<input type="reset" value="Cancel" /> <input type="reset" value="<%=intl._("Cancel")%>" />
</div></td></tr></table></div></form></div></div></body></html> </div></td></tr></table></div></form></div></div></body></html>

View File

@ -23,17 +23,17 @@
%> %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="/themes/console/images/favicon.ico"> <link rel="shortcut icon" href="/themes/console/images/favicon.ico">
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="cssHelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.CSSHelper" id="intl" scope="request" />
<jsp:setProperty name="cssHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="intl" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<% <%
cssHelper.setLang(request.getParameter("lang")); intl.setLang(request.getParameter("lang"));
%> %>
<link href="<%=cssHelper.getTheme(request.getHeader("User-Agent"))%>console.css" rel="stylesheet" type="text/css"> <link href="<%=intl.getTheme(request.getHeader("User-Agent"))%>console.css" rel="stylesheet" type="text/css">
<% <%
// make the fonts bigger for chinese // make the fonts bigger for chinese
if (cssHelper.getLang().equals("zh")) { if (intl.getLang().equals("zh")) {
%> %>
<link href="<%=cssHelper.getTheme(request.getHeader("User-Agent"))%>console_big.css" rel="stylesheet" type="text/css"> <link href="<%=intl.getTheme(request.getHeader("User-Agent"))%>console_big.css" rel="stylesheet" type="text/css">
<% <%
} }
%> %>

View File

@ -1,10 +1,15 @@
<%@page contentType="text/html"%> <%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
/*
* Do not tag this file for translation.
*/
%>
<html><head><title>I2P Router Console - Debug</title> <html><head><title>I2P Router Console - Debug</title>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>Router SKM</h1> <h1>Router SKM</h1>
<div class="main" id="main"> <div class="main" id="main">
<% <%

View File

@ -12,17 +12,13 @@
} }
// If it can't find the iframe or viewtheme.jsp I wonder if the whole thing blows up... // If it can't find the iframe or viewtheme.jsp I wonder if the whole thing blows up...
%> %>
<html><head><title>I2P Router Console - Page Not Found</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("Page Not Found")%>
</head><body> </head><body>
<% <%@include file="summary.jsi" %>
if (System.getProperty("router.consoleNonce") == null) {
System.setProperty("router.consoleNonce", new java.util.Random().nextLong() + "");
}
%>
<%@include file="summary.jsp" %>
<h1><%=ERROR_CODE%> <%=ERROR_MESSAGE%></h1> <h1><%=ERROR_CODE%> <%=ERROR_MESSAGE%></h1>
<div class="sorry" id="warning"> <div class="sorry" id="warning">
Sorry! You appear to be requesting a non-existent Router Console page or resource.<hr> <%=intl._("Sorry! You appear to be requesting a non-existent Router Console page or resource.")%><hr>
Error 404: <%=ERROR_URI%> not found. <%=intl._("Error 404")%>: <%=ERROR_URI%> <%=intl._("not found")%>.
</div></body></html> </div></body></html>

View File

@ -3,6 +3,8 @@
* USE CAUTION WHEN EDITING * USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause * Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!! * IllegalStateExceptions !!!
*
* Do not tag this file for translation.
*/ */
/** /**

View File

@ -2,12 +2,13 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - graphs</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("graphs")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Performance Graphs</h1> <h1><%=intl._("I2P Performance Graphs")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<div class="graphspanel"> <div class="graphspanel">
<div class="widepanel"> <div class="widepanel">

View File

@ -1,28 +1,32 @@
<%@page contentType="text/html"%> <%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
/*
* Do not tag this file for translation - copy it to help_xx.jsp and translate inline.
*/
%>
<html><head><title>I2P Router Console - help</title> <html><head><title>I2P Router Console - help</title>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Router Help & Support</h1> <h1>I2P Router Help & Support</h1>
<div class="main" id="main"><div align="justify"> <div class="main" id="main"><p>
If you'd like to help improve or translate the documentation, or If you'd like to help improve or translate the documentation, or
help with other aspects of the project, please see the documentation for help with other aspects of the project, please see the documentation for
<a href="http://www.i2p2.i2p/getinvolved.html">volunteers.</a> <a href="http://www.i2p2.i2p/getinvolved.html">volunteers.</a>
<br><br>Further assistance is available here:<br></div> </p><p>Further assistance is available here:
<ul class="links"> <ul class="links">
<li class="tidylist"><a href="http://www.i2p2.i2p/faq.html">FAQ on www.i2p2.i2p</a> <li class="tidylist"><a href="http://www.i2p2.i2p/faq.html">FAQ on www.i2p2.i2p</a>
<li class="tidylist"><a href="http://www.i2p2.i2p/faq_de.html">Deutsch FAQ</a>.</ul><br> <li class="tidylist"><a href="http://www.i2p2.i2p/faq_de.html">Deutsch FAQ</a>.</ul>
You may also try the <a href="http://forum.i2p/">I2P forum</a> <br>You may also try the <a href="http://forum.i2p/">I2P forum</a>
or IRC.<br> or IRC.</p>
<h2>Summary Bar Information</h2><div align="justify"> <h2>Summary Bar Information</h2><p>
Many of the stats on the summary bar may be Many of the stats on the summary bar may be
<a href="configstats.jsp">configured</a> to be <a href="configstats.jsp">configured</a> to be
<a href="graphs.jsp">graphed</a> for further analysis. <a href="graphs.jsp">graphed</a> for further analysis.
</div><h3>General</h3><ul> </p><h3>General</h3><ul>
<li class="tidylist"><b>Ident:</b> <li class="tidylist"><b>Ident:</b>
The first four characters (24 bits) of your 44-character (256-bit) Base64 router hash. The first four characters (24 bits) of your 44-character (256-bit) Base64 router hash.
The full hash is shown on your <a href="netdb.jsp?r=.">router info page</a>. The full hash is shown on your <a href="netdb.jsp?r=.">router info page</a>.
@ -75,7 +79,7 @@ The local applications connecting through your router.
These may be clients started through <a href="i2ptunnel/index.jsp">I2PTunnel</a> These may be clients started through <a href="i2ptunnel/index.jsp">I2PTunnel</a>
or external programs connecting through SAM, BOB, or directly to I2CP. or external programs connecting through SAM, BOB, or directly to I2CP.
</div><h3>Tunnels in/out</h3><div align="justify"> </div><h3>Tunnels in/out</h3><div align="justify">
The actual tunnels are shown on the <a href="tunnels.jsp">the tunnels page</a>.</div><br><ul> The actual tunnels are shown on the <a href="tunnels.jsp">the tunnels page</a>.</div><ul>
<li class="tidylist"><div align="justify"><b>Exploratory:</b> <li class="tidylist"><div align="justify"><b>Exploratory:</b>
Tunnels built by your router and used for communication with the floodfill peers, Tunnels built by your router and used for communication with the floodfill peers,
building new tunnels, and testing existing tunnels.</div> building new tunnels, and testing existing tunnels.</div>
@ -91,7 +95,7 @@ You may also limit the total number by setting <tt>router.maxParticipatingTunnel
the <a href="configadvanced.jsp">advanced configuration page</a>. <a href="configstats.jsp#tunnel.participatingTunnels">[Enable graphing]</a>.</ul> the <a href="configadvanced.jsp">advanced configuration page</a>. <a href="configstats.jsp#tunnel.participatingTunnels">[Enable graphing]</a>.</ul>
<h3>Congestion</h3><div align="justify"> <h3>Congestion</h3><div align="justify">
Some basic indications of router overload:</div><br><ul> Some basic indications of router overload:</div><ul>
<li class="tidylist"><b>Job lag:</b> <li class="tidylist"><b>Job lag:</b>
How long jobs are waiting before execution. The job queue is listed on the <a href="jobs.jsp">jobs page</a>. How long jobs are waiting before execution. The job queue is listed on the <a href="jobs.jsp">jobs page</a>.
Unfortunately, there are several other job queues in the router that may be congested, Unfortunately, there are several other job queues in the router that may be congested,
@ -129,9 +133,8 @@ or reject all requests for a number of reasons, to control
the bandwidth and CPU demands and maintain capacity for the bandwidth and CPU demands and maintain capacity for
local clients.</ul> local clients.</ul>
<h2>Legal stuff</h2><div align="justify"> <h2>Legal stuff</h2><p>The I2P router (router.jar) and SDK (i2p.jar) are almost entirely public domain, with
The I2P router (router.jar) and SDK (i2p.jar) are almost entirely public domain, with a few notable exceptions:</p><ul>
a few notable exceptions:</div><br><ul>
<li class="tidylist">ElGamal and DSA code, under the BSD license, written by TheCrypto</li> <li class="tidylist">ElGamal and DSA code, under the BSD license, written by TheCrypto</li>
<li class="tidylist">SHA256 and HMAC-SHA256, under the MIT license, written by the Legion of the Bouncycastle</li> <li class="tidylist">SHA256 and HMAC-SHA256, under the MIT license, written by the Legion of the Bouncycastle</li>
<li class="tidylist">AES code, under the Cryptix (MIT) license, written by the Cryptix team</li> <li class="tidylist">AES code, under the Cryptix (MIT) license, written by the Cryptix team</li>

View File

@ -3,8 +3,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<title>I2P Router Console - home</title> <%=intl.title("home")%>
</head><body> </head><body>
<% <%
if (System.getProperty("router.consoleNonce") == null) { if (System.getProperty("router.consoleNonce") == null) {
@ -12,7 +12,7 @@ if (System.getProperty("router.consoleNonce") == null) {
} }
%> %>
<%@include file="summary.jsp" %><h1>I2P Router Console</h1> <%@include file="summary.jsi" %><h1><%=intl._("I2P Router Console")%></h1>
<div class="news" id="news"> <div class="news" id="news">
<jsp:useBean class="net.i2p.router.web.ContentHelper" id="newshelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ContentHelper" id="newshelper" scope="request" />
<% java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); %> <% java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); %>

View File

@ -2,13 +2,14 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - job queue</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("job queue")%>
</head><body> </head><body>
<%@include file="summary.jsp" %><h1>I2P Router Job Queue</h1> <%@include file="summary.jsi" %><h1><%=intl._("I2P Router Job Queue")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<jsp:useBean class="net.i2p.router.web.JobQueueHelper" id="jobQueueHelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.JobQueueHelper" id="jobQueueHelper" scope="request" />
<jsp:setProperty name="jobQueueHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="jobQueueHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="jobQueueHelper" property="writer" value="<%=out%>" /> <jsp:setProperty name="jobQueueHelper" property="writer" value="<%=out%>" />
<jsp:getProperty name="jobQueueHelper" property="jobQueueSummary" /> <jsp:getProperty name="jobQueueHelper" property="jobQueueSummary" />
</div></body></html> <hr></div></body></html>

View File

@ -2,27 +2,28 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - logs</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("logs")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Router Logs</h1> <h1><%=intl._("I2P Router Logs")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<div class="joblog"><h3>Version:</h3><a name="version"> </a> <div class="joblog"><h3><%=intl._("I2P Version & Running Environment")%></h3><a name="version"> </a>
Please include this information in bug reports. <i><%=intl._("Please include this information in bug reports")%>:</i>
<p> <p>
I2P <jsp:getProperty name="helper" property="version" /><br> <b>I2P version:</b> <jsp:getProperty name="helper" property="version" /><br>
<%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%><br> <b>Java version:</b> <%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%><br>
<%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.version")%><br> <b>Platform:</b> <%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.version")%><br>
CPU <%=net.i2p.util.NativeBigInteger.cpuModel()%> (<%=net.i2p.util.NativeBigInteger.cpuType()%>)<br> <b>Processor:</b> <%=net.i2p.util.NativeBigInteger.cpuModel()%> (<%=net.i2p.util.NativeBigInteger.cpuType()%>)<br>
jbigi <%=net.i2p.util.NativeBigInteger.loadStatus()%><br> <b>Jbigi:</b> <%=net.i2p.util.NativeBigInteger.loadStatus()%><br>
Encoding <%=System.getProperty("file.encoding")%><br></p><br> <b>Encoding:</b> <%=System.getProperty("file.encoding")%></p>
<jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" />
<jsp:setProperty name="logsHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="logsHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<h3>Critical logs:</h3><a name="criticallogs"> </a> <h3>Critical Logs</h3><a name="criticallogs"> </a>
<jsp:getProperty name="logsHelper" property="criticalLogs" /><br> <jsp:getProperty name="logsHelper" property="criticalLogs" />
<h3>Router logs (<a href="configlogging.jsp">configure</a>):</h3> <h3>Router Logs [<a href="configlogging.jsp">configure</a>]</h3>
<jsp:getProperty name="logsHelper" property="logs" /><br> <jsp:getProperty name="logsHelper" property="logs" />
<h3>Service (Wrapper) logs:</h3><a name="servicelogs"> </a> <h3>Service (Wrapper) Logs</h3><a name="servicelogs"> </a>
<jsp:getProperty name="logsHelper" property="serviceLogs" /> <jsp:getProperty name="logsHelper" property="serviceLogs" />
</div></div></body></html> </div><hr></div></body></html>

View File

@ -3,11 +3,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head> <html><head>
<title>I2P Router Console - network database summary</title> <%@include file="css.jsi" %>
<%@include file="css.jsp" %> <%=intl.title("network database summary")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Network Database Summary</h1> <h1><%=intl._("I2P Network Database Summary")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<div class="wideload"> <div class="wideload">
<jsp:useBean class="net.i2p.router.web.NetDbHelper" id="netdbHelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.NetDbHelper" id="netdbHelper" scope="request" />

View File

@ -1,11 +1,15 @@
<%@page contentType="text/html"%> <%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
/*
* Do not tag this file for translation.
*/
%>
<html><head><title>I2P Router Console - internals</title> <html><head><title>I2P Router Console - internals</title>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.OldConsoleHelper" id="conhelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.OldConsoleHelper" id="conhelper" scope="request" />
<jsp:setProperty name="conhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="conhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="conhelper" property="writer" value="<%=out%>" /> <jsp:setProperty name="conhelper" property="writer" value="<%=out%>" />

View File

@ -2,11 +2,12 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - peer connections</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("peer connections")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<h1>I2P Network Peers</h1> <h1><%=intl._("I2P Network Peers")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<jsp:useBean class="net.i2p.router.web.PeerHelper" id="peerHelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.PeerHelper" id="peerHelper" scope="request" />
<jsp:setProperty name="peerHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="peerHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />

View File

@ -2,16 +2,17 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - peer profiles</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
</head><body><%@include file="summary.jsp" %> <%=intl.title("peer profiles")%>
<h1>I2P Network Peer Profiles</h1> </head><body><%@include file="summary.jsi" %>
<h1><%=intl._("I2P Network Peer Profiles")%></h1>
<div class="main" id="main"><div class="wideload"> <div class="main" id="main"><div class="wideload">
<jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" />
<jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" /> <jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" />
<jsp:setProperty name="profilesHelper" property="full" value="<%=request.getParameter("f")%>" />
<jsp:getProperty name="profilesHelper" property="profileSummary" /> <jsp:getProperty name="profilesHelper" property="profileSummary" />
<br> <a name="shitlist"> </a><h2><%=intl._("Banned Peers")%></h2>
<a name="shitlist"> </a>
<jsp:getProperty name="profilesHelper" property="shitlistSummary" /> <jsp:getProperty name="profilesHelper" property="shitlistSummary" />
</div></div></body></html> <hr></div></div></body></html>

View File

@ -2,14 +2,15 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - statistics</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("statistics")%>
</head><body> </head><body>
<%@include file="summary.jsp" %> <%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.OldConsoleHelper" id="oldhelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.OldConsoleHelper" id="oldhelper" scope="request" />
<jsp:setProperty name="oldhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="oldhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="oldhelper" property="writer" value="<%=out%>" /> <jsp:setProperty name="oldhelper" property="writer" value="<%=out%>" />
<h1>I2P Router Statistics</h1> <h1><%=intl._("I2P Router Statistics")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<jsp:getProperty name="oldhelper" property="stats" /> <jsp:getProperty name="oldhelper" property="stats" />
</div></body></html> <hr></div></body></html>

View File

@ -14,7 +14,7 @@
out.print("<iframe src=\"summaryframe.jsp" + newDelay + "\" height=\"1500\" width=\"200\" scrolling=\"auto\" frameborder=\"0\" title=\"sidepanel\">\n"); out.print("<iframe src=\"summaryframe.jsp" + newDelay + "\" height=\"1500\" width=\"200\" scrolling=\"auto\" frameborder=\"0\" title=\"sidepanel\">\n");
%> %>
<div class="routersummary"> <div class="routersummary">
<%@include file="summarynoframe.jsp" %> <%@include file="summarynoframe.jsi" %>
<% <%
// d defined above // d defined above
if (!"0".equals(d)) { if (!"0".equals(d)) {
@ -22,10 +22,18 @@
} else { } else {
// since we don't have an iframe this will reload the base page, and // since we don't have an iframe this will reload the base page, and
// the new delay will be passed to the iframe above // the new delay will be passed to the iframe above
out.print("<form action=\"" + request.getRequestURI() + "\" method=\"GET\">\n"); out.print("<div class=\"refresh\"><form action=\"" + request.getRequestURI() + "\" method=\"GET\">\n");
out.print("<b>Refresh (s):</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n"); out.print("<b>");
out.print("<button type=\"submit\">Enable</button>\n"); // We have intl defined when this is included, but not when compiled standalone.
out.print("</form></div>\n"); // Not that we really need it standalone, but I can't figure out how to keep
// this from being compiled by JspC in the build file.
out.print(net.i2p.router.web.Messages.getString("Refresh (s)", net.i2p.I2PAppContext.getGlobalContext()));
out.print(":</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n");
out.print("<button type=\"submit\" value=\"Enable\" >");
// ditto
out.print(net.i2p.router.web.Messages.getString("Enable", net.i2p.I2PAppContext.getGlobalContext()));
out.print("</button>\n");
out.print("</form></div></div>\n");
} }
%> %>
</div> </div>

View File

@ -8,7 +8,7 @@
*/ */
%> %>
<html><head> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<title>Summary Bar</title> <title>Summary Bar</title>
<% <%
// try hard to avoid an error page in the iframe after shutdown // try hard to avoid an error page in the iframe after shutdown
@ -25,7 +25,7 @@
} else { } else {
System.setProperty("routerconsole.summaryRefresh", d); System.setProperty("routerconsole.summaryRefresh", d);
} }
// we probably don't get here if d == "0" since caught in summary.jsp, but just // we probably don't get here if d == "0" since caught in summary.jsi, but just
// to be sure... // to be sure...
if (!"0".equals(d)) { if (!"0".equals(d)) {
// doesn't work for restart or shutdown with no expl. tunnels, // doesn't work for restart or shutdown with no expl. tunnels,
@ -49,20 +49,26 @@
} }
%> %>
</head><body style="margin: 0;"><div class="routersummary"> </head><body style="margin: 0;"><div class="routersummary">
<%@include file="summarynoframe.jsp" %> <%@include file="summarynoframe.jsi" %>
<% <%
// d and shutdownSoon defined above // d and shutdownSoon defined above
if (!shutdownSoon) { if (!shutdownSoon) {
out.print("<hr><form action=\"summaryframe.jsp\" method=\"GET\">\n"); out.print("<div class=\"refresh\"><form action=\"summaryframe.jsp\" method=\"GET\">\n");
if ("0".equals(d)) { if ("0".equals(d)) {
out.print("<b>Refresh (s):<b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" align=\"right\" />\n"); out.print("<b>");
out.print("<button type=\"submit\">Enable</button>\n"); out.print(intl._("Refresh (s)"));
out.print(":</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n");
out.print("<button type=\"submit\" value=\"Enable\" >");
out.print(intl._("Enable"));
out.print("</button></div>\n");
} else { } else {
// this will load in the iframe but subsequent pages will not have the iframe // this will load in the iframe but subsequent pages will not have the iframe
out.print("<input type=\"hidden\" name=\"refresh\" value=\"0\" />\n"); out.print("<input type=\"hidden\" name=\"refresh\" value=\"0\" />\n");
out.print("<button type=\"submit\">Disable " + d + "s Refresh</button>\n"); out.print("<button type=\"submit\" value=\"Disable\" >");
out.print(intl._("Disable {0}s Refresh", d));
out.print("</button></div>\n");
} }
out.print("</form><hr>\n"); out.print("</form>\n");
} }
%> %>
</div></body></html> </div></body></html>

View File

@ -2,10 +2,11 @@
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>I2P Router Console - tunnel summary</title> <html><head>
<%@include file="css.jsp" %> <%@include file="css.jsi" %>
<%=intl.title("tunnel summary")%>
</head><body> </head><body>
<%@include file="summary.jsp" %><h1>I2P Tunnel Summary</h1> <%@include file="summary.jsi" %><h1><%=intl._("I2P Tunnel Summary")%></h1>
<div class="main" id="main"> <div class="main" id="main">
<jsp:useBean class="net.i2p.router.web.TunnelHelper" id="tunnelHelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.TunnelHelper" id="tunnelHelper" scope="request" />
<jsp:setProperty name="tunnelHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> <jsp:setProperty name="tunnelHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />

View File

@ -3,6 +3,8 @@
* USE CAUTION WHEN EDITING * USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause * Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!! * IllegalStateExceptions !!!
*
* Do not tag this file for translation.
*/ */
boolean rendered = false; boolean rendered = false;

View File

@ -3,6 +3,8 @@
* USE CAUTION WHEN EDITING * USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause * Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!! * IllegalStateExceptions !!!
*
* Do not tag this file for translation.
*/ */
String uri = request.getRequestURI(); String uri = request.getRequestURI();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -189,9 +189,9 @@ public class Connection {
+ _activeResends + "), waiting " + timeLeft); + _activeResends + "), waiting " + timeLeft);
try { _outboundPackets.wait(Math.min(timeLeft,250l)); } catch (InterruptedException ie) { if (_log.shouldLog(Log.DEBUG)) _log.debug("InterruptedException while Outbound window is full (" + _outboundPackets.size() + "/" + _activeResends +")"); return false;} try { _outboundPackets.wait(Math.min(timeLeft,250l)); } catch (InterruptedException ie) { if (_log.shouldLog(Log.DEBUG)) _log.debug("InterruptedException while Outbound window is full (" + _outboundPackets.size() + "/" + _activeResends +")"); return false;}
} else { } else {
if (_log.shouldLog(Log.DEBUG)) //if (_log.shouldLog(Log.DEBUG))
_log.debug("Outbound window is full (" + _outboundPackets.size() + "/" + _activeResends // _log.debug("Outbound window is full (" + _outboundPackets.size() + "/" + _activeResends
+ "), waiting indefinitely"); // + "), waiting indefinitely");
try { _outboundPackets.wait(250); } catch (InterruptedException ie) {if (_log.shouldLog(Log.DEBUG)) _log.debug("InterruptedException while Outbound window is full (" + _outboundPackets.size() + "/" + _activeResends + ")"); return false;} //10*1000 try { _outboundPackets.wait(250); } catch (InterruptedException ie) {if (_log.shouldLog(Log.DEBUG)) _log.debug("InterruptedException while Outbound window is full (" + _outboundPackets.size() + "/" + _activeResends + ")"); return false;} //10*1000
} }
} else { } else {
@ -297,37 +297,48 @@ public class Connection {
if ( (packet.getSequenceNum() == 0) && (!packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) ) { if ( (packet.getSequenceNum() == 0) && (!packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) ) {
ackOnly = true; ackOnly = true;
if (_log.shouldLog(Log.DEBUG)) //if (_log.shouldLog(Log.DEBUG))
_log.debug("No resend for " + packet); // _log.debug("No resend for " + packet);
} else { } else {
int remaining = 0; int windowSize;
int remaining;
synchronized (_outboundPackets) { synchronized (_outboundPackets) {
_outboundPackets.put(new Long(packet.getSequenceNum()), packet); _outboundPackets.put(new Long(packet.getSequenceNum()), packet);
remaining = _options.getWindowSize() - _outboundPackets.size() ; windowSize = _options.getWindowSize();
remaining = windowSize - _outboundPackets.size() ;
_outboundPackets.notifyAll(); _outboundPackets.notifyAll();
} }
if (remaining < 0) // the other end has no idea what our window size is, so
remaining = 0; // help him out by requesting acks below the 1/3 point,
if (packet.isFlagSet(Packet.FLAG_CLOSE) || (remaining < 2)) { // if remaining < 3, and every 8 minimum.
if (packet.isFlagSet(Packet.FLAG_CLOSE) ||
(remaining < (windowSize + 2) / 3) ||
(remaining < 3) ||
(packet.getSequenceNum() % 8 == 0)) {
packet.setOptionalDelay(0); packet.setOptionalDelay(0);
packet.setFlag(Packet.FLAG_DELAY_REQUESTED); packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Requesting no ack delay for packet " + packet); _log.debug("Requesting no ack delay for packet " + packet);
} else { } else {
int delay = _options.getRTO() / 2; // This is somewhat of a waste of time, unless the RTT < 4000,
// since the other end limits it to getSendAckDelay()
// which is always 2000, but it's good for diagnostics to see what the other end thinks
// the RTT is.
int delay = _options.getRTT() / 2;
packet.setOptionalDelay(delay); packet.setOptionalDelay(delay);
if (delay > 0) if (delay > 0)
packet.setFlag(Packet.FLAG_DELAY_REQUESTED); packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Requesting ack delay of " + delay + "ms for packet " + packet); _log.debug("Requesting ack delay of " + delay + "ms for packet " + packet);
} }
// WHY always set?
packet.setFlag(Packet.FLAG_DELAY_REQUESTED); packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
long timeout = _options.getRTO(); long timeout = _options.getRTO();
if (timeout > MAX_RESEND_DELAY) if (timeout > MAX_RESEND_DELAY)
timeout = MAX_RESEND_DELAY; timeout = MAX_RESEND_DELAY;
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Resend in " + timeout + " for " + packet, new Exception("Sent by")); _log.debug("Resend in " + timeout + " for " + packet);
// schedules itself // schedules itself
ResendPacketEvent rpe = new ResendPacketEvent(packet, timeout); ResendPacketEvent rpe = new ResendPacketEvent(packet, timeout);
@ -370,6 +381,10 @@ public class Connection {
} }
*********/ *********/
/**
* Process the acks and nacks received in a packet
* @return List of packets acked or null
*/
List ackPackets(long ackThrough, long nacks[]) { List ackPackets(long ackThrough, long nacks[]) {
if (ackThrough < _highestAckedThrough) { if (ackThrough < _highestAckedThrough) {
// dupack which won't tell us anything // dupack which won't tell us anything
@ -685,6 +700,14 @@ public class Connection {
* @return the next time the scheduler will want to send a packet, or -1 if never. * @return the next time the scheduler will want to send a packet, or -1 if never.
*/ */
public long getNextSendTime() { return _nextSendTime; } public long getNextSendTime() { return _nextSendTime; }
/**
* If the next send time is currently >= 0 (i.e. not "never"),
* this may make the next time sooner but will not make it later.
* If the next send time is currently < 0 (i.e. "never"),
* this will set it to the time specified, but not later than
* options.getSendAckDelay() from now (2000 ms)
*/
public void setNextSendTime(long when) { public void setNextSendTime(long when) {
if (_nextSendTime >= 0) { if (_nextSendTime >= 0) {
if (when < _nextSendTime) if (when < _nextSendTime)
@ -699,12 +722,12 @@ public class Connection {
_nextSendTime = max; _nextSendTime = max;
} }
if (_log.shouldLog(Log.DEBUG) && false) { //if (_log.shouldLog(Log.DEBUG) && false) {
if (_nextSendTime <= 0) // if (_nextSendTime <= 0)
_log.debug("set next send time to an unknown time", new Exception(toString())); // _log.debug("set next send time to an unknown time", new Exception(toString()));
else // else
_log.debug("set next send time to " + (_nextSendTime-_context.clock().now()) + "ms from now", new Exception(toString())); // _log.debug("set next send time to " + (_nextSendTime-_context.clock().now()) + "ms from now", new Exception(toString()));
} //}
} }
/** how many packets have we sent and the other side has ACKed? /** how many packets have we sent and the other side has ACKed?
@ -742,7 +765,9 @@ public class Connection {
public long getCongestionWindowEnd() { return _congestionWindowEnd; } public long getCongestionWindowEnd() { return _congestionWindowEnd; }
public void setCongestionWindowEnd(long endMsg) { _congestionWindowEnd = endMsg; } public void setCongestionWindowEnd(long endMsg) { _congestionWindowEnd = endMsg; }
/** @return the highest outbound packet we have recieved an ack for */
public long getHighestAckedThrough() { return _highestAckedThrough; } public long getHighestAckedThrough() { return _highestAckedThrough; }
/** @deprecated unused */
public void setHighestAckedThrough(long msgNum) { _highestAckedThrough = msgNum; } public void setHighestAckedThrough(long msgNum) { _highestAckedThrough = msgNum; }
public long getLastActivityOn() { public long getLastActivityOn() {
@ -835,8 +860,8 @@ public class Connection {
} }
long howLong = _options.getInactivityTimeout(); long howLong = _options.getInactivityTimeout();
howLong += _randomWait; // randomize it a bit, so both sides don't do it at once howLong += _randomWait; // randomize it a bit, so both sides don't do it at once
if (_log.shouldLog(Log.DEBUG)) //if (_log.shouldLog(Log.DEBUG))
_log.debug("Resetting the inactivity timer to " + howLong, new Exception(toString())); // _log.debug("Resetting the inactivity timer to " + howLong);
// this will get rescheduled, and rescheduled, and rescheduled... // this will get rescheduled, and rescheduled, and rescheduled...
_activityTimer.reschedule(howLong, false); // use the later of current and previous timeout _activityTimer.reschedule(howLong, false); // use the later of current and previous timeout
} }
@ -1087,6 +1112,8 @@ public class Connection {
// we want to resend this packet, but there are already active // we want to resend this packet, but there are already active
// resends in the air and we dont want to make a bad situation // resends in the air and we dont want to make a bad situation
// worse. wait another second // worse. wait another second
// BUG? seq# = 0, activeResends = 0, loop forever - why?
// also seen with seq# > 0. Is the _activeResends count reliable?
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
_log.info("Delaying resend of " + _packet + " as there are " _log.info("Delaying resend of " + _packet + " as there are "
+ _activeResends + " active resends already in play"); + _activeResends + " active resends already in play");
@ -1104,8 +1131,10 @@ public class Connection {
_packet.setOptionalDelay(choke); _packet.setOptionalDelay(choke);
if (choke > 0) if (choke > 0)
_packet.setFlag(Packet.FLAG_DELAY_REQUESTED); _packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
// this seems unnecessary to send the MSS again:
_packet.setOptionalMaxSize(getOptions().getMaxMessageSize()); _packet.setOptionalMaxSize(getOptions().getMaxMessageSize());
_packet.setResendDelay(getOptions().getResendDelay()); // bugfix release 0.7.8, we weren't dividing by 1000
_packet.setResendDelay(getOptions().getResendDelay() / 1000);
if (_packet.getReceiveStreamId() <= 0) if (_packet.getReceiveStreamId() <= 0)
_packet.setReceiveStreamId(_receiveStreamId); _packet.setReceiveStreamId(_receiveStreamId);
if (_packet.getSendStreamId() <= 0) if (_packet.getSendStreamId() <= 0)

View File

@ -166,11 +166,13 @@ class ConnectionDataReceiver implements MessageOutputStream.DataReceiver {
packet.setReceiveStreamId(con.getReceiveStreamId()); packet.setReceiveStreamId(con.getReceiveStreamId());
con.getInputStream().updateAcks(packet); con.getInputStream().updateAcks(packet);
// note that the optional delay is usually rewritten in Connection.sendPacket()
int choke = con.getOptions().getChoke(); int choke = con.getOptions().getChoke();
packet.setOptionalDelay(choke); packet.setOptionalDelay(choke);
if (choke > 0) if (choke > 0)
packet.setFlag(Packet.FLAG_DELAY_REQUESTED); packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
packet.setResendDelay(con.getOptions().getResendDelay()); // bugfix release 0.7.8, we weren't dividing by 1000
packet.setResendDelay(con.getOptions().getResendDelay() / 1000);
if (con.getOptions().getProfile() == ConnectionOptions.PROFILE_INTERACTIVE) if (con.getOptions().getProfile() == ConnectionOptions.PROFILE_INTERACTIVE)
packet.setFlag(Packet.FLAG_PROFILE_INTERACTIVE, true); packet.setFlag(Packet.FLAG_PROFILE_INTERACTIVE, true);
@ -196,12 +198,9 @@ class ConnectionDataReceiver implements MessageOutputStream.DataReceiver {
( (size > 0) || (con.getUnackedPacketsSent() <= 0) || (packet.getSequenceNum() > 0) ) ) { ( (size > 0) || (con.getUnackedPacketsSent() <= 0) || (packet.getSequenceNum() > 0) ) ) {
packet.setFlag(Packet.FLAG_CLOSE); packet.setFlag(Packet.FLAG_CLOSE);
con.setCloseSentOn(_context.clock().now()); con.setCloseSentOn(_context.clock().now());
if (_log.shouldLog(Log.DEBUG))
_log.debug("Closed is set for a new packet on " + con + ": " + packet);
} else {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Closed is not set for a new packet on " + _connection + ": " + packet);
} }
if (_log.shouldLog(Log.DEBUG))
_log.debug("New outbound packet on " + _connection + ": " + packet);
return packet; return packet;
} }

View File

@ -46,6 +46,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
public static final String PROP_INITIAL_RESEND_DELAY = "i2p.streaming.initialResendDelay"; public static final String PROP_INITIAL_RESEND_DELAY = "i2p.streaming.initialResendDelay";
public static final String PROP_INITIAL_ACK_DELAY = "i2p.streaming.initialAckDelay"; public static final String PROP_INITIAL_ACK_DELAY = "i2p.streaming.initialAckDelay";
public static final String PROP_INITIAL_WINDOW_SIZE = "i2p.streaming.initialWindowSize"; public static final String PROP_INITIAL_WINDOW_SIZE = "i2p.streaming.initialWindowSize";
/** unused */
public static final String PROP_INITIAL_RECEIVE_WINDOW = "i2p.streaming.initialReceiveWindow"; public static final String PROP_INITIAL_RECEIVE_WINDOW = "i2p.streaming.initialReceiveWindow";
public static final String PROP_INACTIVITY_TIMEOUT = "i2p.streaming.inactivityTimeout"; public static final String PROP_INACTIVITY_TIMEOUT = "i2p.streaming.inactivityTimeout";
public static final String PROP_INACTIVITY_ACTION = "i2p.streaming.inactivityAction"; public static final String PROP_INACTIVITY_ACTION = "i2p.streaming.inactivityAction";
@ -58,6 +59,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
static final int INITIAL_WINDOW_SIZE = 6; static final int INITIAL_WINDOW_SIZE = 6;
static final int DEFAULT_MAX_SENDS = 8; static final int DEFAULT_MAX_SENDS = 8;
public static final int DEFAULT_INITIAL_RTT = 8*1000; public static final int DEFAULT_INITIAL_RTT = 8*1000;
public static final int DEFAULT_INITIAL_ACK_DELAY = 2*1000;
static final int MIN_WINDOW_SIZE = 1; static final int MIN_WINDOW_SIZE = 1;
private static final boolean DEFAULT_ANSWER_PINGS = true; private static final boolean DEFAULT_ANSWER_PINGS = true;
@ -217,7 +219,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
setRTT(getInt(opts, PROP_INITIAL_RTT, DEFAULT_INITIAL_RTT)); setRTT(getInt(opts, PROP_INITIAL_RTT, DEFAULT_INITIAL_RTT));
setReceiveWindow(getInt(opts, PROP_INITIAL_RECEIVE_WINDOW, 1)); setReceiveWindow(getInt(opts, PROP_INITIAL_RECEIVE_WINDOW, 1));
setResendDelay(getInt(opts, PROP_INITIAL_RESEND_DELAY, 1000)); setResendDelay(getInt(opts, PROP_INITIAL_RESEND_DELAY, 1000));
setSendAckDelay(getInt(opts, PROP_INITIAL_ACK_DELAY, 2000)); setSendAckDelay(getInt(opts, PROP_INITIAL_ACK_DELAY, DEFAULT_INITIAL_ACK_DELAY));
setWindowSize(getInt(opts, PROP_INITIAL_WINDOW_SIZE, INITIAL_WINDOW_SIZE)); setWindowSize(getInt(opts, PROP_INITIAL_WINDOW_SIZE, INITIAL_WINDOW_SIZE));
setMaxResends(getInt(opts, PROP_MAX_RESENDS, DEFAULT_MAX_SENDS)); setMaxResends(getInt(opts, PROP_MAX_RESENDS, DEFAULT_MAX_SENDS));
setWriteTimeout(getInt(opts, PROP_WRITE_TIMEOUT, -1)); setWriteTimeout(getInt(opts, PROP_WRITE_TIMEOUT, -1));
@ -249,7 +251,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
if (opts.containsKey(PROP_INITIAL_RESEND_DELAY)) if (opts.containsKey(PROP_INITIAL_RESEND_DELAY))
setResendDelay(getInt(opts, PROP_INITIAL_RESEND_DELAY, 1000)); setResendDelay(getInt(opts, PROP_INITIAL_RESEND_DELAY, 1000));
if (opts.containsKey(PROP_INITIAL_ACK_DELAY)) if (opts.containsKey(PROP_INITIAL_ACK_DELAY))
setSendAckDelay(getInt(opts, PROP_INITIAL_ACK_DELAY, 2000)); setSendAckDelay(getInt(opts, PROP_INITIAL_ACK_DELAY, DEFAULT_INITIAL_ACK_DELAY));
if (opts.containsKey(PROP_INITIAL_WINDOW_SIZE)) if (opts.containsKey(PROP_INITIAL_WINDOW_SIZE))
setWindowSize(getInt(opts, PROP_INITIAL_WINDOW_SIZE, INITIAL_WINDOW_SIZE)); setWindowSize(getInt(opts, PROP_INITIAL_WINDOW_SIZE, INITIAL_WINDOW_SIZE));
if (opts.containsKey(PROP_MAX_RESENDS)) if (opts.containsKey(PROP_MAX_RESENDS))
@ -295,6 +297,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
* @return if we want signatures on all packets. * @return if we want signatures on all packets.
*/ */
public boolean getRequireFullySigned() { return _fullySigned; } public boolean getRequireFullySigned() { return _fullySigned; }
/** unused, see above */
public void setRequireFullySigned(boolean sign) { _fullySigned = sign; } public void setRequireFullySigned(boolean sign) { _fullySigned = sign; }
/** /**
@ -325,7 +328,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
} }
/** after how many consecutive messages should we ack? /** after how many consecutive messages should we ack?
* This doesn't appear to be used. * @deprecated This doesn't appear to be used.
* @return receive window size. * @return receive window size.
*/ */
public int getReceiveWindow() { return _receiveWindow; } public int getReceiveWindow() { return _receiveWindow; }
@ -405,6 +408,10 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
* @return ACK delay in ms * @return ACK delay in ms
*/ */
public int getSendAckDelay() { return _sendAckDelay; } public int getSendAckDelay() { return _sendAckDelay; }
/**
* Unused except here, so expect the default initial delay of 2000 ms unless set by the user
* to remain constant.
*/
public void setSendAckDelay(int delayMs) { _sendAckDelay = delayMs; } public void setSendAckDelay(int delayMs) { _sendAckDelay = delayMs; }
/** What is the largest message we want to send or receive? /** What is the largest message we want to send or receive?

View File

@ -131,11 +131,14 @@ public class ConnectionPacketHandler {
isNew = false; isNew = false;
} }
if ( (packet.getSequenceNum() == 0) && (packet.getPayloadSize() > 0) ) { //if ( (packet.getSequenceNum() == 0) && (packet.getPayloadSize() > 0) ) {
if (_log.shouldLog(Log.DEBUG)) // if (_log.shouldLog(Log.DEBUG))
_log.debug("seq=0 && size=" + packet.getPayloadSize() + ": isNew? " + isNew // _log.debug("seq=0 && size=" + packet.getPayloadSize() + ": isNew? " + isNew
+ " packet: " + packet + " con: " + con); // + " packet: " + packet + " con: " + con);
} //}
if (_log.shouldLog(Log.DEBUG))
_log.debug((isNew ? "New" : "Dup or ack-only") + " inbound packet on " + con + ": " + packet);
// close *after* receiving the data, as well as after verifying the signatures / etc // close *after* receiving the data, as well as after verifying the signatures / etc
if (packet.isFlagSet(Packet.FLAG_CLOSE) && packet.isFlagSet(Packet.FLAG_SIGNATURE_INCLUDED)) if (packet.isFlagSet(Packet.FLAG_CLOSE) && packet.isFlagSet(Packet.FLAG_SIGNATURE_INCLUDED))
@ -151,7 +154,9 @@ public class ConnectionPacketHandler {
if (packet.isFlagSet(Packet.FLAG_DELAY_REQUESTED) && (packet.getOptionalDelay() <= 0) ) { if (packet.isFlagSet(Packet.FLAG_DELAY_REQUESTED) && (packet.getOptionalDelay() <= 0) ) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Scheduling immediate ack for " + packet); _log.debug("Scheduling immediate ack for " + packet);
con.setNextSendTime(_context.clock().now() + con.getOptions().getSendAckDelay()); //con.setNextSendTime(_context.clock().now() + con.getOptions().getSendAckDelay());
// honor request "almost" immediately
con.setNextSendTime(_context.clock().now() + 250);
} else { } else {
int delay = con.getOptions().getSendAckDelay(); int delay = con.getOptions().getSendAckDelay();
if (packet.isFlagSet(Packet.FLAG_DELAY_REQUESTED)) // delayed ACK requested if (packet.isFlagSet(Packet.FLAG_DELAY_REQUESTED)) // delayed ACK requested
@ -222,6 +227,10 @@ public class ConnectionPacketHandler {
// con.fastRetransmit(); // con.fastRetransmit();
} }
/**
* Process the acks in a received packet, and adjust our window and RTT
* @return are we congested?
*/
private boolean ack(Connection con, long ackThrough, long nacks[], Packet packet, boolean isNew, boolean choke) { private boolean ack(Connection con, long ackThrough, long nacks[], Packet packet, boolean isNew, boolean choke) {
if (ackThrough < 0) return false; if (ackThrough < 0) return false;
//if ( (nacks != null) && (nacks.length > 0) ) //if ( (nacks != null) && (nacks.length > 0) )
@ -287,7 +296,7 @@ public class ConnectionPacketHandler {
return adjustWindow(con, isNew, packet.getSequenceNum(), numResends, (acked != null ? acked.size() : 0), choke); return adjustWindow(con, isNew, packet.getSequenceNum(), numResends, (acked != null ? acked.size() : 0), choke);
} }
/** @return are we congested? */
private boolean adjustWindow(Connection con, boolean isNew, long sequenceNum, int numResends, int acked, boolean choke) { private boolean adjustWindow(Connection con, boolean isNew, long sequenceNum, int numResends, int acked, boolean choke) {
boolean congested = false; boolean congested = false;
if ( (!isNew) && (sequenceNum > 0) ) { if ( (!isNew) && (sequenceNum > 0) ) {

View File

@ -42,7 +42,7 @@ import net.i2p.util.Log;
* <li>{@link #FLAG_MAX_PACKET_SIZE_INCLUDED}: 2 byte integer</li> * <li>{@link #FLAG_MAX_PACKET_SIZE_INCLUDED}: 2 byte integer</li>
* <li>{@link #FLAG_PROFILE_INTERACTIVE}: no option data</li> * <li>{@link #FLAG_PROFILE_INTERACTIVE}: no option data</li>
* <li>{@link #FLAG_ECHO}: no option data</li> * <li>{@link #FLAG_ECHO}: no option data</li>
* <li>{@link #FLAG_NO_ACK}: no option data</li> * <li>{@link #FLAG_NO_ACK}: no option data - this appears to be unused, we always ack, even for the first packet</li>
* </ol> * </ol>
* *
* <p>If the signature is included, it uses the Destination's DSA key * <p>If the signature is included, it uses the Destination's DSA key
@ -216,9 +216,21 @@ public class Packet {
* resending this packet (if it hasn't yet been ACKed). The * resending this packet (if it hasn't yet been ACKed). The
* value is seconds since the packet was created. * value is seconds since the packet was created.
* *
* Unused.
* Broken before release 0.7.8
* Not to be used without sanitizing for huge values.
* Setters from options did not divide by 1000, and the options default
* is 1000, so the value sent in the 1-byte field was always
* 1000 & 0xff = 0xe8 = 232
*
* @return Delay before resending a packet in seconds. * @return Delay before resending a packet in seconds.
*/ */
public int getResendDelay() { return _resendDelay; } public int getResendDelay() { return _resendDelay; }
/**
* Unused.
* Broken before release 0.7.8
* See above
*/
public void setResendDelay(int numSeconds) { _resendDelay = numSeconds; } public void setResendDelay(int numSeconds) { _resendDelay = numSeconds; }
public static final int MAX_PAYLOAD_SIZE = 32*1024; public static final int MAX_PAYLOAD_SIZE = 32*1024;

View File

@ -71,6 +71,7 @@ The subscription file contains a list of (i2p) URLs. The addressbook application
regularly (once per hour) checks this list for new eepsites. Those URLs simply contain the published hosts.txt regularly (once per hour) checks this list for new eepsites. Those URLs simply contain the published hosts.txt
file of other people. The default subscription is the hosts.txt from www.i2p2.i2p, which is updated infrequently. file of other people. The default subscription is the hosts.txt from www.i2p2.i2p, which is updated infrequently.
So it is a good idea to add additional subscriptions to sites that have the latest addresses. So it is a good idea to add additional subscriptions to sites that have the latest addresses.
<a href="http://www.i2p2.i2p/faq.html#subscriptions">See the FAQ for a list of subscription URLs.</a>
</p> </p>
</div><hr> </div><hr>
<div id="footer"> <div id="footer">

View File

@ -8,6 +8,7 @@
--> -->
<!-- You probably don't want to change anything from here down --> <!-- You probably don't want to change anything from here down -->
<target name="help" depends="all" />
<target name="all" > <target name="all" >
<echo message="Useful targets: " /> <echo message="Useful targets: " />
<echo message=" pkg: distclean then package everything up (installer, clean tarball, update tarball)" /> <echo message=" pkg: distclean then package everything up (installer, clean tarball, update tarball)" />
@ -31,6 +32,7 @@
<echo message=" pkgWithDesktopgui: distclean then package everything up with the desktopgui" /> <echo message=" pkgWithDesktopgui: distclean then package everything up with the desktopgui" />
<echo message=" distWithDesktopgui: pkgWithDesktopgui and javadoc" /> <echo message=" distWithDesktopgui: pkgWithDesktopgui and javadoc" />
<echo message=" distcleanWithDesktopgui: clean up all derived files (including desktopgui files)" /> <echo message=" distcleanWithDesktopgui: clean up all derived files (including desktopgui files)" />
<echo message=" poupdate: update the .po files for translators" />
</target> </target>
<target name="debianhowto"> <target name="debianhowto">
<echo message="To build debian packages, you must run dpkg-buildpackage as root in the source directory. It will then run ant for you. dpkg-buildpackage is found in the 'dpkg-dev' package. Also it should work fine to use the 'fakeroot' package with dpkg-buildpackage, if you don't want to run as root. Please read 'man dpkg-buildpackage' before building any packages yourself." /> <echo message="To build debian packages, you must run dpkg-buildpackage as root in the source directory. It will then run ant for you. dpkg-buildpackage is found in the 'dpkg-dev' package. Also it should work fine to use the 'fakeroot' package with dpkg-buildpackage, if you don't want to run as root. Please read 'man dpkg-buildpackage' before building any packages yourself." />
@ -58,11 +60,11 @@
<target name="builddepSmall"> <target name="builddepSmall">
<ant dir="core/java/" target="jar" /> <ant dir="core/java/" target="jar" />
<ant dir="router/java/" target="jar" /> <ant dir="router/java/" target="jar" />
<ant dir="apps/systray/java/" target="jar" />
<ant dir="apps/routerconsole/java/" target="jar" />
<ant dir="apps/ministreaming/java/" target="jar" /> <ant dir="apps/ministreaming/java/" target="jar" />
<ant dir="apps/streaming/java/" target="jar" /> <ant dir="apps/streaming/java/" target="jar" />
<ant dir="apps/i2ptunnel/java/" target="jar" /> <ant dir="apps/i2ptunnel/java/" target="jar" />
<ant dir="apps/systray/java/" target="jar" />
<ant dir="apps/routerconsole/java/" target="jar" />
<ant dir="apps/addressbook/" target="war" /> <ant dir="apps/addressbook/" target="war" />
</target> </target>
<target name="buildrouter"> <target name="buildrouter">
@ -137,6 +139,9 @@
<copy file="installer/lib/jbigi/jbigi.jar" todir="build" /> <copy file="installer/lib/jbigi/jbigi.jar" todir="build" />
<copy file="apps/addressbook/dist/addressbook.war" todir="build/" /> <copy file="apps/addressbook/dist/addressbook.war" todir="build/" />
</target> </target>
<target name="poupdate">
<ant dir="apps/routerconsole/java/" target="poupdate" />
</target>
<target name="javadoc"> <target name="javadoc">
<mkdir dir="./build" /> <mkdir dir="./build" />
<mkdir dir="./build/javadoc" /> <mkdir dir="./build/javadoc" />
@ -285,12 +290,15 @@
<copy file="history.txt" todir="pkg-temp/" /> <copy file="history.txt" todir="pkg-temp/" />
<mkdir dir="pkg-temp/scripts" /> <mkdir dir="pkg-temp/scripts" />
<copy file="apps/proxyscript/i2pProxy.pac" todir="pkg-temp/scripts/" /> <copy file="apps/proxyscript/i2pProxy.pac" todir="pkg-temp/scripts/" />
<!-- test classes aren't in the jars anymore
<copy file="core/perl/i2pbench.sh" todir="pkg-temp/scripts/" /> <copy file="core/perl/i2pbench.sh" todir="pkg-temp/scripts/" />
<copy file="core/perl/i2ptest.sh" todir="pkg-temp/scripts/" /> <copy file="core/perl/i2ptest.sh" todir="pkg-temp/scripts/" />
-->
<!-- polecat: please put your modified toolbar.html in installer/resources/toolbar.html <!-- polecat: please put your modified toolbar.html in installer/resources/toolbar.html
and uncomment the following --> and uncomment the following -->
<!-- <copy file="installer/resources/toolbar.html" todir="pkg-temp/docs/" /> --> <!-- <copy file="installer/resources/toolbar.html" todir="pkg-temp/docs/" /> -->
<copy file="initialNews.xml" tofile="pkg-temp/docs/news.xml" /> <!-- overwrite the news put in by the updater -->
<copy file="installer/resources/initialNews.xml" tofile="pkg-temp/docs/news.xml" overwrite="true" />
<copy file="installer/resources/startconsole.html" todir="pkg-temp/docs/" /> <copy file="installer/resources/startconsole.html" todir="pkg-temp/docs/" />
<copy file="installer/resources/start.ico" todir="pkg-temp/docs/" /> <copy file="installer/resources/start.ico" todir="pkg-temp/docs/" />
<copy file="installer/resources/console.ico" todir="pkg-temp/docs/" /> <copy file="installer/resources/console.ico" todir="pkg-temp/docs/" />
@ -331,7 +339,7 @@
--> -->
<!-- Since the logo moved, we have to update the error pages --> <!-- Since the logo moved, we have to update the error pages -->
<copy todir="pkg-temp/docs/" > <copy todir="pkg-temp/docs/" >
<fileset dir="installer/resources/" includes="*-header.ht" /> <fileset dir="installer/resources/proxy" />
</copy> </copy>
<!-- make a "classic" theme --> <!-- make a "classic" theme -->
<copy todir="pkg-temp/docs/themes/console/classic/" > <copy todir="pkg-temp/docs/themes/console/classic/" >
@ -344,13 +352,17 @@
<!-- Add light theme --> <!-- Add light theme -->
<copy todir="pkg-temp/docs/themes/console/light/" > <copy todir="pkg-temp/docs/themes/console/light/" >
<fileset dir="installer/resources/themes/console/light/" /> <fileset dir="installer/resources/themes/console/light/" />
</copy>
<!-- Add midnight theme -->
<copy todir="pkg-temp/docs/themes/console/midnight/" >
<fileset dir="installer/resources/themes/console/midnight/" />
</copy> </copy>
<!-- Add shared images.. these are subject to flux and change! --> <!-- Add shared images.. these are subject to flux and change! -->
<copy todir="pkg-temp/docs/themes/console/images/" > <copy todir="pkg-temp/docs/themes/console/images/" >
<fileset dir="installer/resources/themes/console/images/" /> <fileset dir="installer/resources/themes/console/images/" />
</copy> </copy>
<copy todir="pkg-temp/docs/" > <copy todir="pkg-temp/docs/" >
<fileset dir="." includes="readme*.html" /> <fileset dir="installer/resources/readme/" includes="readme*.html" />
</copy> </copy>
</target> </target>
@ -366,7 +378,7 @@
<target name="prepconsoleDocs" depends="prepgeoupdate"> <target name="prepconsoleDocs" depends="prepgeoupdate">
<copy todir="pkg-temp/docs/" > <copy todir="pkg-temp/docs/" >
<fileset dir="." includes="readme*.html" /> <fileset dir="." includes="readme*.html" />
<fileset dir="installer/resources/" includes="*-header.ht" /> <fileset dir="installer/resources/proxy" />
</copy> </copy>
</target> </target>
<target name="consoleDocs" depends="deletepkg-temp, prepconsoleDocs"> <target name="consoleDocs" depends="deletepkg-temp, prepconsoleDocs">
@ -397,7 +409,8 @@
<copy file="build/susidns.war" todir="pkg-temp/webapps/" /> <copy file="build/susidns.war" todir="pkg-temp/webapps/" />
<copy file="build/i2psnark.war" todir="pkg-temp/webapps/" /> <copy file="build/i2psnark.war" todir="pkg-temp/webapps/" />
<copy file="history.txt" todir="pkg-temp/" /> <copy file="history.txt" todir="pkg-temp/" />
<copy file="news.xml" todir="pkg-temp/docs/" /> <!-- may be pointless now, people with split directories will never see this -->
<copy file="installer/resources/news.xml" todir="pkg-temp/docs/" />
</target> </target>
<target name="prepupdateSmall" depends="buildSmall, prepupdateRouter, prepthemeupdates"> <target name="prepupdateSmall" depends="buildSmall, prepupdateRouter, prepthemeupdates">
<copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" /> <copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
@ -407,6 +420,8 @@
<copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" /> <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
<copy file="build/routerconsole.war" todir="pkg-temp/webapps/" /> <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
<copy file="build/addressbook.war" todir="pkg-temp/webapps/" /> <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
<!-- decapitalized the file in 0.7.8 -->
<copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
</target> </target>
<target name="prepupdateRouter" depends="buildrouter, deletepkg-temp"> <target name="prepupdateRouter" depends="buildrouter, deletepkg-temp">
<copy file="build/i2p.jar" todir="pkg-temp/lib/" /> <copy file="build/i2p.jar" todir="pkg-temp/lib/" />
@ -573,9 +588,9 @@
<exec executable="ls"> <exec executable="ls">
<arg value="-l" /> <arg value="-l" />
<arg value="history.txt" /> <arg value="history.txt" />
<arg value="initialNews.xml" /> <arg value="installer/resources/initialNews.xml" />
<arg value="installer/install.xml" /> <arg value="installer/install.xml" />
<arg value="news.xml" /> <arg value="installer/resources/news.xml" />
<arg value="core/java/src/net/i2p/CoreVersion.java" /> <arg value="core/java/src/net/i2p/CoreVersion.java" />
<arg value="router/java/src/net/i2p/router/RouterVersion.java" /> <arg value="router/java/src/net/i2p/router/RouterVersion.java" />
</exec> </exec>

View File

@ -118,7 +118,7 @@ public class EepGetNamingService extends NamingService {
if (key.startsWith(hostname + "=")) // strip hostname= if (key.startsWith(hostname + "=")) // strip hostname=
key = key.substring(hostname.length() + 1); key = key.substring(hostname.length() + 1);
key = key.substring(0, DEST_SIZE); // catch IndexOutOfBounds exception below key = key.substring(0, DEST_SIZE); // catch IndexOutOfBounds exception below
if (!key.endsWith("AAAA")) { if (!key.endsWith("AA")) {
_log.error("Invalid key: " + url + hostname); _log.error("Invalid key: " + url + hostname);
return null; return null;
} }

View File

@ -112,7 +112,7 @@ public class ExecNamingService extends NamingService {
if (key.startsWith(hostname + "=")) // strip hostname= if (key.startsWith(hostname + "=")) // strip hostname=
key = key.substring(hostname.length() + 1); key = key.substring(hostname.length() + 1);
key = key.substring(0, DEST_SIZE); // catch IndexOutOfBounds exception below key = key.substring(0, DEST_SIZE); // catch IndexOutOfBounds exception below
if (!key.endsWith("AAAA")) { if (!key.endsWith("AA")) {
_log.error("Invalid key: " + command); _log.error("Invalid key: " + command);
return null; return null;
} }

Some files were not shown because too many files have changed in this diff Show More