Changeset 825af3e


Ignore:
Timestamp:
Sep 12, 2008 1:37:22 PM (12 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
e734a558
Parents:
cf54dd1
Message:
  • HarvesterJob?: Don't instantiate if disabled
  • NetDb?: Add netDb.exploreKeySet stat
  • netdb.jsp: Add parameter ?r=xxxxxx to view a single routerinfo, and ?r=. to view our own; change links on other pages too
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/NetDbHelper.java

    rcf54dd1 r825af3e  
    1111    private RouterContext _context;
    1212    private Writer _out;
     13    private String _routerPrefix;
     14
    1315    /**
    1416     * Configure this bean to query a particular router context
     
    2830   
    2931    public void setWriter(Writer writer) { _out = writer; }
     32    public void setRouter(String r) { _routerPrefix = r; }
    3033   
    3134    public String getNetDbSummary() {
    3235        try {
    3336            if (_out != null) {
    34                 _context.netDb().renderStatusHTML(_out);
     37                if (_routerPrefix != null)
     38                    _context.netDb().renderRouterInfoHTML(_out, _routerPrefix);
     39                else
     40                    _context.netDb().renderStatusHTML(_out);
    3541                return "";
    3642            } else {
    3743                ByteArrayOutputStream baos = new ByteArrayOutputStream(32*1024);
    38                 _context.netDb().renderStatusHTML(new OutputStreamWriter(baos));
     44                if (_routerPrefix != null)
     45                    _context.netDb().renderRouterInfoHTML(new OutputStreamWriter(baos), _routerPrefix);
     46                else
     47                    _context.netDb().renderStatusHTML(new OutputStreamWriter(baos));
    3948                return new String(baos.toByteArray());
    4049            }
  • apps/routerconsole/jsp/netdb.jsp

    rcf54dd1 r825af3e  
    1515 <jsp:setProperty name="netdbHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
    1616 <jsp:setProperty name="netdbHelper" property="writer" value="<%=out%>" />
     17 <jsp:setProperty name="netdbHelper" property="router" value="<%=request.getParameter("r")%>" />
    1718 <jsp:getProperty name="netdbHelper" property="netDbSummary" />
    1819</div>
  • apps/routerconsole/jsp/summary.jsp

    rcf54dd1 r825af3e  
    1111<div class="routersummary">
    1212 <u><b>General</b></u><br />
    13  <b>Ident:</b> (<a title="Your router identity is <jsp:getProperty name="helper" property="ident" />, never reveal it to anyone" href="netdb.jsp#our-info">view</a>)<br />
     13 <b>Ident:</b> (<a title="Your router identity is <jsp:getProperty name="helper" property="ident" />, never reveal it to anyone" href="netdb.jsp?r=.">view</a>)<br />
    1414 <b>Version:</b> <jsp:getProperty name="helper" property="version" /><br />
    1515 <b>Uptime:</b> <jsp:getProperty name="helper" property="uptime" /><br />
  • history.txt

    rcf54dd1 r825af3e  
     12008-09-11 zzz
     2    * Blocklist: Fix a log message format
     3    * HarvesterJob: Don't instantiate if disabled
     4    * i2psnark:
     5      - Add config i2psnark.linkPrefix to enable access to completed
     6        torrents from a different machine - examples:
     7           i2psnark.linkPrefix=file://///localserver/path/to/files/
     8           i2psnark.linkPrefix=http://localwebserver/path/
     9        (Stop i2psnark, add to i2psnark.config, restart)
     10      - Remove Galen and NickyB trackers
     11    * NetDb: Add netDb.exploreKeySet stat
     12    * netdb.jsp: Add parameter ?r=xxxxxx to view a single routerinfo,
     13      and ?r=. to view our own; change links on other pages too
     14    * Transport: Make 0.0.0.0/8 and 169.254.0.0/16 private
     15
    1162008-09-06 zzz
    217    * EepGet command line: Fix byte counts after a failed resume
  • router/java/src/net/i2p/router/NetworkDatabaseFacade.java

    rcf54dd1 r825af3e  
    6262    public int getKnownRouters() { return 0; }
    6363    public int getKnownLeaseSets() { return 0; }
     64    public void renderRouterInfoHTML(Writer out, String s) throws IOException {}
    6465}
    6566
  • router/java/src/net/i2p/router/RouterVersion.java

    rcf54dd1 r825af3e  
    1818    public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
    1919    public final static String VERSION = "0.6.3";
    20     public final static long BUILD = 3;
     20    public final static long BUILD = 4;
    2121    public static void main(String args[]) {
    2222        System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
  • router/java/src/net/i2p/router/Shitlist.java

    rcf54dd1 r825af3e  
    281281            Entry entry = (Entry)entries.get(key);
    282282            buf.append("<li><b>").append(key.toBase64()).append("</b>");
    283             buf.append(" (<a href=\"netdb.jsp#").append(key.toBase64().substring(0, 6)).append("\">netdb</a>)");
     283            buf.append(" (<a href=\"netdb.jsp?r=").append(key.toBase64().substring(0, 6)).append("\">netdb</a>)");
    284284            buf.append(" expiring in ");
    285285            buf.append(DataHelper.formatDuration(entry.expireOn-_context.clock().now()));
  • router/java/src/net/i2p/router/networkdb/kademlia/HarvesterJob.java

    rcf54dd1 r825af3e  
    4242    private static final int PRIORITY = 100;
    4343   
    44     private static final String PROP_ENABLED = "netDb.shouldHarvest";
     44    public static final String PROP_ENABLED = "netDb.shouldHarvest";
    4545
    4646    private boolean harvestDirectly() {
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    rcf54dd1 r825af3e  
    131131        _enforceNetId = DEFAULT_ENFORCE_NETID;
    132132        context.statManager().createRateStat("netDb.lookupLeaseSetDeferred", "how many lookups are deferred for a single leaseSet lookup?", "NetworkDatabase", new long[] { 60*1000, 5*60*1000 });
     133        context.statManager().createRateStat("netDb.exploreKeySet", "how many keys are queued for exploration?", "NetworkDatabase", new long[] { 10*60*1000 });
    133134    }
    134135   
     
    204205        synchronized (_exploreKeys) {
    205206            _exploreKeys.removeAll(toRemove);
     207            _context.statManager().addRateData("netDb.exploreKeySet", _exploreKeys.size(), 0);
    206208        }
    207209    }
     
    210212        synchronized (_exploreKeys) {
    211213            _exploreKeys.addAll(keys);
     214            _context.statManager().addRateData("netDb.exploreKeySet", _exploreKeys.size(), 0);
    212215        }
    213216    }
     
    298301            _context.jobQueue().addJob(_exploreJob);
    299302            // if configured to do so, periodically try to get newer routerInfo stats
    300             if (_harvestJob == null)
     303            if (_harvestJob == null && "true".equals(_context.getProperty(HarvesterJob.PROP_ENABLED)))
    301304                _harvestJob = new HarvesterJob(_context, this);
    302305            _context.jobQueue().addJob(_harvestJob);
     
    944947    }
    945948
     949    public void renderRouterInfoHTML(Writer out, String routerPrefix) throws IOException {
     950        StringBuffer buf = new StringBuffer(4*1024);
     951        buf.append("<h2>Network Database RouterInfo Lookup</h2>\n");
     952        if (".".equals(routerPrefix)) {
     953            renderRouterInfo(buf, _context.router().getRouterInfo(), true);
     954        } else {
     955            boolean notFound = true;
     956            Set routers = getRouters();
     957            for (Iterator iter = routers.iterator(); iter.hasNext(); ) {
     958                RouterInfo ri = (RouterInfo)iter.next();
     959                Hash key = ri.getIdentity().getHash();
     960                if (key.toBase64().startsWith(routerPrefix)) {
     961                    renderRouterInfo(buf, ri, false);
     962                    notFound = false;
     963                }
     964            }
     965            if (notFound)
     966                buf.append("Router ").append(routerPrefix).append(" not found in network database");
     967        }
     968        out.write(buf.toString());
     969        out.flush();
     970    }
     971
    946972    public void renderStatusHTML(Writer out) throws IOException {
    947         StringBuffer buf = new StringBuffer(10*1024);
    948         buf.append("<h2>Kademlia Network DB Contents</h2>\n");
     973        StringBuffer buf = new StringBuffer(getKnownRouters() * 2048);
     974        buf.append("<h2>Network Database Contents</h2>\n");
    949975        if (!_initialized) {
    950976            buf.append("<i>Not initialized</i>\n");
  • router/java/src/net/i2p/router/peermanager/ProfileOrganizerRenderer.java

    rcf54dd1 r825af3e  
    164164            //buf.append("<td><a href=\"/profile/").append(prof.getPeer().toBase64().substring(0, 32)).append("\">profile.txt</a> ");
    165165            //buf.append("    <a href=\"#").append(prof.getPeer().toBase64().substring(0, 32)).append("\">netDb</a></td>");
    166             buf.append("<td nowrap><a href=\"netdb.jsp#").append(peer.toBase64().substring(0,6)).append("\">netDb</a>");
     166            buf.append("<td nowrap><a href=\"netdb.jsp?r=").append(peer.toBase64().substring(0,6)).append("\">netDb</a>");
    167167            buf.append("/<a href=\"dumpprofile.jsp?peer=").append(peer.toBase64().substring(0,6)).append("\">profile</a>");
    168168            buf.append("/<a href=\"configpeer.jsp?peer=").append(peer.toBase64()).append("\">+-</a></td>\n");
  • router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java

    rcf54dd1 r825af3e  
    601601            NTCPConnection con = (NTCPConnection)iter.next();
    602602            String name = con.getRemotePeer().calculateHash().toBase64().substring(0,6);
    603             buf.append("<tr><td><code><a href=\"netdb.jsp#").append(name).append("\">").append(name);
     603            buf.append("<tr><td><code><a href=\"netdb.jsp?r=").append(name).append("\">").append(name);
    604604            buf.append("</code></td><td align=\"center\"><code>");
    605605            if (con.isInbound())
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    rcf54dd1 r825af3e  
    16881688            String name = peer.getRemotePeer().toBase64().substring(0,6);
    16891689            buf.append("<td valign=\"top\" nowrap=\"nowrap\"><code>");
    1690             buf.append("<a href=\"netdb.jsp#");
     1690            buf.append("<a href=\"netdb.jsp?r=");
    16911691            buf.append(name);
    16921692            buf.append("\">");
Note: See TracChangeset for help on using the changeset viewer.