2004-07-24 02:06:07 +00:00
|
|
|
package net.i2p.router.web;
|
|
|
|
|
2009-02-24 22:59:59 +00:00
|
|
|
import java.text.Collator;
|
2005-02-22 07:07:29 +00:00
|
|
|
import java.text.DateFormat;
|
2004-07-24 02:06:07 +00:00
|
|
|
import java.text.DecimalFormat;
|
2009-02-24 22:59:59 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Comparator;
|
2005-02-22 07:07:29 +00:00
|
|
|
import java.util.Date;
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
import java.util.Iterator;
|
2009-02-24 22:59:59 +00:00
|
|
|
import java.util.List;
|
2005-02-22 07:07:29 +00:00
|
|
|
import java.util.Locale;
|
2004-07-24 02:06:07 +00:00
|
|
|
|
|
|
|
import net.i2p.data.DataHelper;
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
import net.i2p.data.Destination;
|
|
|
|
import net.i2p.data.LeaseSet;
|
2008-06-20 20:22:38 +00:00
|
|
|
import net.i2p.data.RouterAddress;
|
2005-08-10 23:55:40 +00:00
|
|
|
import net.i2p.router.CommSystemFacade;
|
2004-07-24 02:06:07 +00:00
|
|
|
import net.i2p.router.Router;
|
|
|
|
import net.i2p.router.RouterContext;
|
|
|
|
import net.i2p.router.RouterVersion;
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
import net.i2p.router.TunnelPoolSettings;
|
2008-09-06 13:47:56 +00:00
|
|
|
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
2008-06-20 20:22:38 +00:00
|
|
|
import net.i2p.router.transport.ntcp.NTCPAddress;
|
2008-07-16 13:42:54 +00:00
|
|
|
import net.i2p.stat.Rate;
|
|
|
|
import net.i2p.stat.RateStat;
|
2004-07-24 02:06:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Simple helper to query the appropriate router for data necessary to render
|
|
|
|
* the summary sections on the router console.
|
|
|
|
*/
|
2009-01-29 02:16:18 +00:00
|
|
|
public class SummaryHelper extends HelperBase {
|
2004-07-24 02:06:07 +00:00
|
|
|
/**
|
|
|
|
* Retrieve the shortened 4 character ident for the router located within
|
|
|
|
* the current JVM at the given context.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getIdent() {
|
|
|
|
if (_context == null) return "[no router]";
|
|
|
|
|
|
|
|
if (_context.routerHash() != null)
|
|
|
|
return _context.routerHash().toBase64().substring(0, 4);
|
|
|
|
else
|
|
|
|
return "[unknown]";
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Retrieve the version number of the router.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getVersion() {
|
2009-05-01 12:31:38 +00:00
|
|
|
return RouterVersion.FULL_VERSION;
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Retrieve a pretty printed uptime count (ala 4d or 7h or 39m)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getUptime() {
|
|
|
|
if (_context == null) return "[no router]";
|
|
|
|
|
|
|
|
Router router = _context.router();
|
|
|
|
if (router == null)
|
|
|
|
return "[not up]";
|
|
|
|
else
|
|
|
|
return DataHelper.formatDuration(router.getUptime());
|
|
|
|
}
|
2005-02-22 07:07:29 +00:00
|
|
|
|
2009-08-03 20:02:28 +00:00
|
|
|
private String timeSkew() {
|
2005-02-22 07:07:29 +00:00
|
|
|
if (_context == null) return "";
|
2009-08-03 20:02:28 +00:00
|
|
|
//if (!_context.clock().getUpdatedSuccessfully())
|
|
|
|
// return " (Unknown skew)";
|
2005-02-22 07:07:29 +00:00
|
|
|
long ms = _context.clock().getOffset();
|
2009-05-20 22:50:14 +00:00
|
|
|
long diff = Math.abs(ms);
|
2009-08-03 20:02:28 +00:00
|
|
|
if (diff < 3000)
|
|
|
|
return "";
|
|
|
|
return " (" + DataHelper.formatDuration(diff) + " skew)";
|
2005-02-22 07:07:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean allowReseed() {
|
2009-06-15 21:58:28 +00:00
|
|
|
return _context.netDb().isInitialized() &&
|
|
|
|
((_context.netDb().getKnownRouters() < 30) ||
|
|
|
|
Boolean.valueOf(_context.getProperty("i2p.alwaysAllowReseed")).booleanValue());
|
2005-02-22 07:07:29 +00:00
|
|
|
}
|
2005-03-23 21:13:03 +00:00
|
|
|
|
2009-08-02 11:54:14 +00:00
|
|
|
/** subtract one for ourselves, so if we know no other peers it displays zero */
|
|
|
|
public int getAllPeers() { return Math.max(_context.netDb().getKnownRouters() - 1, 0); }
|
2005-08-10 23:55:40 +00:00
|
|
|
|
|
|
|
public String getReachability() {
|
2009-08-03 20:02:28 +00:00
|
|
|
return reachability() + timeSkew();
|
|
|
|
}
|
|
|
|
|
|
|
|
private String reachability() {
|
2009-03-02 16:07:48 +00:00
|
|
|
if (_context.router().getUptime() > 60*1000 && (!_context.router().gracefulShutdownInProgress()) &&
|
|
|
|
!_context.clientManager().isAlive())
|
|
|
|
return "ERR-Client Manager I2CP Error - check logs"; // not a router problem but the user should know
|
2005-12-27 13:20:50 +00:00
|
|
|
if (!_context.clock().getUpdatedSuccessfully())
|
|
|
|
return "ERR-ClockSkew";
|
2008-10-26 17:24:11 +00:00
|
|
|
if (_context.router().isHidden())
|
|
|
|
return "Hidden";
|
|
|
|
|
2005-08-10 23:55:40 +00:00
|
|
|
int status = _context.commSystem().getReachabilityStatus();
|
|
|
|
switch (status) {
|
|
|
|
case CommSystemFacade.STATUS_OK:
|
2008-06-20 20:22:38 +00:00
|
|
|
RouterAddress ra = _context.router().getRouterInfo().getTargetAddress("NTCP");
|
|
|
|
if (ra == null || (new NTCPAddress(ra)).isPubliclyRoutable())
|
|
|
|
return "OK";
|
|
|
|
return "ERR-Private TCP Address";
|
2005-08-10 23:55:40 +00:00
|
|
|
case CommSystemFacade.STATUS_DIFFERENT:
|
|
|
|
return "ERR-SymmetricNAT";
|
|
|
|
case CommSystemFacade.STATUS_REJECT_UNSOLICITED:
|
2008-05-07 16:23:54 +00:00
|
|
|
if (_context.router().getRouterInfo().getTargetAddress("NTCP") != null)
|
|
|
|
return "WARN-Firewalled with Inbound TCP Enabled";
|
2008-09-06 13:47:56 +00:00
|
|
|
if (((FloodfillNetworkDatabaseFacade)_context.netDb()).floodfillEnabled())
|
|
|
|
return "WARN-Firewalled and Floodfill";
|
|
|
|
if (_context.router().getRouterInfo().getCapabilities().indexOf('O') >= 0)
|
2008-06-01 20:43:51 +00:00
|
|
|
return "WARN-Firewalled and Fast";
|
2008-09-06 13:47:56 +00:00
|
|
|
return "Firewalled";
|
2008-06-17 13:47:54 +00:00
|
|
|
case CommSystemFacade.STATUS_HOSED:
|
|
|
|
return "ERR-UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart";
|
2005-08-10 23:55:40 +00:00
|
|
|
case CommSystemFacade.STATUS_UNKNOWN: // fallthrough
|
|
|
|
default:
|
2009-05-01 12:31:38 +00:00
|
|
|
ra = _context.router().getRouterInfo().getTargetAddress("SSU");
|
2008-12-20 01:04:19 +00:00
|
|
|
if (ra == null && _context.router().getUptime() > 5*60*1000) {
|
2008-12-03 18:53:57 +00:00
|
|
|
if (_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME) == null ||
|
|
|
|
_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT) == null)
|
|
|
|
return "ERR-UDP Disabled and Inbound TCP host/port not set";
|
|
|
|
else
|
|
|
|
return "WARN-Firewalled with UDP Disabled";
|
|
|
|
}
|
2008-05-05 14:07:40 +00:00
|
|
|
return "Testing";
|
2005-08-10 23:55:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-11 22:23:48 +00:00
|
|
|
/**
|
|
|
|
* Retrieve amount of used memory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getMemory() {
|
2004-08-16 20:27:06 +00:00
|
|
|
DecimalFormat integerFormatter = new DecimalFormat("###,###,##0");
|
2004-08-11 22:23:48 +00:00
|
|
|
long used = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/1024;
|
|
|
|
long usedPc = 100 - ((Runtime.getRuntime().freeMemory() * 100) / Runtime.getRuntime().totalMemory());
|
2004-08-16 20:27:06 +00:00
|
|
|
return integerFormatter.format(used) + "KB (" + usedPc + "%)";
|
2004-08-11 22:23:48 +00:00
|
|
|
}
|
2004-07-24 02:06:07 +00:00
|
|
|
|
|
|
|
/**
|
2004-09-09 02:26:42 +00:00
|
|
|
* How many peers we are talking to now
|
2004-07-24 02:06:07 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getActivePeers() {
|
2004-09-09 02:26:42 +00:00
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.commSystem().countActivePeers();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* How many active identities have we spoken with recently
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getActiveProfiles() {
|
2004-07-24 02:06:07 +00:00
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.profileOrganizer().countActivePeers();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* How many active peers the router ranks as fast.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getFastPeers() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.profileOrganizer().countFastPeers();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* How many active peers the router ranks as having a high capacity.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getHighCapacityPeers() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.profileOrganizer().countHighCapacityPeers();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* How many active peers the router ranks as well integrated.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getWellIntegratedPeers() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.profileOrganizer().countWellIntegratedPeers();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* How many peers the router ranks as failing.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getFailingPeers() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.profileOrganizer().countFailingPeers();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* How many peers totally suck.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getShitlistedPeers() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.shitlist().getRouterCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-05-03 04:30:26 +00:00
|
|
|
* How fast we have been receiving data over the last second (pretty printed
|
2004-07-24 02:06:07 +00:00
|
|
|
* string with 2 decimal places representing the KBps)
|
|
|
|
*
|
|
|
|
*/
|
2006-05-03 04:30:26 +00:00
|
|
|
public String getInboundSecondKBps() {
|
2004-07-24 02:06:07 +00:00
|
|
|
if (_context == null)
|
2009-01-22 04:02:41 +00:00
|
|
|
return "0";
|
2005-10-07 20:19:04 +00:00
|
|
|
double kbps = _context.bandwidthLimiter().getReceiveBps()/1024d;
|
2005-09-11 03:22:51 +00:00
|
|
|
DecimalFormat fmt = new DecimalFormat("##0.00");
|
|
|
|
return fmt.format(kbps);
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
/**
|
2006-05-03 04:30:26 +00:00
|
|
|
* How fast we have been sending data over the last second (pretty printed
|
2004-07-24 02:06:07 +00:00
|
|
|
* string with 2 decimal places representing the KBps)
|
|
|
|
*
|
|
|
|
*/
|
2006-05-03 04:30:26 +00:00
|
|
|
public String getOutboundSecondKBps() {
|
2004-07-24 02:06:07 +00:00
|
|
|
if (_context == null)
|
2009-01-22 04:02:41 +00:00
|
|
|
return "0";
|
2005-10-07 20:19:04 +00:00
|
|
|
double kbps = _context.bandwidthLimiter().getSendBps()/1024d;
|
2005-09-11 03:22:51 +00:00
|
|
|
DecimalFormat fmt = new DecimalFormat("##0.00");
|
|
|
|
return fmt.format(kbps);
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How fast we have been receiving data over the last 5 minutes (pretty printed
|
|
|
|
* string with 2 decimal places representing the KBps)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getInboundFiveMinuteKBps() {
|
|
|
|
if (_context == null)
|
2009-01-22 04:02:41 +00:00
|
|
|
return "0";
|
2004-07-24 02:06:07 +00:00
|
|
|
|
2005-09-12 02:58:13 +00:00
|
|
|
RateStat receiveRate = _context.statManager().getRate("bw.recvRate");
|
2009-01-22 04:02:41 +00:00
|
|
|
if (receiveRate == null) return "0";
|
2004-07-24 02:06:07 +00:00
|
|
|
Rate rate = receiveRate.getRate(5*60*1000);
|
2005-09-11 03:22:51 +00:00
|
|
|
double kbps = rate.getAverageValue()/1024;
|
|
|
|
DecimalFormat fmt = new DecimalFormat("##0.00");
|
|
|
|
return fmt.format(kbps);
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How fast we have been sending data over the last 5 minutes (pretty printed
|
|
|
|
* string with 2 decimal places representing the KBps)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getOutboundFiveMinuteKBps() {
|
|
|
|
if (_context == null)
|
2009-01-22 04:02:41 +00:00
|
|
|
return "0";
|
2004-07-24 02:06:07 +00:00
|
|
|
|
2005-09-12 02:58:13 +00:00
|
|
|
RateStat receiveRate = _context.statManager().getRate("bw.sendRate");
|
2009-01-22 04:02:41 +00:00
|
|
|
if (receiveRate == null) return "0";
|
2004-07-24 02:06:07 +00:00
|
|
|
Rate rate = receiveRate.getRate(5*60*1000);
|
2005-09-11 03:22:51 +00:00
|
|
|
double kbps = rate.getAverageValue()/1024;
|
|
|
|
DecimalFormat fmt = new DecimalFormat("##0.00");
|
|
|
|
return fmt.format(kbps);
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How fast we have been receiving data since the router started (pretty printed
|
|
|
|
* string with 2 decimal places representing the KBps)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getInboundLifetimeKBps() {
|
|
|
|
if (_context == null)
|
2009-01-22 04:02:41 +00:00
|
|
|
return "0";
|
2004-07-24 02:06:07 +00:00
|
|
|
|
2005-09-12 02:58:13 +00:00
|
|
|
RateStat receiveRate = _context.statManager().getRate("bw.recvRate");
|
2009-01-22 04:02:41 +00:00
|
|
|
if (receiveRate == null) return "0";
|
2005-09-11 03:22:51 +00:00
|
|
|
double kbps = receiveRate.getLifetimeAverageValue()/1024;
|
2004-07-24 02:06:07 +00:00
|
|
|
DecimalFormat fmt = new DecimalFormat("##0.00");
|
2005-09-11 03:22:51 +00:00
|
|
|
return fmt.format(kbps);
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How fast we have been sending data since the router started (pretty printed
|
|
|
|
* string with 2 decimal places representing the KBps)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getOutboundLifetimeKBps() {
|
|
|
|
if (_context == null)
|
2009-01-22 04:02:41 +00:00
|
|
|
return "0";
|
2004-07-24 02:06:07 +00:00
|
|
|
|
2005-09-12 02:58:13 +00:00
|
|
|
RateStat sendRate = _context.statManager().getRate("bw.sendRate");
|
2009-01-22 04:02:41 +00:00
|
|
|
if (sendRate == null) return "0";
|
2005-09-11 03:22:51 +00:00
|
|
|
double kbps = sendRate.getLifetimeAverageValue()/1024;
|
2004-07-24 02:06:07 +00:00
|
|
|
DecimalFormat fmt = new DecimalFormat("##0.00");
|
2005-09-11 03:22:51 +00:00
|
|
|
return fmt.format(kbps);
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How much data have we received since the router started (pretty printed
|
|
|
|
* string with 2 decimal places and the appropriate units - GB/MB/KB/bytes)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getInboundTransferred() {
|
|
|
|
if (_context == null)
|
2009-01-22 04:02:41 +00:00
|
|
|
return "0";
|
2004-07-24 02:06:07 +00:00
|
|
|
|
|
|
|
long received = _context.bandwidthLimiter().getTotalAllocatedInboundBytes();
|
|
|
|
|
2009-01-22 04:02:41 +00:00
|
|
|
return DataHelper.formatSize(received) + 'B';
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How much data have we sent since the router started (pretty printed
|
|
|
|
* string with 2 decimal places and the appropriate units - GB/MB/KB/bytes)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getOutboundTransferred() {
|
|
|
|
if (_context == null)
|
2009-01-22 04:02:41 +00:00
|
|
|
return "0";
|
2004-07-24 02:06:07 +00:00
|
|
|
|
|
|
|
long sent = _context.bandwidthLimiter().getTotalAllocatedOutboundBytes();
|
2009-01-22 04:02:41 +00:00
|
|
|
return DataHelper.formatSize(sent) + 'B';
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
|
2004-07-30 20:28:19 +00:00
|
|
|
/**
|
|
|
|
* How many client destinations are connected locally.
|
|
|
|
*
|
|
|
|
* @return html section summary
|
|
|
|
*/
|
|
|
|
public String getDestinations() {
|
2009-02-24 22:59:59 +00:00
|
|
|
// covert the set to a list so we can sort by name and not lose duplicates
|
|
|
|
List clients = new ArrayList(_context.clientManager().listClients());
|
|
|
|
Collections.sort(clients, new AlphaComparator());
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
|
2009-07-01 16:00:43 +00:00
|
|
|
StringBuilder buf = new StringBuilder(512);
|
2009-08-08 15:34:58 +00:00
|
|
|
buf.append("<h3>Local destinations</h3><hr><table>");
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
|
|
|
|
for (Iterator iter = clients.iterator(); iter.hasNext(); ) {
|
|
|
|
Destination client = (Destination)iter.next();
|
2009-02-24 22:59:59 +00:00
|
|
|
String name = getName(client);
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
|
2009-08-08 15:34:58 +00:00
|
|
|
buf.append("<tr><td align=\"right\"><b>*</b></td>");
|
|
|
|
buf.append("<td align=\"left\"><a href=\"tunnels.jsp#").append(client.calculateHash().toBase64().substring(0,4));
|
2009-04-26 21:52:00 +00:00
|
|
|
buf.append("\" target=\"_top\" title=\"Show tunnels\">");
|
2009-08-03 15:29:35 +00:00
|
|
|
if (name.length() < 16)
|
|
|
|
buf.append(name);
|
|
|
|
else
|
|
|
|
buf.append(name.substring(0,15)).append("…");
|
2009-08-08 15:34:58 +00:00
|
|
|
buf.append("</a></td></tr>\n");
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
LeaseSet ls = _context.netDb().lookupLeaseSetLocally(client.calculateHash());
|
|
|
|
if (ls != null) {
|
|
|
|
long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now();
|
|
|
|
if (timeToExpire < 0) {
|
2009-08-08 15:34:58 +00:00
|
|
|
buf.append("<tr><td colspan=\"2\"><i>expired ").append(DataHelper.formatDuration(0-timeToExpire));
|
|
|
|
buf.append(" ago</i></td></tr>\n");
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
}
|
|
|
|
} else {
|
2009-08-08 15:34:58 +00:00
|
|
|
buf.append("<tr><td> </td><td align=\"left\"><i>No leases</i></td></tr>\n");
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
}
|
2004-07-30 20:28:19 +00:00
|
|
|
}
|
2009-08-08 15:34:58 +00:00
|
|
|
// buf.append("</table><hr />\n");
|
2005-02-16 jrandom
* (Merged the 0.5-pre branch back into CVS HEAD)
* Replaced the old tunnel routing crypto with the one specified in
router/doc/tunnel-alt.html, including updates to the web console to view
and tweak it.
* Provide the means for routers to reject tunnel requests with a wider
range of responses:
probabalistic rejection, due to approaching overload
transient rejection, due to temporary overload
bandwidth rejection, due to persistent bandwidth overload
critical rejection, due to general router fault (or imminent shutdown)
The different responses are factored into the profiles accordingly.
* Replaced the old I2CP tunnel related options (tunnels.depthInbound, etc)
with a series of new properties, relevent to the new tunnel routing code:
inbound.nickname (used on the console)
inbound.quantity (# of tunnels to use in any leaseSets)
inbound.backupQuantity (# of tunnels to keep in the ready)
inbound.length (# of remote peers in the tunnel)
inbound.lengthVariance (if > 0, permute the length by adding a random #
up to the variance. if < 0, permute the length
by adding or subtracting a random # up to the
variance)
outbound.* (same as the inbound, except for the, uh, outbound tunnels
in that client's pool)
There are other options, and more will be added later, but the above are
the most relevent ones.
* Replaced Jetty 4.2.21 with Jetty 5.1.2
* Compress all profile data on disk.
* Adjust the reseeding functionality to work even when the JVM's http proxy
is set.
* Enable a poor-man's interactive-flow in the streaming lib by choking the
max window size.
* Reduced the default streaming lib max message size to 16KB (though still
configurable by the user), also doubling the default maximum window
size.
* Replaced the RouterIdentity in a Lease with its SHA256 hash.
* Reduced the overall I2NP message checksum from a full 32 byte SHA256 to
the first byte of the SHA256.
* Added a new "netId" flag to let routers drop references to other routers
who we won't be able to talk to.
* Extended the timestamper to get a second (or third) opinion whenever it
wants to actually adjust the clock offset.
* Replaced that kludge of a timestamp I2NP message with a full blown
DateMessage.
* Substantial memory optimizations within the router and the SDK to reduce
GC churn. Client apps and the streaming libs have not been tuned,
however.
* More bugfixes thank you can shake a stick at.
2005-02-13 jrandom
* Updated jbigi source to handle 64bit CPUs. The bundled jbigi.jar still
only contains 32bit versions, so build your own, placing libjbigi.so in
your install dir if necessary. (thanks mule!)
* Added support for libjbigi-$os-athlon64 to NativeBigInteger and CPUID
(thanks spaetz!)
2005-02-16 22:23:47 +00:00
|
|
|
return buf.toString();
|
2004-07-30 20:28:19 +00:00
|
|
|
}
|
|
|
|
|
2009-02-24 22:59:59 +00:00
|
|
|
private class AlphaComparator implements Comparator {
|
|
|
|
public int compare(Object lhs, Object rhs) {
|
|
|
|
String lname = getName((Destination)lhs);
|
|
|
|
String rname = getName((Destination)rhs);
|
|
|
|
if (lname.equals("shared clients"))
|
|
|
|
return -1;
|
|
|
|
if (rname.equals("shared clients"))
|
|
|
|
return 1;
|
|
|
|
return Collator.getInstance().compare(lname, rname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private String getName(Destination d) {
|
|
|
|
TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(d.calculateHash());
|
|
|
|
String name = (in != null ? in.getDestinationNickname() : null);
|
|
|
|
if (name == null) {
|
|
|
|
TunnelPoolSettings out = _context.tunnelManager().getOutboundSettings(d.calculateHash());
|
|
|
|
name = (out != null ? out.getDestinationNickname() : null);
|
|
|
|
if (name == null)
|
|
|
|
name = d.calculateHash().toBase64().substring(0,6);
|
|
|
|
}
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2004-07-24 02:06:07 +00:00
|
|
|
/**
|
|
|
|
* How many free inbound tunnels we have.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getInboundTunnels() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.tunnelManager().getFreeTunnelCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How many active outbound tunnels we have.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getOutboundTunnels() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.tunnelManager().getOutboundTunnelCount();
|
|
|
|
}
|
|
|
|
|
2005-12-09 08:05:44 +00:00
|
|
|
/**
|
|
|
|
* How many inbound client tunnels we have.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getInboundClientTunnels() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.tunnelManager().getInboundClientTunnelCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How many active outbound client tunnels we have.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getOutboundClientTunnels() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.tunnelManager().getOutboundClientTunnelCount();
|
|
|
|
}
|
|
|
|
|
2004-07-24 02:06:07 +00:00
|
|
|
/**
|
|
|
|
* How many tunnels we are participating in.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public int getParticipatingTunnels() {
|
|
|
|
if (_context == null)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return _context.tunnelManager().getParticipatingCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How lagged our job queue is over the last minute (pretty printed with
|
|
|
|
* the units attached)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getJobLag() {
|
|
|
|
if (_context == null)
|
|
|
|
return "0ms";
|
|
|
|
|
|
|
|
Rate lagRate = _context.statManager().getRate("jobQueue.jobLag").getRate(60*1000);
|
|
|
|
return ((int)lagRate.getAverageValue()) + "ms";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How long it takes us to pump out a message, averaged over the last minute
|
|
|
|
* (pretty printed with the units attached)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getMessageDelay() {
|
|
|
|
if (_context == null)
|
|
|
|
return "0ms";
|
|
|
|
|
2004-09-29 22:49:19 +00:00
|
|
|
return _context.throttle().getMessageDelay() + "ms";
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How long it takes us to test our tunnels, averaged over the last 10 minutes
|
|
|
|
* (pretty printed with the units attached)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public String getTunnelLag() {
|
|
|
|
if (_context == null)
|
|
|
|
return "0ms";
|
|
|
|
|
2004-09-29 22:49:19 +00:00
|
|
|
return _context.throttle().getTunnelLag() + "ms";
|
2004-07-24 02:06:07 +00:00
|
|
|
}
|
2005-03-23 21:13:03 +00:00
|
|
|
|
2008-05-05 14:07:40 +00:00
|
|
|
public String getTunnelStatus() {
|
|
|
|
if (_context == null)
|
|
|
|
return "";
|
|
|
|
return _context.throttle().getTunnelStatus();
|
|
|
|
}
|
|
|
|
|
2006-04-08 06:15:43 +00:00
|
|
|
public String getInboundBacklog() {
|
|
|
|
if (_context == null)
|
|
|
|
return "0";
|
|
|
|
|
|
|
|
return String.valueOf(_context.tunnelManager().getInboundBuildQueueSize());
|
|
|
|
}
|
|
|
|
|
2008-06-20 20:22:38 +00:00
|
|
|
public String getPRNGStatus() {
|
|
|
|
Rate r = _context.statManager().getRate("prng.bufferWaitTime").getRate(60*1000);
|
|
|
|
int use = (int) r.getLastEventCount();
|
|
|
|
int i = (int) (r.getAverageValue() + 0.5);
|
|
|
|
if (i <= 0) {
|
|
|
|
r = _context.statManager().getRate("prng.bufferWaitTime").getRate(10*60*1000);
|
|
|
|
i = (int) (r.getAverageValue() + 0.5);
|
|
|
|
}
|
|
|
|
String rv = i + "/";
|
|
|
|
r = _context.statManager().getRate("prng.bufferFillTime").getRate(60*1000);
|
|
|
|
i = (int) (r.getAverageValue() + 0.5);
|
|
|
|
if (i <= 0) {
|
|
|
|
r = _context.statManager().getRate("prng.bufferFillTime").getRate(10*60*1000);
|
|
|
|
i = (int) (r.getAverageValue() + 0.5);
|
|
|
|
}
|
|
|
|
rv = rv + i + "ms";
|
|
|
|
// margin == fill time / use time
|
|
|
|
if (use > 0 && i > 0)
|
|
|
|
rv = rv + ' ' + (60*1000 / (use * i)) + 'x';
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2005-03-24 01:19:52 +00:00
|
|
|
public boolean updateAvailable() {
|
2005-04-05 16:06:14 +00:00
|
|
|
return NewsFetcher.getInstance(_context).updateAvailable();
|
2005-03-24 01:19:52 +00:00
|
|
|
}
|
2009-02-24 22:59:59 +00:00
|
|
|
|
2005-12-09 08:05:44 +00:00
|
|
|
}
|