Changeset 6112cc5


Ignore:
Timestamp:
Nov 6, 2014 5:45:06 PM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
23f24c7d
Parents:
7deb8c1
Message:

i2psnark:

  • Add new opentrackers, remove welterde
  • Support multiple default opentrackers
  • Don't link to opentrackers at the top
Files:
5 edited

Legend:

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

    r7deb8c1 r6112cc5  
    44import java.io.File;
    55import java.io.IOException;
     6import java.net.MalformedURLException;
     7import java.net.URL;
    68import java.util.Collections;
    79import java.util.HashMap;
     
    1012import java.util.Properties;
    1113import java.util.Set;
     14
    1215import net.i2p.I2PAppContext;
    1316import net.i2p.I2PException;
     
    7275    public static final int DEFAULT_STARTUP_DELAY = 3;
    7376    public static final boolean DEFAULT_USE_OPENTRACKERS = true;
    74     public static final String DEFAULT_OPENTRACKERS = "http://tracker.welterde.i2p/a";
    7577    public static final int DEFAULT_MAX_UP_BW = 8;  //KBps
    7678    public static final int MAX_CONNECTIONS = 16; // per torrent
     
    100102        _startupDelay = DEFAULT_STARTUP_DELAY;
    101103        _shouldUseOT = DEFAULT_USE_OPENTRACKERS;
    102         // FIXME split if default has more than one
    103         _openTrackers = Collections.singletonList(DEFAULT_OPENTRACKERS);
     104        _openTrackers = Collections.emptyList();
    104105        _shouldUseDHT = DEFAULT_USE_DHT;
    105106        // This is used for both announce replies and .torrent file downloads,
     
    566567    }
    567568   
    568     /** @param ot non-null */
     569    /** @param ot non-null list of announce URLs */
    569570    public void setOpenTrackers(List<String> ot) {
    570571        _openTrackers = ot;
    571572    }
    572573
    573     /** List of open trackers to use as backups
     574    /** List of open tracker announce URLs to use as backups
    574575     *  @return non-null, possibly unmodifiable, empty if disabled
    575576     */
     
    581582
    582583    /**
    583      *  List of open trackers to use as backups even if disabled
     584     *  Is this announce URL probably for an open tracker?
     585     *
     586     *  @since 0.9.17
     587     */
     588    public boolean isKnownOpenTracker(String url) {
     589        try {
     590           URL u = new URL(url);
     591           String host = u.getHost();
     592           return host != null && SnarkManager.KNOWN_OPENTRACKERS.contains(host);
     593        } catch (MalformedURLException mue) {
     594           return false;
     595        }
     596    }
     597
     598    /**
     599     *  List of open tracker announce URLs to use as backups even if disabled
    584600     *  @return non-null
    585601     *  @since 0.9.4
  • apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java

    r7deb8c1 r6112cc5  
    2828import net.i2p.I2PAppContext;
    2929import net.i2p.app.ClientAppManager;
     30import net.i2p.crypto.SigType;
    3031import net.i2p.data.Base64;
    3132import net.i2p.data.DataHelper;
     
    145146//       , "Galen", "http://5jpwQMI5FT303YwKa5Rd38PYSX04pbIKgTaKQsWbqoWjIfoancFdWCShXHLI5G5ofOb0Xu11vl2VEMyPsg1jUFYSVnu4-VfMe3y4TKTR6DTpetWrnmEK6m2UXh91J5DZJAKlgmO7UdsFlBkQfR2rY853-DfbJtQIFl91tbsmjcA5CGQi4VxMFyIkBzv-pCsuLQiZqOwWasTlnzey8GcDAPG1LDcvfflGV~6F5no9mnuisZPteZKlrv~~TDoXTj74QjByWc4EOYlwqK8sbU9aOvz~s31XzErbPTfwiawiaZ0RUI-IDrKgyvmj0neuFTWgjRGVTH8bz7cBZIc3viy6ioD-eMQOrXaQL0TCWZUelRwHRvgdPiQrxdYQs7ixkajeHzxi-Pq0EMm5Vbh3j3Q9kfUFW3JjFDA-MLB4g6XnjCbM5J1rC0oOBDCIEfhQkszru5cyLjHiZ5yeA0VThgu~c7xKHybv~OMXION7V8pBKOgET7ZgAkw1xgYe3Kkyq5syAAAA.i2p/tr/announce.php=http://galen.i2p/tr/"
    146147       "Postman", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/"
    147        ,"Welterde", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
     148//       ,"Welterde", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
    148149       ,"Diftracker", "http://diftracker.i2p/announce.php=http://diftracker.i2p/"
    149150//       , "CRSTRACK", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
    150151//       ,"Exotrack", "http://blbgywsjubw3d2zih2giokakhe3o2cko7jtte4risb3hohbcoyva.b32.i2p/announce.php=http://exotrack.i2p/"
     152       ,"DgTrack", "http://w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p/a=http://opentracker.dg2.i2p/"
     153       // The following is ECDSA_SHA256_P256
     154       ,"TheBland", "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a=http://tracker.thebland.i2p/stats?mode=peer"
    151155    };
    152156   
     157    /** URL. This is our equivalent to router.utorrent.com for bootstrap */
     158    public static final String DEFAULT_BACKUP_TRACKER = "http://opentracker.dg2.i2p/a";
     159
     160    /** URLs, comma-separated. Used for "announce to open trackers also" */
     161    private static final String DEFAULT_OPENTRACKERS = DEFAULT_BACKUP_TRACKER +
     162                                                       (SigType.ECDSA_SHA256_P256.isAvailable() ? ",http://tracker.thebland.i2p/a" : "");
     163
    153164    public static final Set<String> DEFAULT_TRACKER_ANNOUNCES;
     165
     166    /** host names for config form */
     167    public static final Set<String> KNOWN_OPENTRACKERS = new HashSet(Arrays.asList(new String[] {
     168        "tracker.welterde.i2p", "cfmqlafjfmgkzbt4r3jsfyhgsr5abgxryl6fnz3d3y5a365di5aa.b32.i2p",
     169        "opentracker.dg2.i2p", "w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p",
     170        "tracker.thebland.i2p", "s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p",
     171        "psi.i2p", "avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a.b32.i2p",
     172        "opentracker.psi.i2p", "vmow3h54yljn7zvzbqepdddt5fmygijujycod2q6yznpy2rrzuwa.b32.i2p",
     173        "tracker.killyourtv.i2p", "5mpvzxfbd4rtped3c7ln4ddw52e7i7t56s36ztky4ustxtxrjdpa.b32.i2p"
     174    }));
    154175
    155176    static {
    156177        Set<String> ann = new HashSet();
    157178        for (int i = 1; i < DEFAULT_TRACKERS.length; i += 2) {
     179            if (DEFAULT_TRACKERS[i-1].equals("TheBland") && !SigType.ECDSA_SHA256_P256.isAvailable())
     180                continue;
    158181            String urls[] = DEFAULT_TRACKERS[i].split("=", 2);
    159182            ann.add(urls[0]);
     
    658681        _util.setStartupDelay(getInt(PROP_STARTUP_DELAY, DEFAULT_STARTUP_DELAY));
    659682        _util.setFilesPublic(areFilesPublic());
    660         String ot = _config.getProperty(PROP_OPENTRACKERS);
    661         if (ot != null)
    662             _util.setOpenTrackers(getOpenTrackers());
     683        _util.setOpenTrackers(getListConfig(PROP_OPENTRACKERS, DEFAULT_OPENTRACKERS));
    663684        String useOT = _config.getProperty(PROP_USE_OPENTRACKERS);
    664685        boolean bOT = useOT == null || Boolean.parseBoolean(useOT);
     
    960981        if (!_util.shouldUseOpenTrackers())
    961982            return Collections.emptyList();
    962         return getListConfig(PROP_OPENTRACKERS, I2PSnarkUtil.DEFAULT_OPENTRACKERS);
     983        return getListConfig(PROP_OPENTRACKERS, DEFAULT_OPENTRACKERS);
    963984    }
    964985   
     
    978999        setListConfig(PROP_OPENTRACKERS, ot);
    9791000        if (ot == null)
    980             ot = Collections.singletonList(I2PSnarkUtil.DEFAULT_OPENTRACKERS);
     1001            ot = getListConfig(PROP_OPENTRACKERS, DEFAULT_OPENTRACKERS);
    9811002        _util.setOpenTrackers(ot);
    9821003        addMessage(_("Open Tracker list changed - torrent restart required to take effect."));
     
    20722093        for (int i = 0; i < DEFAULT_TRACKERS.length; i += 2) {
    20732094            String name = DEFAULT_TRACKERS[i];
     2095            if (name.equals("TheBland") && !SigType.ECDSA_SHA256_P256.isAvailable())
     2096                continue;
    20742097            String urls[] = DEFAULT_TRACKERS[i+1].split("=", 2);
    20752098            String url2 = urls.length > 1 ? urls[1] : null;
  • apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java

    r7deb8c1 r6112cc5  
    7575  private static final String NOT_REGISTERED_3  = "torrent unauthorised"; // vuze
    7676  private static final String ERROR_GOT_HTML  = "received html";             // fake return
    77   /** this is our equivalent to router.utorrent.com for bootstrap */
    78   private static final String DEFAULT_BACKUP_TRACKER = "http://tracker.welterde.i2p/a";
    7977
    8078  private final static int SLEEP = 5; // 5 minutes.
     
    345343        }
    346344        if (backupTrackers.isEmpty()) {
    347             backupTrackers.add(new TCTracker(DEFAULT_BACKUP_TRACKER, false));
     345            backupTrackers.add(new TCTracker(SnarkManager.DEFAULT_BACKUP_TRACKER, false));
     346        } else if (trackers.size() > 1) {
     347            Collections.shuffle(backupTrackers, _util.getContext().random());
    348348        }
    349349    }
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    r7deb8c1 r6112cc5  
    329329            for (Tracker t : sortedTrackers) {
    330330                if (t.baseURL == null || !t.baseURL.startsWith("http"))
     331                    continue;
     332                if (_manager.util().isKnownOpenTracker(t.announceURL))
    331333                    continue;
    332334                out.write(" <a href=\"" + t.baseURL + "\" class=\"snarkRefresh\" target=\"_blank\">" + t.name + "</a>");
     
    23062308            boolean isOpen = openTrackers.contains(t.announceURL);
    23072309            boolean isPrivate = privateTrackers.contains(t.announceURL);
     2310            boolean isKnownOpen = _manager.util().isKnownOpenTracker(t.announceURL);
    23082311            buf.append("<tr><td><input type=\"checkbox\" class=\"optbox\" name=\"delete_")
    23092312               .append(name).append("\" title=\"").append(_("Delete")).append("\">" +
     
    23142317            if (!(isOpen || isPrivate))
    23152318                buf.append(" checked=\"checked\"");
    2316             else if (t.announceURL.equals("http://tracker.welterde.i2p/a"))
     2319            else if (isKnownOpen)
    23172320                buf.append(" disabled=\"disabled\"");
    23182321            buf.append(">" +
     
    23302333                buf.append(" checked=\"checked\"");
    23312334            } else {
    2332                 if (SnarkManager.DEFAULT_TRACKER_ANNOUNCES.contains(t.announceURL))
     2335                if (isKnownOpen)
    23332336                    buf.append(" disabled=\"disabled\"");
    23342337            }
  • installer/resources/hosts.txt

    r7deb8c1 r6112cc5  
    359359i2pdocs.str4d.i2p=CRayYfxrPBELUQ4tYi723g8atsyHwkR0--N8fXggNqJgHsnrKxle0ovH5qj6aqUGToay4ktJEz~opIV2lF605gdGE9rSrPONOU0v737~gzjmLpJoyW03yOhr6lGvTxTKWjgx5xRHctt11DEMlMufY4Q72~EZETE4k5E45V3YqSWGyYIzxdpzzw9zvMe9TaLZTs0ZYFgXRMIu1o5IzTkfK2FfAMNfHMcRESHHK8GcF0TkzZFnvOhtgr~Fywq5B7VMYzwq6a8ws5bPjSjQWbJqX8NR~NZl7gxSMwdlZlcICVFOo-uW9Yna2YfhzM-A5SOx60EsL26YX1VXh1zQ3Rsg2lNXbSPI4dLb9taGWxpZS914L-N3Htgih7VM-Zl1QYQGuNV-9LaEEUQKRPCeKdyG14Yry4YOVDItMFE5CHIDaoFcpD24jPE~0aHmVk~RXOIzVhmtVj~HcpBXWxT4lpIO2V3kzA-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eirzn585g5EqeV8DLqsMfe5pZBQAEAAEAAA==
     362opentracker.dg2.i2p=WSUjGXhqHr7TsBizCO0qV~Kk7G1-suPPSSyMs4AnLQ8wRlWWZ~9rl7AzS0tFG4Dbbl8Te0wtZmQeMhcartbJ3TY-TBnviFqA8zP-sEQf5UK0BA5zzrtpB7NnUo-65B61cVbqG51-p9cJZ~Crre0LEZm5bJs8P3J~oH3b3BJ0YXtuv0ccBgj~OAf1g8ZrHr431XLq8WPRkzAVEIDhFdiSCYAz8XTArNN7OnPUUCjZcw92Oqf9wajg0eXqnThDFbrCx54h0UKM7sVDqRnoXbuGVLTPVvmIOnwuwZrn4X60GMLW38Dg-38qSfJL61FIbn5HfK-VTjCOuC16PtvJAPS1qUBWa-Y3j3aGK3BpHQnlOl-XNB~tJU0GBzRvEnOPFbtqXw38LyTCsvXcY31C~sNC~jedATUfPSZK-UBeN6RkR5BQiXBV-YkzUvTM4s~oXXgw9WFe9DdEWP-XR9~2G1Qe-GkcRAKUXmTAzVnRjlHEDR0lLMfxDwe3OfZuBzM9Gda9AAAA
Note: See TracChangeset for help on using the changeset viewer.