Changes in / [18e7e56:49118b8]


Ignore:
Files:
9 added
72 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/CompleteListener.java

    r18e7e56 r49118b8  
    5555    public void gotPiece(Snark snark);
    5656
    57     // not really listeners but the easiest way to get back to an optional SnarkManager
     57    /** not really listeners but the easiest way to get back to an optional SnarkManager */
    5858    public long getSavedTorrentTime(Snark snark);
    5959    public BitField getSavedTorrentBitField(Snark snark);
     60    /**
     61     * @since 0.9.15
     62     */
    6063    public boolean getSavedPreserveNamesSetting(Snark snark);
     64    /**
     65     * @since 0.9.15
     66     */
     67    public long getSavedUploaded(Snark snark);
    6168}
  • apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java

    r18e7e56 r49118b8  
    280280  {
    281281    return uploaded;
     282  }
     283
     284  /**
     285   *  Sets the initial total of uploaded bytes of all peers (from a saved status)
     286   *  @since 0.9.15
     287   */
     288  public void setUploaded(long up) {
     289      uploaded = up;
    282290  }
    283291
  • apps/i2psnark/java/src/org/klomp/snark/Snark.java

    r18e7e56 r49118b8  
    238238  // String indicating main activity
    239239  private volatile String activity = "Not started";
     240  private final long savedUploaded;
    240241
    241242
     
    464465*/
    465466   
     467    savedUploaded = (completeListener != null) ? completeListener.getSavedUploaded(this) : 0;
    466468    if (start)
    467469        startTorrent();
     
    489491    this.additionalTrackerURL = trackerURL;
    490492    this.rootDataDir = rootDir != null ? new File(rootDir) : null;   // null only for FetchAndAdd extension
     493    savedUploaded = 0;
    491494    stopped = true;
    492495    id = generateID();
     
    557560        activity = "Collecting pieces";
    558561        coordinator = new PeerCoordinator(_util, id, infoHash, meta, storage, this, this);
     562        coordinator.setUploaded(savedUploaded);
    559563        if (_peerCoordinatorSet != null) {
    560564            // multitorrent
     
    620624    Storage st = storage;
    621625    if (st != null) {
    622         boolean changed = storage.isChanged();
     626        boolean changed = storage.isChanged() || getUploaded() != savedUploaded;
    623627        try {
    624628            storage.close();
     
    774778        if (coord != null)
    775779            return coord.getUploaded();
    776         return 0;
     780        return savedUploaded;
    777781    }
    778782
  • apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java

    r18e7e56 r49118b8  
    9393    private static final String PROP_META_PRIORITY = "priority";
    9494    private static final String PROP_META_PRESERVE_NAMES = "preserveFileNames";
     95    private static final String PROP_META_UPLOADED = "uploaded";
    9596    //private static final String PROP_META_BITFIELD_SUFFIX = ".bitfield";
    9697    //private static final String PROP_META_PRIORITY_SUFFIX = ".priority";
     
    129130     *  "name", "announceURL=websiteURL" pairs
    130131     *  '=' in announceURL must be escaped as ,
     132     *
     133     *  Please use host name, not b32 or full dest, in announce URL. Ensure in default hosts.txt.
     134     *  Please use host name, not b32 or full dest, in website URL. Ensure in default hosts.txt.
    131135     */
    132136    private static final String DEFAULT_TRACKERS[] = {
     
    13581362            }
    13591363            // so addTorrent won't recheck
    1360             saveTorrentStatus(metainfo, bitfield, null, baseFile, true); // no file priorities
     1364            saveTorrentStatus(metainfo, bitfield, null, baseFile, true, 0); // no file priorities
    13611365            try {
    13621366                locked_writeMetaInfo(metainfo, filename, areFilesPublic());
     
    15231527        return Boolean.parseBoolean(config.getProperty(PROP_META_PRESERVE_NAMES));
    15241528    }
     1529
     1530    /**
     1531     * Get setting for a torrent from the config file.
     1532     * @return setting, 0 if not found
     1533     * @since 0.9.15
     1534     */
     1535    public long getSavedUploaded(Snark snark) {
     1536        Properties config = getConfig(snark);
     1537        if (config != null) {
     1538            try {
     1539                return Long.parseLong(config.getProperty(PROP_META_UPLOADED));
     1540            } catch (NumberFormatException nfe) {}
     1541        }
     1542        return 0;
     1543    }
    15251544   
    15261545    /**
     
    15361555            return;
    15371556        saveTorrentStatus(meta, storage.getBitField(), storage.getFilePriorities(),
    1538                           storage.getBase(), storage.getPreserveFileNames());
     1557                          storage.getBase(), storage.getPreserveFileNames(),
     1558                          snark.getUploaded());
    15391559    }
    15401560
     
    15511571     */
    15521572    private void saveTorrentStatus(MetaInfo metainfo, BitField bitfield, int[] priorities,
    1553                                    File base, boolean preserveNames) {
     1573                                   File base, boolean preserveNames, long uploaded) {
    15541574        synchronized (_configLock) {
    1555             locked_saveTorrentStatus(metainfo, bitfield, priorities, base, preserveNames);
     1575            locked_saveTorrentStatus(metainfo, bitfield, priorities, base, preserveNames, uploaded);
    15561576        }
    15571577    }
    15581578
    15591579    private void locked_saveTorrentStatus(MetaInfo metainfo, BitField bitfield, int[] priorities,
    1560                                           File base, boolean preserveNames) {
     1580                                          File base, boolean preserveNames, long uploaded) {
    15611581        byte[] ih = metainfo.getInfoHash();
    15621582        String bfs;
     
    15711591        config.setProperty(PROP_META_BITFIELD, bfs);
    15721592        config.setProperty(PROP_META_PRESERVE_NAMES, Boolean.toString(preserveNames));
     1593        config.setProperty(PROP_META_UPLOADED, Long.toString(uploaded));
    15731594        if (base != null)
    15741595            config.setProperty(PROP_META_BASE, base.getAbsolutePath());
     
    18271848        if (meta != null && storage != null)
    18281849            saveTorrentStatus(meta, storage.getBitField(), storage.getFilePriorities(),
    1829                               storage.getBase(), storage.getPreserveFileNames());
     1850                              storage.getBase(), storage.getPreserveFileNames(), snark.getUploaded());
    18301851    }
    18311852   
     
    18501871            }
    18511872            saveTorrentStatus(meta, storage.getBitField(), null,
    1852                               storage.getBase(), storage.getPreserveFileNames()); // no file priorities
     1873                              storage.getBase(), storage.getPreserveFileNames(), 0);
    18531874            // temp for addMessage() in case canonical throws
    18541875            String name = storage.getBaseName();
  • apps/i2psnark/java/src/org/klomp/snark/Storage.java

    r18e7e56 r49118b8  
    317317
    318318  /**
     319   *  Get index to pass to remaining(), getPriority(), setPriority()
     320   *
    319321   *  @param file non-canonical path (non-directory)
     322   *  @return internal index of file; -1 if unknown file
     323   *  @since 0.9.15
     324   */
     325  public int indexOf(File file) {
     326      for (int i = 0; i < _torrentFiles.size(); i++) {
     327          File f = _torrentFiles.get(i).RAFfile;
     328          if (f.equals(file))
     329              return i;
     330      }
     331      return -1;
     332  }
     333
     334  /**
     335   *  @param fileIndex as obtained from indexOf
    320336   *  @return number of bytes remaining; -1 if unknown file
    321337   *  @since 0.7.14
    322338   */
    323   public long remaining(File file) {
     339  public long remaining(int fileIndex) {
     340      if (fileIndex < 0 || fileIndex >= _torrentFiles.size())
     341          return -1;
    324342      long bytes = 0;
    325       for (TorrentFile tf : _torrentFiles) {
    326           File f = tf.RAFfile;
    327           if (f.equals(file)) {
     343      for (int i = 0; i < _torrentFiles.size(); i++) {
     344          TorrentFile tf = _torrentFiles.get(i);
     345          if (i == fileIndex) {
     346              File f = tf.RAFfile;
    328347              if (complete())
    329348                  return 0;
     
    351370
    352371  /**
    353    *  @param file non-canonical path (non-directory)
     372   *  @param fileIndex as obtained from indexOf
    354373   *  @since 0.8.1
    355374   */
    356   public int getPriority(File file) {
     375  public int getPriority(int fileIndex) {
    357376      if (complete() || metainfo.getFiles() == null)
    358377          return 0;
    359       for (TorrentFile tf : _torrentFiles) {
    360           File f = tf.RAFfile;
    361           if (f.equals(file))
    362               return tf.priority;
    363       }
    364       return 0;
     378      if (fileIndex < 0 || fileIndex >= _torrentFiles.size())
     379          return 0;
     380      return _torrentFiles.get(fileIndex).priority;
    365381  }
    366382
     
    368384   *  Must call Snark.updatePiecePriorities()
    369385   *  (which calls getPiecePriorities()) after calling this.
    370    *  @param file non-canonical path (non-directory)
     386   *  @param fileIndex as obtained from indexOf
    371387   *  @param pri default 0; <0 to disable
    372388   *  @since 0.8.1
    373389   */
    374   public void setPriority(File file, int pri) {
     390  public void setPriority(int fileIndex, int pri) {
    375391      if (complete() || metainfo.getFiles() == null)
    376392          return;
    377       for (TorrentFile tf : _torrentFiles) {
    378           File f = tf.RAFfile;
    379           if (f.equals(file)) {
    380               tf.priority = pri;
    381               return;
    382           }
    383       }
     393      if (fileIndex < 0 || fileIndex >= _torrentFiles.size())
     394          return;
     395      _torrentFiles.get(fileIndex).priority = pri;
    384396  }
    385397
  • apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java

    r18e7e56 r49118b8  
    7373  private static final String NOT_REGISTERED  = "torrent not registered"; //bytemonsoon
    7474  private static final String NOT_REGISTERED_2  = "torrent not found";    // diftracker
     75  private static final String NOT_REGISTERED_3  = "torrent unauthorised"; // vuze
     76  private static final String ERROR_GOT_HTML  = "received html";             // fake return
    7577  /** this is our equivalent to router.utorrent.com for bootstrap */
    7678  private static final String DEFAULT_BACKUP_TRACKER = "http://tracker.welterde.i2p/a";
     
    578580                      snark.setTrackerProblems(tr.trackerProblems);
    579581                    String tplc = tr.trackerProblems.toLowerCase(Locale.US);
    580                     if (tplc.startsWith(NOT_REGISTERED) || tplc.startsWith(NOT_REGISTERED_2)) {
     582                    if (tplc.startsWith(NOT_REGISTERED) || tplc.startsWith(NOT_REGISTERED_2) ||
     583                        tplc.startsWith(NOT_REGISTERED_3) || tplc.startsWith(ERROR_GOT_HTML)) {
    581584                      // Give a guy some time to register it if using opentrackers too
    582585                      //if (trckrs.size() == 1) {
     
    585588                      //} else { // hopefully each on the opentrackers list is really open
    586589                        if (tr.registerFails++ > MAX_REGISTER_FAILS ||
     590                            !completed ||              // no use retrying if we aren't seeding
     591                            tplc.startsWith(ERROR_GOT_HTML) ||   // fake msg from doRequest()
    587592                            (!tr.isPrimary && tr.registerFails > MAX_REGISTER_FAILS / 2))
     593                          if (_log.shouldLog(Log.WARN))
     594                              _log.warn("Not longer announcing to " + tr.announce + " : " +
     595                                        tr.trackerProblems + " after " + tr.registerFails + " failures");
    588596                          tr.stop = true;
    589597                      //
     
    798806    // Don't wait for a response to stopped when shutting down
    799807    boolean fast = _fastUnannounce && event.equals(STOPPED_EVENT);
    800     byte[] fetched = _util.get(s, true, fast ? -1 : 0, small ? 128 : 1024, small ? 1024 : 8*1024);
    801     if (fetched == null) {
    802         throw new IOException("Error fetching " + s);
    803     }
     808    byte[] fetched = _util.get(s, true, fast ? -1 : 0, small ? 128 : 1024, small ? 1024 : 32*1024);
     809    if (fetched == null)
     810        throw new IOException("Error fetching");
     811    if (fetched.length == 0)
     812        throw new IOException("No data");
     813    // The HTML check only works if we didn't exceed the maxium fetch size specified in get(),
     814    // otherwise we already threw an IOE.
     815    if (fetched[0] == '<')
     816        throw new IOException(ERROR_GOT_HTML);
    804817   
    805818        InputStream in = new ByteArrayInputStream(fetched);
  • apps/i2psnark/java/src/org/klomp/snark/UpdateRunner.java

    r18e7e56 r49118b8  
    296296    }
    297297
     298    public long getSavedUploaded(Snark snark) {
     299        return _smgr.getSavedUploaded(snark);
     300    }
     301
    298302    //////// end CompleteListener methods
    299303
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    r18e7e56 r49118b8  
    2626import javax.servlet.http.HttpServletResponse;
    2727
     28import net.i2p.data.Base32;
    2829import net.i2p.data.Base64;
    2930import net.i2p.data.DataHelper;
     31import net.i2p.data.Hash;
    3032import net.i2p.util.Log;
    3133
     
    499501        out.write("\">");
    500502        out.write("</th>\n<th align=\"right\">");
    501         if (_manager.util().connected() && !snarks.isEmpty()) {
     503        if (!snarks.isEmpty()) {
    502504            out.write("<img border=\"0\" src=\"" + _imgPath + "head_tx.png\" title=\"");
    503505            out.write(_("Uploaded"));
     
    14311433        if (isMultiFile) {
    14321434            // link on the whole td
    1433             String jsec = encodedBaseName.replace("'", "\\'");
    1434             out.write(" onclick=\"document.location='" + jsec + "/';\">");
     1435            out.write(" onclick=\"document.location='" + encodedBaseName + "/';\">");
    14351436        } else {
    14361437            out.write('>');
     
    14661467        out.write("</td>\n\t");
    14671468        out.write("<td align=\"right\" class=\"snarkTorrentUploaded\">");
    1468         if(isRunning && isValid)
     1469        if (isValid && uploaded > 0)
    14691470           out.write(formatSize(uploaded));
    14701471        out.write("</td>\n\t");
    14711472        out.write("<td align=\"right\" class=\"snarkTorrentRateDown\">");
    1472         if(isRunning && needed > 0)
     1473        if (isRunning && needed > 0)
    14731474            out.write(formatSize(downBps) + "ps");
    14741475        out.write("</td>\n\t");
    14751476        out.write("<td align=\"right\" class=\"snarkTorrentRateUp\">");
    1476         if(isRunning && isValid)
     1477        if (isRunning && isValid)
    14771478            out.write(formatSize(upBps) + "ps");
    14781479        out.write("</td>\n\t");
     
    17181719
    17191720    /**
    1720      *  Start of anchor only, caller must add anchor text or img and close anchor
    1721      *  @return string or null
     1721     *  Generate link to details page if we know it supports it.
     1722     *  Start of anchor only, caller must add anchor text or img and close anchor.
     1723     *
     1724     *  @return string or null if unknown tracker
    17221725     *  @since 0.8.4
    17231726     */
     
    17461749
    17471750    /**
    1748      *  Full anchor with img
    1749      *  @return string or null
     1751     *  Full link to details page with img
     1752     *  @return string or null if details page unsupported
    17501753     *  @since 0.8.4
    17511754     */
     
    17631766
    17641767    /**
    1765      *  Full anchor with shortened URL as anchor text
     1768     *  Full anchor to home page or details page with shortened host name as anchor text
    17661769     *  @return string, non-null
    17671770     *  @since 0.9.5
     
    17721775        if (announce.startsWith("http://"))
    17731776            announce = announce.substring(7);
     1777        // strip path
    17741778        int slsh = announce.indexOf('/');
    17751779        if (slsh > 0)
    17761780            announce = announce.substring(0, slsh);
    1777         if (trackerLinkUrl != null)
     1781        if (trackerLinkUrl != null) {
    17781782            buf.append(trackerLinkUrl);
    1779         else
    1780             // TODO encode
    1781             buf.append("<a href=\"http://").append(urlEncode(announce)).append("/\">");
     1783        } else {
     1784            // browsers don't like a full b64 dest, so convert it to b32
     1785            String host = announce;
     1786            if (host.length() >= 516) {
     1787                int colon = announce.indexOf(':');
     1788                String port = "";
     1789                if (colon > 0) {
     1790                    port = host.substring(colon);
     1791                    host = host.substring(0, colon);
     1792                }
     1793                if (host.endsWith(".i2p"))
     1794                    host = host.substring(0, host.length() - 4);
     1795                byte[] b = Base64.decode(host);
     1796                if (b != null) {
     1797                    Hash h = _context.sha().calculateHash(b);
     1798                    // should we add the port back or strip it?
     1799                    host = Base32.encode(h.getData()) + ".b32.i2p" + port;
     1800                }
     1801            }
     1802            buf.append("<a href=\"http://").append(urlEncode(host)).append("/\">");
     1803        }
     1804        // strip port
     1805        int colon = announce.indexOf(':');
     1806        if (colon > 0)
     1807            announce = announce.substring(0, colon);
    17821808        if (announce.length() > 67)
    17831809            announce = DataHelper.escapeHTML(announce.substring(0, 40)) + "&hellip;" +
     
    26742700            String status = "";
    26752701            long length = item.length();
     2702            int fileIndex = -1;
    26762703            int priority = 0;
    26772704            if (item.isDirectory()) {
     
    26852712                } else {
    26862713                    Storage storage = snark.getStorage();
    2687 
    2688                             long remaining = storage.remaining(item);
     2714                    fileIndex = storage.indexOf(item);
     2715
     2716                            long remaining = storage.remaining(fileIndex);
    26892717                            if (remaining < 0) {
    26902718                                complete = true;
     
    26942722                                status = toImg("tick") + ' ' + _("Complete");
    26952723                            } else {
    2696                                 priority = storage.getPriority(item);
     2724                                priority = storage.getPriority(fileIndex);
    26972725                                if (priority < 0)
    26982726                                    status = toImg("cancel");
     
    27462774                buf.append("<td class=\"priority\">");
    27472775                if ((!complete) && (!item.isDirectory())) {
    2748                     buf.append("\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"prihigh\" value=\"5\" name=\"pri.").append(item).append("\" ");
     2776                    buf.append("\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"prihigh\" value=\"5\" name=\"pri.").append(fileIndex).append("\" ");
    27492777                    if (priority > 0)
    27502778                        buf.append("checked=\"checked\"");
    27512779                    buf.append('>').append(_("High"));
    27522780
    2753                     buf.append("\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"prinorm\" value=\"0\" name=\"pri.").append(item).append("\" ");
     2781                    buf.append("\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"prinorm\" value=\"0\" name=\"pri.").append(fileIndex).append("\" ");
    27542782                    if (priority == 0)
    27552783                        buf.append("checked=\"checked\"");
    27562784                    buf.append('>').append(_("Normal"));
    27572785
    2758                     buf.append("\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"priskip\" value=\"-9\" name=\"pri.").append(item).append("\" ");
     2786                    buf.append("\n<input type=\"radio\" onclick=\"priorityclicked();\" class=\"priskip\" value=\"-9\" name=\"pri.").append(fileIndex).append("\" ");
    27592787                    if (priority < 0)
    27602788                        buf.append("checked=\"checked\"");
     
    28582886            if (key.startsWith("pri.")) {
    28592887                try {
    2860                     File file = new File(key.substring(4));
     2888                    int fileIndex = Integer.parseInt(key.substring(4));
    28612889                    String val = entry.getValue()[0];   // jetty arrays
    28622890                    int pri = Integer.parseInt(val);
    2863                     storage.setPriority(file, pri);
     2891                    storage.setPriority(fileIndex, pri);
    28642892                    //System.err.println("Priority now " + pri + " for " + file);
    28652893                } catch (Throwable t) { t.printStackTrace(); }
  • apps/i2psnark/java/src/org/klomp/snark/web/URIUtil.java

    r18e7e56 r49118b8  
    8585                    case '>':
    8686                    case ' ':
     87                    case ':':
    8788                        buf=new StringBuilder(path.length()*2);
    8889                        break loop;
     
    140141                          buf.append("%7F");
    141142                          continue;
     143                      case ':':
     144                          buf.append("%3A");
     145                          continue;
    142146                      default:
    143147                          if (c <= 0x1f) // includes negative
     
    184188                            buf.append("%20");
    185189                            continue;
     190                        case ':':
     191                            buf.append("%3A");
     192                            continue;
    186193                        default:
    187194                            if (c <= 0x1f || (c >= 0x7f && c <= 0x9f) || Character.isSpaceChar(c))
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java

    r18e7e56 r49118b8  
    183183            return;
    184184        setupPostThrottle();
     185        Properties props = tunnel.getClientOptions();
     186        // see TunnelController.setSessionOptions()
     187        String spoofHost = props.getProperty(TunnelController.PROP_SPOOFED_HOST);
     188        _spoofHost = (spoofHost != null && spoofHost.trim().length() > 0) ? spoofHost.trim() : null;
    185189        super.optionsUpdated(tunnel);
    186190    }
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java

    r18e7e56 r49118b8  
    1717import java.net.SocketException;
    1818import java.net.SocketTimeoutException;
     19import java.net.UnknownHostException;
    1920import java.security.GeneralSecurityException;
    2021import java.util.Map;
     
    5152    protected final Object sslLock = new Object();
    5253
    53     protected final InetAddress remoteHost;
    54     protected final int remotePort;
     54    protected InetAddress remoteHost;
     55    protected int remotePort;
    5556    private final boolean _usePool;
    5657    protected final Logging l;
     
    266267     *  @since 0.7.10
    267268     */
     269/****
    268270    private static ByteArrayInputStream copyOfInputStream(InputStream is) throws IOException {
    269271        byte[] buf = new byte[128];
     
    280282        return new ByteArrayInputStream(os.toByteArray());
    281283    }
     284****/
    282285   
    283286    /**
     
    349352    /**
    350353     *  Update the I2PSocketManager.
     354     *  And since 0.9.15, the target host and port.
    351355     *
    352356     *  @since 0.9.1
     
    358362        Properties props = tunnel.getClientOptions();
    359363        sockMgr.setDefaultOptions(sockMgr.buildOptions(props));
     364        // see TunnelController.setSessionOptions()
     365        String h = props.getProperty(TunnelController.PROP_TARGET_HOST);
     366        if (h != null) {
     367            try {
     368                remoteHost = InetAddress.getByName(h);
     369            } catch (UnknownHostException uhe) {
     370                l.log("Unknown host: " + h);
     371            }
     372        }
     373        String p = props.getProperty(TunnelController.PROP_TARGET_PORT);
     374        if (p != null) {
     375            try {
     376                int port = Integer.parseInt(p);
     377                if (port > 0 && port <= 65535)
     378                    remotePort = port;
     379                else
     380                    l.log("Bad port: " + port);
     381            } catch (NumberFormatException nfe) {
     382                l.log("Bad port: " + p);
     383            }
     384        }
    360385        buildSocketMap(props);
    361386    }
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java

    r18e7e56 r49118b8  
    488488        if (proxies != null)
    489489            opts.setProperty(PROP_PROXIES, proxies);
     490        // Ditto spoof host. Since 0.9.15.
     491        String spoofhost = getSpoofedHost();
     492        if (spoofhost != null)
     493            opts.setProperty(PROP_SPOOFED_HOST, spoofhost);
     494        // Ditto target host/port. Since 0.9.15.
     495        String targethost = getTargetHost();
     496        if (targethost != null)
     497            opts.setProperty(PROP_TARGET_HOST, targethost);
     498        String targetport = getTargetPort();
     499        if (targetport != null)
     500            opts.setProperty(PROP_TARGET_PORT, targetport);
    490501        _tunnel.setClientOptions(opts);
    491502    }
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java

    r18e7e56 r49118b8  
    259259        try { Thread.sleep(1000); } catch (InterruptedException ie) {}
    260260        // and give them something to look at in any case
     261        // FIXME name will be HTML escaped twice
    261262        return _("Starting tunnel") + ' ' + getTunnelName(_tunnel) + "...";
    262263    }
     
    272273        try { Thread.sleep(1000); } catch (InterruptedException ie) {}
    273274        // and give them something to look at in any case
     275        // FIXME name will be HTML escaped twice
    274276        return _("Stopping tunnel") + ' ' + getTunnelName(_tunnel) + "...";
    275277    }
     
    353355        if (ksMsg != null)
    354356            msgs.add(ksMsg);
     357        // FIXME name will be HTML escaped twice
    355358        return getMessages(msgs);
    356359    }
     
    403406                    }
    404407                }
    405                 name = "i2ptunnel-deleted-" + name.replace(' ', '_') + '-' + _context.clock().now() + "-privkeys.dat";
     408                name = name.replace(' ', '_').replace(':', '_').replace("..", "_").replace('/', '_').replace('\\', '_');
     409                name = "i2ptunnel-deleted-" + name + '-' + _context.clock().now() + "-privkeys.dat";
    406410                File backupDir = new SecureFile(_context.getConfigDir(), TunnelController.KEY_BACKUP_DIR);
    407411                File to;
     
    452456
    453457    public boolean allowCSS() {
    454         String css = _context.getProperty(PROP_CSS_DISABLED);
    455         return (css == null);
     458        return !_context.getBooleanProperty(PROP_CSS_DISABLED);
    456459    }
    457460   
    458461    public boolean allowJS() {
    459         String js = _context.getProperty(PROP_JS_DISABLED);
    460         return (js == null);
     462        return !_context.getBooleanProperty(PROP_JS_DISABLED);
    461463    }
    462464   
     
    728730    }
    729731    /** one line description */
    730     public void setDescription(String description) {
    731         _description = (description != null ? description.trim() : null);
     732    public void setNofilter_description(String description) {
     733        // '#' will blow up DataHelper.storeProps()
     734        _description = (description != null ? description.replace('#', ' ').trim() : null);
    732735    }
    733736    /** I2CP host the router is on, ignored when in router context */
  • apps/i2ptunnel/jsp/editClient.jsp

    r18e7e56 r49118b8  
    8080                    <%=intl._("Description")%>:(<span class="accessKey">E</span>)
    8181                </label>
    82                 <input type="text" size="60" maxlength="80" name="description"  id="description" title="Tunnel Description" value="<%=editBean.getTunnelDescription(curTunnel)%>" class="freetext" />               
     82                <input type="text" size="60" maxlength="80" name="nofilter_description"  id="description" title="Tunnel Description" value="<%=editBean.getTunnelDescription(curTunnel)%>" class="freetext" />               
    8383            </div>
    8484                 
     
    342342                <hr />
    343343            </div>
     344
     345            <div id="optionsField" class="rowItem">
     346                <label for="reduce" accesskey="c">
     347                    <%=intl._("Delay tunnel open until required")%>(<span class="accessKey">D</span>):
     348                </label>
     349            </div>
     350            <div id="portField" class="rowItem">
     351                <label for="access" accesskey="c">
     352                    <%=intl._("Enable")%>:
     353                </label>
     354                <input value="1" type="checkbox" id="startOnLoad" name="delayOpen" title="Delay Tunnel Open"<%=(editBean.getDelayOpen(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />               
     355            </div>
     356         <% } // !streamrclient %>
     357                 
     358            <div class="subdivider">
     359                <hr />
     360            </div>
    344361           
    345362            <div id="optionsField" class="rowItem">
     
    401418                <input type="text" id="port" name="closeTime" size="4" maxlength="4" title="Close Tunnel Idle Time" value="<%=editBean.getCloseTime(curTunnel)%>" class="freetext" />               
    402419            </div>
    403                  
    404             <div class="subdivider">
    405                 <hr />
    406             </div>
    407 
    408             <div id="optionsField" class="rowItem">
    409                 <label for="reduce" accesskey="c">
    410                     <%=intl._("Delay tunnel open until required")%>(<span class="accessKey">D</span>):
    411                 </label>
    412             </div>
    413             <div id="portField" class="rowItem">
    414                 <label for="access" accesskey="c">
    415                     <%=intl._("Enable")%>:
    416                 </label>
    417                 <input value="1" type="checkbox" id="startOnLoad" name="delayOpen" title="Delay Tunnel Open"<%=(editBean.getDelayOpen(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />               
    418             </div>
    419          <% } // !streamrclient %>
    420420                 
    421421            <div class="subdivider">
  • apps/i2ptunnel/jsp/editServer.jsp

    r18e7e56 r49118b8  
    8080                    <%=intl._("Description")%>(<span class="accessKey">e</span>):
    8181                </label>
    82                 <input type="text" size="60" maxlength="80" name="description"  id="description" title="Tunnel Description" value="<%=editBean.getTunnelDescription(curTunnel)%>" class="freetext" />               
     82                <input type="text" size="60" maxlength="80" name="nofilter_description"  id="description" title="Tunnel Description" value="<%=editBean.getTunnelDescription(curTunnel)%>" class="freetext" />               
    8383            </div>
    8484            <div id="startupField" class="rowItem">
  • apps/i2ptunnel/jsp/wizard.jsp

    r18e7e56 r49118b8  
    234234                    <%=intl._("Description")%>:(<span class="accessKey">E</span>)
    235235                </label>
    236                 <input type="text" size="60" maxlength="80" name="description"  id="description" title="Tunnel Description" value="<%=(!"null".equals(request.getParameter("description")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("description")) : "" ) %>" class="freetext" />
     236                <input type="text" size="60" maxlength="80" name="nofilter_description"  id="description" title="Tunnel Description" value="<%=(!"null".equals(request.getParameter("description")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("description")) : "" ) %>" class="freetext" />
    237237            </div><%
    238238            } else {
    239239            %><input type="hidden" name="name" value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("name"))%>" />
    240             <input type="hidden" name="description" value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("description"))%>" /><%
     240            <input type="hidden" name="nofilter_description" value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("description"))%>" /><%
    241241            } /* curPage 3 */
    242242
     
    485485            <input type="hidden" name="clientHost" value="internal" />
    486486            <input type="hidden" name="clientport" value="internal" />
    487             <input type="hidden" name="customOptions" value="" />
     487            <input type="hidden" name="nofilter_customOptions" value="" />
    488488
    489489            <%
     
    502502                if ("httpclient".equals(tunnelType) || "connectclient".equals(tunnelType) || "sockstunnel".equals(tunnelType) || "socksirctunnel".equals(tunnelType)) {
    503503            %><input type="hidden" name="proxyUsername" value="" />
    504             <input type="hidden" name="proxyPassword" value="" />
     504            <input type="hidden" name="nofilter_proxyPassword" value="" />
    505505            <input type="hidden" name="outproxyUsername" value="" />
    506             <input type="hidden" name="outproxyPassword" value="" /><%
     506            <input type="hidden" name="nofilter_outproxyPassword" value="" /><%
    507507                }
    508508                if ("httpclient".equals(tunnelType)) {
  • apps/routerconsole/java/src/net/i2p/router/update/ConsoleUpdateManager.java

    r18e7e56 r49118b8  
    159159        Checker c = new NewsHandler(_context, this);
    160160        register(c, NEWS, HTTP, 0);
     161        // TODO
     162        //register(c, NEWS_SU3, HTTP, 0);
    161163        register(c, ROUTER_SIGNED, HTTP, 0);  // news is an update checker for the router
    162164        Updater u = new UpdateHandler(_context, this);
     
    735737                                          Map<UpdateMethod, List<URI>> sourceMap,
    736738                                          String newVersion, String minVersion) {
    737         if (type == NEWS) {
     739        if (type == NEWS || type == NEWS_SU3) {
    738740            // shortcut
    739             notifyInstalled(NEWS, "", newVersion);
     741            notifyInstalled(type, "", newVersion);
    740742            return true;
    741743        }
     
    807809        switch (type) {
    808810            case NEWS:
     811            case NEWS_SU3:
    809812                break;
    810813
     
    901904        switch (task.getType()) {
    902905            case NEWS:
     906            case NEWS_SU3:
    903907            case ROUTER_SIGNED:
    904908            case ROUTER_SIGNED_SU3:
     
    10101014            case TYPE_DUMMY:
    10111015            case NEWS:
     1016            case NEWS_SU3:
    10121017                rv = true;
    10131018                break;
     
    11331138        switch (type) {
    11341139            case NEWS:
     1140            case NEWS_SU3:
    11351141                // handled in NewsHandler
    11361142                break;
  • apps/routerconsole/java/src/net/i2p/router/update/NewsFetcher.java

    r18e7e56 r49118b8  
    125125     *  TODO: Real XML parsing
    126126     *  TODO: Check minVersion, use backup URLs specified
     127     *  TODO: SU3
    127128     */
    128129    void checkForUpdates() {
  • apps/routerconsole/java/src/net/i2p/router/update/NewsHandler.java

    r18e7e56 r49118b8  
    3030     */
    3131    private static final String BACKUP_NEWS_URL = "http://avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a.b32.i2p/news.xml";
     32    private static final String BACKUP_NEWS_URL_SU3 = "http://avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a.b32.i2p/news.su3";
    3233
    3334    public NewsHandler(RouterContext ctx, ConsoleUpdateManager mgr) {
     
    4243    public UpdateTask check(UpdateType type, UpdateMethod method,
    4344                            String id, String currentVersion, long maxTime) {
    44         if ((type != ROUTER_SIGNED && type != NEWS) ||
     45        if ((type != ROUTER_SIGNED && type != NEWS && type != NEWS_SU3) ||
    4546            method != HTTP)
    4647            return null;
    4748        List<URI> updateSources = new ArrayList<URI>(2);
    4849        try {
     50            // TODO SU3
    4951            updateSources.add(new URI(ConfigUpdateHelper.getNewsURL(_context)));
    5052        } catch (URISyntaxException use) {}
    5153        try {
     54            // TODO
     55            //updateSources.add(new URI(BACKUP_NEWS_URL_SU3));
    5256            updateSources.add(new URI(BACKUP_NEWS_URL));
    5357        } catch (URISyntaxException use) {}
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java

    r18e7e56 r49118b8  
    6060        if (_action.equals(_("Install Plugin"))) {
    6161            if (pluginsEnabled &&
    62                 (_context.getBooleanProperty(ConfigClientsHelper.PROP_ENABLE_PLUGIN_INSTALL) ||
     62                (_context.getBooleanPropertyDefaultTrue(ConfigClientsHelper.PROP_ENABLE_PLUGIN_INSTALL) ||
    6363                 isAdvanced()))
    6464                installPlugin();
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java

    r18e7e56 r49118b8  
    4040    public boolean isPluginInstallEnabled() {
    4141        return PluginStarter.pluginsEnabled(_context) &&
    42                (_context.getBooleanProperty(PROP_ENABLE_PLUGIN_INSTALL) || isAdvanced());
     42               (_context.getBooleanPropertyDefaultTrue(PROP_ENABLE_PLUGIN_INSTALL) || isAdvanced());
     43    }
     44
     45    /** @since 0.9.15 */
     46    public boolean isPluginUpdateEnabled() {
     47        return !PluginStarter.getPlugins().isEmpty();
    4348    }
    4449
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java

    r18e7e56 r49118b8  
    3333    public static final String OLD_DEFAULT_NEWS_URL = "http://complication.i2p/news.xml";
    3434    public static final String DEFAULT_NEWS_URL = "http://echelon.i2p/i2p/news.xml";
     35    public static final String DEFAULT_NEWS_URL_SU3 = "http://echelon.i2p/i2p/news.su3";
    3536    public static final String PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency";
    3637    public static final long DEFAULT_REFRESH_FREQ = 36*60*60*1000l;
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHelper.java

    r18e7e56 r49118b8  
    3333        the update page at some point */
    3434    public static String getNewsURL(I2PAppContext ctx) {
     35        // TODO SU3
    3536        String url = ctx.getProperty(ConfigUpdateHandler.PROP_NEWS_URL);
    3637        if (url != null && !url.equals(ConfigUpdateHandler.OLD_DEFAULT_NEWS_URL))
  • apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java

    r18e7e56 r49118b8  
    1010
    1111import net.i2p.I2PAppContext;
     12import net.i2p.crypto.SigType;
    1213import net.i2p.util.FileUtil;
    1314import net.i2p.util.VersionComparator;
     
    2829    public static String jettyVersion() {
    2930        return Server.getVersion();
     31    }
     32
     33    /** @since 0.9.15 */
     34    public String getUnavailableCrypto() {
     35        StringBuilder buf = new StringBuilder(128);
     36        for (SigType t : SigType.values()) {
     37            if (!t.isAvailable()) {
     38                buf.append("<b>Crypto:</b> ").append(t.toString()).append(" unavailable<br>");
     39            }
     40        }
     41        return buf.toString();
    3042    }
    3143
  • apps/routerconsole/jsp/configclients.jsp

    r18e7e56 r49118b8  
    106106</div></form></div>
    107107
    108 <% if (clientshelper.showPlugins()) { %>
     108<%
     109   if (clientshelper.showPlugins()) {
     110       if (clientshelper.isPluginUpdateEnabled()) {
     111%>
    109112<h3><a name="pconfig"></a><%=intl._("Plugin Configuration")%></h3><p>
    110113 <%=intl._("The plugins listed below are started by the webConsole client.")%>
     
    117120 <input type="submit" name="action" class="accept" value="<%=intl._("Save Plugin Configuration")%>" />
    118121</div></form></div>
    119 
    120 <% if (clientshelper.isPluginInstallEnabled()) { %>
     122<%
     123       } // pluginUpdateEnabled
     124       if (clientshelper.isPluginInstallEnabled()) {
     125%>
    121126<h3><a name="plugin"></a><%=intl._("Plugin Installation")%></h3><p>
    122127 <%=intl._("Look for available plugins on {0}.", "<a href=\"http://plugins.i2p\">plugins.i2p</a>")%>
    123128 <%=intl._("To install a plugin, enter the download URL:")%>
    124  </p><div class="wideload">
     129 </p>
     130<%
     131       } // pluginInstallEnabled
     132       if (clientshelper.isPluginInstallEnabled() || clientshelper.isPluginUpdateEnabled()) {
     133%>
     134<div class="wideload">
    125135<form action="configclients" method="POST">
    126136<input type="hidden" name="nonce" value="<%=pageNonce%>" >
     137<%
     138           if (clientshelper.isPluginInstallEnabled()) {
     139%>
    127140<p>
    128141 <input type="text" size="60" name="pluginURL" >
     
    131144 <input type="submit" class="cancel" name="foo" value="<%=intl._("Cancel")%>" />
    132145 <input type="submit" name="action" class="download" value="<%=intl._("Install Plugin")%>" />
    133 </div><hr><div class="formaction">
     146</div>
     147<%
     148           } // pluginInstallEnabled
     149%>
     150</div>
     151<%
     152           if (clientshelper.isPluginUpdateEnabled()) {
     153%>
     154<hr><div class="formaction">
    134155 <input type="submit" name="action" class="reload" value="<%=intl._("Update All Installed Plugins")%>" />
    135  </div></form></div>
     156</div>
    136157<%
    137      } // pluginInstallEnabled
    138  } // showPlugins
     158           } // pluginUpdateEnabled
     159%>
     160</form></div>
     161<%
     162       } // pluginInstallEnabled || pluginUpdateEnabled
     163   } // showPlugins
    139164%>
    140165</div></div></body></html>
  • apps/routerconsole/jsp/error500.jsp

    r18e7e56 r49118b8  
    6161<b>I2P version:</b> <%=net.i2p.router.RouterVersion.FULL_VERSION%><br>
    6262<b>Java version:</b> <%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%> (<%=System.getProperty("java.runtime.name")%> <%=System.getProperty("java.runtime.version")%>)<br>
    63 <b>Wrapper version:</b> <%=System.getProperty("wrapper.version", "none")%><br>
    6463 <jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" />
    6564 <jsp:setProperty name="logsHelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
     65<jsp:getProperty name="logsHelper" property="unavailableCrypto" />
     66<b>Wrapper version:</b> <%=System.getProperty("wrapper.version", "none")%><br>
    6667<b>Server version:</b> <jsp:getProperty name="logsHelper" property="jettyVersion" /><br>
    6768<b>Servlet version:</b> <%=getServletInfo()%><br>
  • apps/routerconsole/jsp/logs.jsp

    r18e7e56 r49118b8  
    2525<b>I2P version:</b> <%=net.i2p.router.RouterVersion.FULL_VERSION%><br>
    2626<b>Java version:</b> <%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%> (<%=System.getProperty("java.runtime.name")%> <%=System.getProperty("java.runtime.version")%>)<br>
    27 <b>Wrapper version:</b> <%=System.getProperty("wrapper.version", "none")%><br>
    2827 <jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" />
    2928 <jsp:setProperty name="logsHelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
     29<jsp:getProperty name="logsHelper" property="unavailableCrypto" />
     30<b>Wrapper version:</b> <%=System.getProperty("wrapper.version", "none")%><br>
    3031<b>Server version:</b> <jsp:getProperty name="logsHelper" property="jettyVersion" /><br>
    3132<b>Servlet version:</b> <%=getServletInfo()%><br>
     
    3435<b>Jbigi:</b> <%=net.i2p.util.NativeBigInteger.loadStatus()%><br>
    3536<b>Encoding:</b> <%=System.getProperty("file.encoding")%><br>
    36 <b>Charset:</b> <%=java.nio.charset.Charset.defaultCharset().name()%></p>
     37<b>Charset:</b> <%=java.nio.charset.Charset.defaultCharset().name()%><br>
     38</p>
    3739<p><%=intl._("Note that system information, log timestamps, and log messages may provide clues to your location; please review everything you include in a bug report.")%></p>
    3840<h3><%=intl._("Critical Logs")%></h3><a name="criticallogs"> </a>
  • apps/streaming/java/src/net/i2p/client/streaming/impl/Packet.java

    r18e7e56 r49118b8  
    1414import net.i2p.data.Signature;
    1515import net.i2p.data.SigningPrivateKey;
     16import net.i2p.data.SigningPublicKey;
    1617import net.i2p.util.Log;
    1718
     
    315316    private void setFlags(int flags) { _flags = flags; }
    316317
    317     /** the signature on the packet (only included if the flag for it is set)
     318    /**
     319     * The signature on the packet (only included if the flag for it is set)
     320     *
     321     * Warning, may be typed wrong on incoming packets for EdDSA
     322     * before verifySignature() is called.
     323     *
    318324     * @return signature on the packet if the flag for signatures is set
    319325     */
    320326    public Signature getOptionalSignature() { return _optionSignature; }
     327
    321328    public void setOptionalSignature(Signature sig) {
    322329        setFlag(FLAG_SIGNATURE_INCLUDED, sig != null);
     
    328335     */
    329336    public Destination getOptionalFrom() { return _optionFrom; }
     337
    330338    public void setOptionalFrom(Destination from) {
    331339        setFlag(FLAG_FROM_INCLUDED, from != null);
     
    341349     */
    342350    public int getOptionalDelay() { return _optionDelay; }
     351
    343352    public void setOptionalDelay(int delayMs) {
    344353        if (delayMs > MAX_DELAY_REQUEST)
     
    508517     */
    509518    private int writtenSize() {
    510         int size = 0;
    511         size += 4; // _sendStreamId.length;
    512         size += 4; // _receiveStreamId.length;
    513         size += 4; // sequenceNum
    514         size += 4; // ackThrough
     519        //int size = 0;
     520        //size += 4; // _sendStreamId.length;
     521        //size += 4; // _receiveStreamId.length;
     522        //size += 4; // sequenceNum
     523        //size += 4; // ackThrough
     524        //    size++; // nacks length
     525        //size++; // resendDelay
     526        //size += 2; // flags
     527        //size += 2; // option size
     528        int size = 22;
     529
    515530        if (_nacks != null) {
    516             size++; // nacks length
    517531            // if max win is ever > 255, limit to 255
    518532            size += 4 * _nacks.length;
    519         } else {
    520             size++; // nacks length
    521         }
    522         size++; // resendDelay
    523         size += 2; // flags
     533        }
    524534
    525535        if (isFlagSet(FLAG_DELAY_REQUESTED))
     
    531541        if (isFlagSet(FLAG_SIGNATURE_INCLUDED))
    532542            size += _optionSignature.length();
    533        
    534         size += 2; // option size
    535543       
    536544        if (_payload != null) {
     
    633641                // assume no more options. If we add to the options
    634642                // we will have to ask the manager.
     643                // We will get this wrong for Ed25519, same length as P256...
     644                // See verifySignature() below where we will recast the signature to
     645                // the correct type if necessary
    635646                int siglen = payloadBegin - cur;
    636647                SigType type = null;
     
    678689        if (buffer == null)
    679690            buffer = new byte[size];
    680         int written = writePacket(buffer, 0, from.getSigningPublicKey().getType().getSigLen());
     691        SigningPublicKey spk = from.getSigningPublicKey();
     692        SigType type = spk.getType();
     693        if (type == null) {
     694            Log l = ctx.logManager().getLog(Packet.class);
     695            if (l.shouldLog(Log.WARN))
     696                l.warn("Unknown sig type in " + from + " cannot verify " + toString());
     697            return false;
     698        }
     699        int written = writePacket(buffer, 0, type.getSigLen());
    681700        if (written != size) {
    682701            ctx.logManager().getLog(Packet.class).error("Written " + written + " size " + size + " for " + toString(), new Exception("moo"));
    683702            return false;
    684703        }
    685         boolean ok = ctx.dsa().verifySignature(_optionSignature, buffer, 0, size, from.getSigningPublicKey());
     704
     705        // Fixup of signature if we guessed wrong on the type in readPacket(), which could happen
     706        // on a close or reset packet where we have a signature without a FROM
     707        if (type != _optionSignature.getType() &&
     708            type.getSigLen() == _optionSignature.length())
     709            _optionSignature = new Signature(type, _optionSignature.getData());
     710
     711        boolean ok = ctx.dsa().verifySignature(_optionSignature, buffer, 0, size, spk);
    686712        if (!ok) {
    687713            Log l = ctx.logManager().getLog(Packet.class);
  • build.properties

    r18e7e56 r49118b8  
    9292#with.cobertura=/PATH/TO/cobertura.jar
    9393#with.clover=/PATH/TO/clover.jar
     94
     95### Bundle router infos ###
     96# Set to bundle router infos from your local I2P install in the package
     97#bundle.routerInfos=true
     98#bundle.routerInfos.count=200
     99#bundle.routerInfos.i2pConfigDir=/PATH/TO/.i2p
  • build.xml

    r18e7e56 r49118b8  
    961961    </target>
    962962
    963     <target name="preppkg-base" depends="build, preplicenses, prepConsoleDocs, prepthemeupdates, prepCertificates">
     963    <target name="preppkg-base" depends="build, preplicenses, prepConsoleDocs, prepthemeupdates, prepCertificates, prepRouterInfos">
    964964        <!-- if updater200 was run previously, it left *.pack files in pkg-temp -->
    965965        <!-- Also remove deletelist.txt used for updater only -->
     
    10181018        </copy>
    10191019        <copy file="installer/resources/themes/console/images/favicon.ico" tofile="pkg-temp/eepsite/docroot/favicon.ico" />
     1020        <copy todir="pkg-temp/docs/icons/flags" >
     1021          <fileset dir="installer/resources/icons/flags" />
     1022        </copy>
    10201023    </target>
    10211024
     
    10501053          <fileset dir="installer/resources/certificates/" />
    10511054        </copy>
     1055    </target>
     1056
     1057    <condition property="no.bundle.routerInfos">
     1058        <isfalse value="${bundle.routerInfos}" />
     1059    </condition>
     1060
     1061    <target name="prepRouterInfos" depends="buildrouter" unless="no.bundle.routerInfos">
     1062        <mkdir dir="pkg-temp/netDb" />
     1063        <java classname="net.i2p.router.networkdb.kademlia.PersistentDataStore" fork="true" failonerror="true">
     1064            <classpath>
     1065                <pathelement location="build/i2p.jar" />
     1066                <pathelement location="build/router.jar" />
     1067            </classpath>
     1068            <arg value="-i" />
     1069            <arg value="${bundle.routerInfos.i2pConfigDir}" />
     1070            <arg value="-o" />
     1071            <arg value="pkg-temp/netDb" />
     1072            <arg value="-c" />
     1073            <arg value="${bundle.routerInfos.count}" />
     1074        </java>
    10521075    </target>
    10531076
     
    12381261        <copy file="installer/resources/geoipv6.dat.gz" todir="pkg-temp/geoip/" />
    12391262        <copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
    1240       <!--
    1241         <copy todir="pkg-temp/docs/icons/flags" >
    1242           <fileset dir="installer/resources/icons/flags" />
    1243         </copy>
    1244        -->
    12451263    </target>
    12461264
  • core/java/src/net/i2p/crypto/DSAEngine.java

    r18e7e56 r49118b8  
    4343
    4444import net.i2p.I2PAppContext;
     45import net.i2p.crypto.eddsa.EdDSAEngine;
    4546import net.i2p.crypto.eddsa.EdDSAKey;
    4647import net.i2p.data.Hash;
     
    518519        java.security.Signature jsig;
    519520        if (type.getBaseAlgorithm() == SigAlgo.EdDSA)
    520             jsig = new net.i2p.crypto.eddsa.EdDSAEngine(type.getDigestInstance());
     521            jsig = new EdDSAEngine(type.getDigestInstance());
    521522        else
    522523            jsig = java.security.Signature.getInstance(type.getAlgorithmName());
     
    567568        java.security.Signature jsig;
    568569        if (type.getBaseAlgorithm() == SigAlgo.EdDSA)
    569             jsig = new net.i2p.crypto.eddsa.EdDSAEngine(); // Ignore algo, EdDSAKey includes a hash specification.
     570            jsig = new EdDSAEngine(); // Ignore algo, EdDSAKey includes a hash specification.
    570571        else
    571572            jsig = java.security.Signature.getInstance(algo);
     
    609610        java.security.Signature jsig;
    610611        if (type.getBaseAlgorithm() == SigAlgo.EdDSA)
    611             jsig = new net.i2p.crypto.eddsa.EdDSAEngine(type.getDigestInstance());
     612            jsig = new EdDSAEngine(type.getDigestInstance());
    612613        else
    613614            jsig = java.security.Signature.getInstance(type.getAlgorithmName());
     
    652653        java.security.Signature jsig;
    653654        if (type.getBaseAlgorithm() == SigAlgo.EdDSA)
    654             jsig = new net.i2p.crypto.eddsa.EdDSAEngine(); // Ignore algo, EdDSAKey includes a hash specification.
     655            jsig = new EdDSAEngine(); // Ignore algo, EdDSAKey includes a hash specification.
    655656        else
    656657            jsig = java.security.Signature.getInstance(algo);
  • core/java/src/net/i2p/crypto/ECConstants.java

    r18e7e56 r49118b8  
    124124    */
    125125
     126    /*
    126127    private static final ECParms PARM_P192 = new ECParms(
    127128        // P N Seed B Gx Gy
     
    133134            "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"
    134135    );
     136    */
    135137
    136138
     
    319321    // first is OpenJDK 6/7
    320322    // second is BC
    321     public static final ECParameterSpec P192_SPEC = genSpec("secp192r1", "P-192", PARM_P192);
     323    //public static final ECParameterSpec P192_SPEC = genSpec("secp192r1", "P-192", PARM_P192);
    322324    public static final ECParameterSpec P256_SPEC = genSpec("secp256r1", "P-256", PARM_P256);
    323325    public static final ECParameterSpec P384_SPEC = genSpec("secp384r1", "P-384", PARM_P384);
     
    325327
    326328    // Koblitz
    327     public static final ECParameterSpec K163_SPEC = genSpec("sect163k1", "K-163", null);
    328     public static final ECParameterSpec K233_SPEC = genSpec("sect233k1", "K-233", null);
    329     public static final ECParameterSpec K283_SPEC = genSpec("sect283k1", "K-283", null);
    330     public static final ECParameterSpec K409_SPEC = genSpec("sect409k1", "K-409", null);
    331     public static final ECParameterSpec K571_SPEC = genSpec("sect571k1", "K-571", null);
     329    //public static final ECParameterSpec K163_SPEC = genSpec("sect163k1", "K-163", null);
     330    //public static final ECParameterSpec K233_SPEC = genSpec("sect233k1", "K-233", null);
     331    //public static final ECParameterSpec K283_SPEC = genSpec("sect283k1", "K-283", null);
     332    //public static final ECParameterSpec K409_SPEC = genSpec("sect409k1", "K-409", null);
     333    //public static final ECParameterSpec K571_SPEC = genSpec("sect571k1", "K-571", null);
    332334
    333335
  • core/java/src/net/i2p/crypto/SU3File.java

    r18e7e56 r49118b8  
    6868
    6969    public static final int TYPE_ZIP = 0;
     70    /** @since 0.9.15 */
    7071    public static final int TYPE_XML = 1;
     72    /** @since 0.9.15 */
     73    public static final int TYPE_HTML = 2;
    7174
    7275    public static final int CONTENT_UNKNOWN = 0;
     
    7477    public static final int CONTENT_PLUGIN = 2;
    7578    public static final int CONTENT_RESEED = 3;
     79    /** @since 0.9.15 */
    7680    public static final int CONTENT_NEWS = 4;
    7781
  • core/java/src/net/i2p/crypto/SigType.java

    r18e7e56 r49118b8  
    9696    private final String digestName, algoName, since;
    9797    private final AlgorithmParameterSpec params;
     98    private final boolean isAvail;
    9899
    99100    SigType(int cod, int pubLen, int privLen, int hLen, int sLen, SigAlgo baseAlgo,
     
    109110        params = pSpec;
    110111        since = supportedSince;
     112        isAvail = x_isAvailable();
    111113    }
    112114
     
    181183     */
    182184    public boolean isAvailable() {
     185        return isAvail;
     186    }
     187
     188    private boolean x_isAvailable() {
    183189        if (DSA_SHA1 == this)
    184190            return true;
  • core/java/src/net/i2p/crypto/eddsa/EdDSAEngine.java

    r18e7e56 r49118b8  
    1717
    1818/**
     19 * @since 0.9.15
    1920 * @author str4d
    2021 *
  • core/java/src/net/i2p/crypto/eddsa/EdDSAKey.java

    r18e7e56 r49118b8  
    55/**
    66 * Common interface for all EdDSA keys.
     7 *
     8 * @since 0.9.15
    79 * @author str4d
    810 *
  • core/java/src/net/i2p/crypto/eddsa/EdDSAPrivateKey.java

    r18e7e56 r49118b8  
    99/**
    1010 * An EdDSA private key.
     11 *
     12 * @since 0.9.15
    1113 * @author str4d
    1214 *
  • core/java/src/net/i2p/crypto/eddsa/EdDSAPublicKey.java

    r18e7e56 r49118b8  
    99/**
    1010 * An EdDSA public key.
     11 *
     12 * @since 0.9.15
    1113 * @author str4d
    1214 *
  • core/java/src/net/i2p/crypto/eddsa/KeyFactory.java

    r18e7e56 r49118b8  
    1313
    1414/**
     15 * @since 0.9.15
    1516 * @author str4d
    1617 *
  • core/java/src/net/i2p/crypto/eddsa/KeyPairGenerator.java

    r18e7e56 r49118b8  
    1818/**
    1919 *  Default strength is 256
     20 *
     21 *  @since 0.9.15
    2022 */
    2123public class KeyPairGenerator extends KeyPairGeneratorSpi {
  • core/java/src/net/i2p/crypto/eddsa/Utils.java

    r18e7e56 r49118b8  
    22
    33/**
     4 * Basic utilities for eddsa.
     5 * Not for external use, not maintained as a public API.
     6 *
     7 * @since 0.9.15
    48 * @author str4d
    59 *
     
    2024
    2125    /**
     26     * Constant-time byte[] comparison.
     27     * @return 1 if b and c are equal, 0 otherwise.
     28     */
     29    public static int equal(byte[] b, byte[] c) {
     30        int result = 0;
     31        for (int i = 0; i < 32; i++) {
     32            result |= b[i] ^ c[i];
     33        }
     34        return ~equal(result, 0) & 0x01;
     35    }
     36
     37    /**
    2238     * Constant-time determine if byte is negative.
    2339     * @param b the byte to check.
     
    3551     */
    3652    public static int bit(byte[] h, int i) {
    37         return (h[i/8] >> (i%8)) & 1;
     53        return (h[i >> 3] >> (i & 7)) & 1;
    3854    }
    3955
     
    5268        return data;
    5369    }
     70
     71    /**
     72     * Converts bytes to a hex string.
     73     * @param raw the byte[] to be converted.
     74     * @return the hex representation as a string.
     75     */
     76    public static String bytesToHex(byte[] raw) {
     77        if ( raw == null ) {
     78            return null;
     79        }
     80        final StringBuilder hex = new StringBuilder(2 * raw.length);
     81        for (final byte b : raw) {
     82            hex.append(Character.forDigit((b & 0xF0) >> 4, 16))
     83            .append(Character.forDigit((b & 0x0F), 16));
     84        }
     85        return hex.toString();
     86    }
     87
    5488}
  • core/java/src/net/i2p/crypto/eddsa/math/Curve.java

    r18e7e56 r49118b8  
    66 * A twisted Edwards curve.
    77 * Points on the curve satisfy -x^2 + y^2 = 1 + d x^2y^2
     8 *
     9 * @since 0.9.15
    810 * @author str4d
    911 *
  • core/java/src/net/i2p/crypto/eddsa/math/Encoding.java

    r18e7e56 r49118b8  
    44 * Common interface for all (b-1)-bit encodings of elements
    55 * of EdDSA finite fields.
     6 *
     7 * @since 0.9.15
    68 * @author str4d
    79 *
     
    2325     * Decode a FieldElement from its (b-1)-bit encoding.
    2426     * The highest bit is masked out.
    25      * @param val the (b-1)-bit encoding of a FieldElement.
     27     * @param in the (b-1)-bit encoding of a FieldElement.
    2628     * @return the FieldElement represented by 'val'.
    2729     */
     
    3436     * is the little-endian representation of {0, 1,..., q-1} then the negative
    3537     * elements of F_q are {1, 3, 5,..., q-2}.
    36      * @return
     38     * @return true if negative
    3739     */
    3840    public abstract boolean isNegative(FieldElement x);
  • core/java/src/net/i2p/crypto/eddsa/math/Field.java

    r18e7e56 r49118b8  
    55/**
    66 * An EdDSA finite field. Includes several pre-computed values.
     7 *
     8 * @since 0.9.15
    79 * @author str4d
    810 *
  • core/java/src/net/i2p/crypto/eddsa/math/FieldElement.java

    r18e7e56 r49118b8  
    11package net.i2p.crypto.eddsa.math;
    22
     3/**
     4 *
     5 * @since 0.9.15
     6 *
     7 */
    38public abstract class FieldElement {
    49    protected final Field f;
  • core/java/src/net/i2p/crypto/eddsa/math/GroupElement.java

    r18e7e56 r49118b8  
    77/**
    88 * A point (x,y) on an EdDSA curve.
     9 *
     10 * @since 0.9.15
    911 * @author str4d
    1012 *
     
    490492     * @param pos = i/2 for i in {0, 2, 4,..., 62}
    491493     * @param b = r_i
    492      * @return
     494     * @return the GroupElement
    493495     */
    494496    GroupElement select(int pos, int b) {
     
    523525     *   a[31] <= 127
    524526     * @param a = a[0]+256*a[1]+...+256^31 a[31]
    525      * @return
     527     * @return the GroupElement
    526528     */
    527529    public GroupElement scalarMultiply(byte[] a) {
     
    604606     * @param a = a[0]+256*a[1]+...+256^31 a[31]
    605607     * @param b = b[0]+256*b[1]+...+256^31 b[31]
    606      * @return
     608     * @return the GroupElement
    607609     */
    608610    public GroupElement doubleScalarMultiplyVariableTime(GroupElement A, byte[] a, byte[] b) {
     
    646648    /**
    647649     * Verify that a point is on its curve.
    648      * @param P The point to check.
    649650     * @return true if the point lies on its curve.
    650651     */
  • core/java/src/net/i2p/crypto/eddsa/math/ScalarOps.java

    r18e7e56 r49118b8  
    11package net.i2p.crypto.eddsa.math;
    22
     3/**
     4 *
     5 * @since 0.9.15
     6 *
     7 */
    38public interface ScalarOps {
    49    /**
  • core/java/src/net/i2p/crypto/eddsa/math/bigint/BigIntegerLittleEndianEncoding.java

    r18e7e56 r49118b8  
    6666     * is the little-endian representation of {0, 1,..., q-1} then the negative
    6767     * elements of F_q are {1, 3, 5,..., q-2}.
    68      * @return
     68     * @return true if negative
    6969     */
    7070    public boolean isNegative(FieldElement x) {
  • core/java/src/net/i2p/crypto/eddsa/math/ed25519/Ed25519FieldElement.java

    r18e7e56 r49118b8  
    11package net.i2p.crypto.eddsa.math.ed25519;
    22
     3import net.i2p.crypto.eddsa.Utils;
    34import net.i2p.crypto.eddsa.math.Field;
    45import net.i2p.crypto.eddsa.math.FieldElement;
    5 import net.i2p.data.DataHelper;
    66
    77/**
     
    2727    public boolean isNonZero() {
    2828        byte[] s = toByteArray();
    29         int result = 0;
    30         for (int i = 0; i < 32; i++) {
    31             result |= s[i] ^ zero[i];
    32         }
    33         return result != 0;
     29        return Utils.equal(s, zero) == 1;
    3430    }
    3531
     
    960956            return false;
    961957        Ed25519FieldElement fe = (Ed25519FieldElement) obj;
    962         // XXX why does direct byte[] comparison fail?
    963         // TODO should this be constant time?
    964         return DataHelper.toString(toByteArray()).equals(DataHelper.toString(fe.toByteArray()));
     958        return 1==Utils.equal(toByteArray(), fe.toByteArray());
    965959    }
    966960
    967961    @Override
    968962    public String toString() {
    969         return "[Ed25519FieldElement val="+DataHelper.toString(toByteArray())+"]";
     963        return "[Ed25519FieldElement val="+Utils.bytesToHex(toByteArray())+"]";
    970964    }
    971965}
  • core/java/src/net/i2p/crypto/eddsa/spec/EdDSAGenParameterSpec.java

    r18e7e56 r49118b8  
    66 * Implementation of AlgorithmParameterSpec that holds the name of a named
    77 * EdDSA curve specification.
     8 *
     9 * @since 0.9.15
    810 * @author str4d
    911 *
  • core/java/src/net/i2p/crypto/eddsa/spec/EdDSANamedCurveSpec.java

    r18e7e56 r49118b8  
    77/**
    88 * EdDSA Curve specification that can also be referred to by name.
     9 *
     10 * @since 0.9.15
    911 * @author str4d
    1012 *
  • core/java/src/net/i2p/crypto/eddsa/spec/EdDSANamedCurveTable.java

    r18e7e56 r49118b8  
    1111/**
    1212 * The named EdDSA curves.
     13 *
     14 * @since 0.9.15
    1315 * @author str4d
    1416 *
  • core/java/src/net/i2p/crypto/eddsa/spec/EdDSAParameterSpec.java

    r18e7e56 r49118b8  
    1313/**
    1414 * Parameter specification for an EdDSA algorithm.
     15 *
     16 * @since 0.9.15
    1517 * @author str4d
    1618 *
  • core/java/src/net/i2p/crypto/eddsa/spec/EdDSAPrivateKeySpec.java

    r18e7e56 r49118b8  
    99
    1010/**
     11 *
     12 * @since 0.9.15
    1113 * @author str4d
    1214 *
  • core/java/src/net/i2p/crypto/eddsa/spec/EdDSAPublicKeySpec.java

    r18e7e56 r49118b8  
    66
    77/**
     8 *
     9 * @since 0.9.15
    810 * @author str4d
    911 *
  • core/java/src/net/i2p/data/Destination.java

    r18e7e56 r49118b8  
    105105
    106106    /**
    107      *  deprecated, used only by Packet.java in streaming
     107     *  Deprecated, used only by Packet.java in streaming.
     108     *  Broken for sig types P521 and RSA before 0.9.15
    108109     *  @return the written length (NOT the new offset)   
    109110     */   
     
    116117            cur += _padding.length;
    117118        }
    118         System.arraycopy(_signingKey.getData(), 0, target, cur, _signingKey.length());
    119         cur += _signingKey.length();
     119        int spkTrunc = Math.min(SigningPublicKey.KEYSIZE_BYTES, _signingKey.length());
     120        System.arraycopy(_signingKey.getData(), 0, target, cur, spkTrunc);
     121        cur += spkTrunc;
    120122        cur += _certificate.writeBytes(target, cur);
    121123        return cur - offset;
  • core/java/src/net/i2p/data/SimpleDataStructure.java

    r18e7e56 r49118b8  
    8282        _data = new byte[length];
    8383        int read = read(in, _data);
    84         if (read != length) throw new DataFormatException("Not enough bytes to read the data");
     84        if (read != length)
     85            throw new DataFormatException("EOF reading " + getClass().getSimpleName() +
     86                                          ", read: " + read + ", required: " + length);
    8587    }
    8688   
  • core/java/src/net/i2p/update/UpdateType.java

    r18e7e56 r49118b8  
    2424    ADDRESSBOOK,
    2525    /** @since 0.9.9 */
    26     ROUTER_SIGNED_SU3
     26    ROUTER_SIGNED_SU3,
     27    /** @since 0.9.15 */
     28    NEWS_SU3
    2729}
  • core/java/src/net/i2p/util/NativeBigInteger.java

    r18e7e56 r49118b8  
    476476            if (!_nativeOk) {
    477477                warn("Native BigInteger library jbigi not loaded - using pure Java - " +
    478                      "poor performance may result - see http://www.i2p2.i2p/jbigi for help");
     478                     "poor performance may result - see http://i2p-projekt.i2p/jbigi for help");
    479479            }
    480480        } catch(Exception e) {
  • core/java/src/net/i2p/util/SystemVersion.java

    r18e7e56 r49118b8  
    2727    private static final boolean _oneDotSix;
    2828    private static final boolean _oneDotSeven;
     29    private static final boolean _oneDotEight;
    2930    private static final int _androidSDK;
    3031
     
    6162            _oneDotSix = _androidSDK >= 9;
    6263            _oneDotSeven = _androidSDK >= 19;
     64            _oneDotEight = false;
    6365        } else {
    6466            _oneDotSix = VersionComparator.comp(System.getProperty("java.version"), "1.6") >= 0;
    65             _oneDotSeven = VersionComparator.comp(System.getProperty("java.version"), "1.7") >= 0;
     67            _oneDotSeven = _oneDotSix && VersionComparator.comp(System.getProperty("java.version"), "1.7") >= 0;
     68            _oneDotEight = _oneDotSeven && VersionComparator.comp(System.getProperty("java.version"), "1.8") >= 0;
    6669        }
    6770    }
     
    129132
    130133    /**
     134     *
     135     *  @return true if Java 1.8 or higher, false for Android.
     136     *  @since 0.9.15
     137     */
     138    public static boolean isJava8() {
     139        return _oneDotEight;
     140    }
     141
     142    /**
    131143     * This isn't always correct.
    132144     * http://stackoverflow.com/questions/807263/how-do-i-detect-which-kind-of-jre-is-installed-32bit-vs-64bit
  • history.txt

    r18e7e56 r49118b8  
     12014-09-09 zzz
     2 * i2psnark: Escape fixes
     3
     42014-08-31 zzz
     5 * Build: Add support for bundling router infos in the package
     6 * I2PTunnel: Allow changing of spoof host and target host/port without
     7              restarting server tunnel
     8
     92014-08-30 zzz
     10 * Console:
     11  - Re-enable plugin installation by default
     12  - Don't show configuration section or update-all button if no plugins installed
     13  - Show unavailable crypto on /logs
     14 * Router: Log warnings for unavailable crypto at startup
     15 * RouterInfo: Backport fix for verification of EdDSA RI sig type
     16
     172014-08-28 zzz
     18 * Streaming: Fix verify of Ed25519 signatures in CLOSE packets
     19
     202014-08-27 zzz
     21 * i2psnark:
     22   - Persist uploaded count (tickets #1034, #1298)
     23   - Don't retry announce if we get back HTML
     24   - Recognize Vuze tracker rejections
     25   - Don't retry rejected announces unless seeding
     26   - Better UI handling of announces with ports or full destination
     27 * NetDB: Don't abort initialization on an unsupported RI sig type
     28 * Streaming: Fix P521 and RSA sig types
     29
     302014-08-23 zzz
     31 * Console, i2psnark, i2ptunnel: Escape fixes and cleanups
     32 * SSU: Drop peer tests as Bob from unestablished Alices
     33
    1342014-08-22 zzz
    235 * SigTypes:
  • installer/resources/certificates/reseed/swat_at_mail.i2p.crt

    r18e7e56 r49118b8  
    1 -----BEGIN CERTIFICATE----- 
     1-----BEGIN CERTIFICATE-----
    22MIIFVjCCAz6gAwIBAgIEU71jgDANBgkqhkiG9w0BAQ0FADBtMQswCQYDVQQGEwJY
    33WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt
  • installer/resources/eepsite/docroot/help/index_na.html

    r18e7e56 r49118b8  
    1111<div class="langbar">
    1212<!-- Some of these languages listed here are yet to be translated -->
    13 <a href="index.html"><img src="lib/us.png" title="English" alt="English"></a
     13<a href="index.html"><img src="lib/us.png" title="English" alt="English"></a>
    1414<a href="index_zh.html"><img src="lib/cn.png" title="中文" alt="中文"></a>
    1515<a href="index_de.html"><img src="lib/de.png" title="Deutsch" alt="Deutsch"></a>
  • router/java/src/net/i2p/router/Router.java

    r18e7e56 r49118b8  
    315315                SecureFileOutputStream.setPerms(f);
    316316        }
     317        CryptoChecker.warnUnavailableCrypto(_context);
    317318
    318319        _routerInfo = null;
  • router/java/src/net/i2p/router/RouterVersion.java

    r18e7e56 r49118b8  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 9;
     21    public final static long BUILD = 16;
    2222
    2323    /** for example "-test" */
    24     public final static String EXTRA = "";
     24    public final static String EXTRA = "-rc";
    2525    public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
    2626    public static void main(String args[]) {
  • router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java

    r18e7e56 r49118b8  
    5555    private final static int READ_DELAY = 2*60*1000;
    5656    private static final String PROP_FLAT = "router.networkDatabase.flat";
    57     private static final String DIR_PREFIX = "r";
    58     private static final String B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~";
     57    static final String DIR_PREFIX = "r";
     58    static final String B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~";
    5959   
    6060    /**
     
    615615    }
    616616   
    617     private static Hash getRouterInfoHash(String filename) {
     617    static Hash getRouterInfoHash(String filename) {
    618618        return getHash(filename, ROUTERINFO_PREFIX, ROUTERINFO_SUFFIX);
    619619    }
     
    652652    }
    653653   
    654     private final static class RouterInfoFilter implements FilenameFilter {
     654    static class RouterInfoFilter implements FilenameFilter {
    655655        private static final FilenameFilter _instance = new RouterInfoFilter();
    656656        public static final FilenameFilter getInstance() { return _instance; }
  • router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java

    r18e7e56 r49118b8  
    7575             //"http://euve5653.vserver.de/netDb/" +  "," +
    7676              "http://cowpuncher.drollette.com/netdb/" + "," +
    77               //Temp disabled (#1351)
    78               //"http://i2p.mooo.com/netDb/" + "," +
     77              "http://i2p.mooo.com/netDb/" + "," +
    7978              "http://193.150.121.66/netDb/" + "," +
    8079              "http://netdb.i2p2.no/" + "," +
     
    9493              //"https://euve5653.vserver.de/netDb/" + "," +
    9594              "https://cowpuncher.drollette.com/netdb/" + "," +
    96               //Temp disabled (#1351)
    97               //"https://i2p.mooo.com/netDb/" + "," +
     95              "https://i2p.mooo.com/netDb/" + "," +
    9896              "https://193.150.121.66/netDb/" + "," +
    9997              "https://netdb.i2p2.no/" + "," +
  • router/java/src/net/i2p/router/startup/WorkingDir.java

    r18e7e56 r49118b8  
    272272        // but distros might put one in
    273273        "addressbook,eepsite," +
     274        // 0.9.15 support bundled router infos
     275        "netDb," +
    274276        // base install - files
    275277        // We don't currently have a default router.config, logger.config, susimail.config, or webapps.config in the base distribution,
  • router/java/src/net/i2p/router/transport/BadCountries.java

    r18e7e56 r49118b8  
    1010 *  @since 0.8.13
    1111 */
    12 abstract class BadCountries {
     12public abstract class BadCountries {
    1313
    1414    private static final Set<String> _countries;
  • router/java/src/net/i2p/router/transport/GeoIP.java

    r18e7e56 r49118b8  
    1717import java.util.concurrent.atomic.AtomicBoolean;
    1818
     19import net.i2p.I2PAppContext;
    1920import net.i2p.data.Hash;
    2021import net.i2p.router.Router;
     
    3940 * @author zzz
    4041 */
    41 class GeoIP {
     42public class GeoIP {
    4243    private final Log _log;
    43     // change to test with main()
    44     //private final I2PAppContext _context;
    45     private final RouterContext _context;
     44    private final I2PAppContext _context;
    4645    private final Map<String, String> _codeToName;
    4746    /** code to itself to prevent String proliferation */
     
    5756    private int _lookupRunCount;
    5857   
    59     //public GeoIP(I2PAppContext context) {
    60     public GeoIP(RouterContext context) {
     58    /**
     59     *  @param context RouterContext in production, I2PAppContext for testing only
     60     */
     61    public GeoIP(I2PAppContext context) {
    6162        _context = context;
    6263        _log = context.logManager().getLog(GeoIP.class);
     
    7273   
    7374    static final String PROP_GEOIP_ENABLED = "routerconsole.geoip.enable";
     75    public static final String PROP_GEOIP_DIR = "geoip.dir";
    7476    static final String GEOIP_DIR_DEFAULT = "geoip";
    7577    static final String GEOIP_FILE_DEFAULT = "geoip.txt";
     
    188190    */
    189191    private void readCountryFile() {
    190         File geoFile = new File(_context.getBaseDir(), GEOIP_DIR_DEFAULT);
     192        String geoDir = _context.getProperty(PROP_GEOIP_DIR, GEOIP_DIR_DEFAULT);
     193        File geoFile = new File(geoDir);
     194        if (!geoFile.isAbsolute())
     195            geoFile = new File(_context.getBaseDir(), geoDir);
    191196        geoFile = new File(geoFile, COUNTRY_FILE_DEFAULT);
    192197        if (!geoFile.exists()) {
     
    247252    */
    248253    private String[] readGeoIPFile(Long[] search) {
    249         File geoFile = new File(_context.getBaseDir(), GEOIP_DIR_DEFAULT);
     254        String geoDir = _context.getProperty(PROP_GEOIP_DIR, GEOIP_DIR_DEFAULT);
     255        File geoFile = new File(geoDir);
     256        if (!geoFile.isAbsolute())
     257            geoFile = new File(_context.getBaseDir(), geoDir);
    250258        geoFile = new File(geoFile, GEOIP_FILE_DEFAULT);
    251259        if (!geoFile.exists()) {
     
    301309     *  Put our country code in the config, where others (such as Timestamper) can get it,
    302310     *  and it will be there next time at startup.
     311     *
     312     *  Does nothing in I2PAppContext
    303313     */
    304314    private void updateOurCountry() {
    305         /**** comment out to test with main() */
    306         String oldCountry = _context.router().getConfigSetting(PROP_IP_COUNTRY);
    307         Hash ourHash = _context.routerHash();
     315        if (! (_context instanceof RouterContext))
     316            return;
     317        RouterContext ctx = (RouterContext) _context;
     318        String oldCountry = ctx.router().getConfigSetting(PROP_IP_COUNTRY);
     319        Hash ourHash = ctx.routerHash();
    308320        // we should always have a RouterInfo by now, but we had one report of an NPE here
    309321        if (ourHash == null)
    310322            return;
    311         String country = _context.commSystem().getCountry(ourHash);
     323        String country = ctx.commSystem().getCountry(ourHash);
    312324        if (country != null && !country.equals(oldCountry)) {
    313             _context.router().saveConfig(PROP_IP_COUNTRY, country);
    314             if (_context.commSystem().isInBadCountry() && _context.getProperty(Router.PROP_HIDDEN_HIDDEN) == null) {
     325            ctx.router().saveConfig(PROP_IP_COUNTRY, country);
     326            if (ctx.commSystem().isInBadCountry() && ctx.getProperty(Router.PROP_HIDDEN_HIDDEN) == null) {
    315327                String name = fullName(country);
    316328                if (name == null)
     
    318330                _log.logAlways(Log.WARN, "Setting hidden mode to protect you in " + name +
    319331                                         ", you may override on the network configuration page");
    320                 _context.router().rebuildRouterInfo();
     332                ctx.router().rebuildRouterInfo();
    321333            }
    322334        }
  • router/java/src/org/cybergarage/upnp/ControlPoint.java

    r18e7e56 r49118b8  
    293293                int nRoots = devNodeList.size();
    294294                for (int n=0; n<nRoots; n++) {
    295                         Node rootNode = devNodeList.getNode(n);
     295                        // AIOOB was thrown from here, maybe would be better to
     296                        // copy the list before traversal?
     297                        Node rootNode;
     298                        try {
     299                                rootNode = devNodeList.getNode(n);
     300                        } catch (ArrayIndexOutOfBoundsException aioob) {
     301                                break;
     302                        }
    296303                        Device dev = getDevice(rootNode);
    297304                        if (dev == null)
  • tests/scripts/checkcerts.sh

    r18e7e56 r49118b8  
    165165       compute_dates
    166166    fi
     167    if grep '\s$' $i > /dev/null 2>&1; then
     168        echo "********* Trailing whitespace found in file $i *********"
     169        FAIL=1
     170    fi
     171    if grep '^\s' $i > /dev/null 2>&1; then
     172        echo "********* Leading whitespace found in file $i *********"
     173        FAIL=1
     174    fi
    167175done
    168176
Note: See TracChangeset for help on using the changeset viewer.