Changeset f2f5df0


Ignore:
Timestamp:
May 19, 2019 11:42:26 AM (11 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1ffc006
Parents:
10354df
Message:

Sybil: Run IP and family tests on all routers
Hide some n/a fields, rework some text
Rename some config properties

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/sybil/Analysis.java

    r10354df rf2f5df0  
    6565    public static final String PROP_FREQUENCY = "router.sybilFrequency";
    6666    public static final String PROP_THRESHOLD = "router.sybilThreshold";
    67     public static final String PROP_BLOCK = "router.sybilBlock.enable";
    68     public static final String PROP_NONFF = "router.sybilIncludeAll";
    69     public static final String PROP_BLOCKTIME = "router.sybilBlock.period";
     67    public static final String PROP_BLOCK = "router.sybilEnableBlocking";
     68    public static final String PROP_NONFF = "router.sybilAnalyzeAll";
     69    public static final String PROP_BLOCKTIME = "router.sybilBlockPeriod";
    7070    private static final long MIN_FREQUENCY = 60*60*1000L;
    7171    private static final long MIN_UPTIME = 75*60*1000L;
     
    268268    }
    269269
     270    /**
     271     *  All the routers, not including us
     272     *  @since 0.9.41
     273     */
     274    public List<RouterInfo> getAllRouters(Hash us) {
     275        Set<RouterInfo> set = _context.netDb().getRouters();
     276        List<RouterInfo> ris = new ArrayList<RouterInfo>(set.size());
     277        for (RouterInfo ri : set) {
     278            if (!ri.getIdentity().getHash().equals(us))
     279            ris.add(ri);
     280        }
     281        return ris;
     282    }
     283
    270284    public double getAvgMinDist(List<RouterInfo> ris) {
    271285        double tot = 0;
     
    296310        List<RouterInfo> ris;
    297311        if (includeAll) {
    298             Set<RouterInfo> set = _context.netDb().getRouters();
    299             ris = new ArrayList<RouterInfo>(set.size());
    300             for (RouterInfo ri : set) {
    301                 if (!ri.getIdentity().getHash().equals(us))
    302                 ris.add(ri);
    303             }
     312            ris = getAllRouters(us);
    304313        } else {
    305314            ris = getFloodfills(us);
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/SybilRenderer.java

    r10354df rf2f5df0  
    136136        List<RouterInfo> ris = null;
    137137        if (mode != 0 && mode != 12 && mode != 13 && mode != 14 && mode != 16) {
    138             ris = analysis.getFloodfills(us);
     138            if (mode >= 2 && mode <= 6) {
     139                // review all routers for family and IP analysis
     140                ris = analysis.getAllRouters(us);
     141            } else {
     142                ris = analysis.getFloodfills(us);
     143            }
    139144            if (ris.isEmpty()) {
    140                 out.write("<h3 class=\"sybils\">No known floodfills</h3>");
     145                out.write("<h3 class=\"sybils\">No known routers</h3>");
    141146                return;
    142147            }
     
    566571    private void renderIPGroupsUs(Writer out, StringBuilder buf, List<RouterInfo> ri32,
    567572                                  List<RouterInfo> ri24, List<RouterInfo> ri16) throws IOException {
    568         buf.append("<h3 id=\"ourIP\" class=\"sybils\">Floodfills close to Our IP</h3>");
     573        buf.append("<h3 id=\"ourIP\" class=\"sybils\">Routers close to Our IP</h3>");
    569574        boolean found = false;
    570575        for (RouterInfo info : ri32) {
     
    598603     */
    599604    private void renderIPGroups32(Writer out, StringBuilder buf, Map<Integer, List<RouterInfo>> map) throws IOException {
    600         buf.append("<h3 id=\"sameIP\" class=\"sybils\">Floodfills with the Same IP</h3>");
     605        buf.append("<h3 id=\"sameIP\" class=\"sybils\">Routers with the Same IP</h3>");
    601606        List<Integer> foo = new ArrayList<Integer>(map.keySet());
    602607        Collections.sort(foo, new FooComparator(map));
     
    611616            int i3 = i & 0xff;
    612617            String sip = i0 + "." + i1 + '.' + i2 + '.' + i3;
    613             buf.append("<p class=\"sybil_info\"><b>").append(count).append(" floodfills with IP <a href=\"/netdb?ip=")
     618            buf.append("<p class=\"sybil_info\"><b>").append(count).append(" routers with IP <a href=\"/netdb?ip=")
    614619               .append(sip).append("&amp;sybil\">").append(sip)
    615620               .append("</a>:</b></p>");
     
    628633     */
    629634    private void renderIPGroups24(Writer out, StringBuilder buf, Map<Integer, List<RouterInfo>> map) throws IOException {
    630         buf.append("<h3 id=\"same24\" class=\"sybils\">Floodfills in the Same /24 (2 minimum)</h3>");
     635        buf.append("<h3 id=\"same24\" class=\"sybils\">Routers in the Same /24 (2 minimum)</h3>");
    631636        List<Integer> foo = new ArrayList<Integer>(map.keySet());
    632637        Collections.sort(foo, new FooComparator(map));
     
    640645            int i2 = i & 0xff;
    641646            String sip = i0 + "." + i1 + '.' + i2 + ".0/24";
    642             buf.append("<p class=\"sybil_info\"><b>").append(count).append(" floodfills with IP <a href=\"/netdb?ip=")
     647            buf.append("<p class=\"sybil_info\"><b>").append(count).append(" routers with IP <a href=\"/netdb?ip=")
    643648               .append(sip).append("&amp;sybil\">").append(sip)
    644649               .append("</a>:</b></p>");
     
    657662     */
    658663    private void renderIPGroups16(Writer out, StringBuilder buf, Map<Integer, List<RouterInfo>> map) throws IOException {
    659         buf.append("<h3 id=\"same16\" class=\"sybils\">Floodfills in the Same /16 (4 minimum)</h3>");
     664        buf.append("<h3 id=\"same16\" class=\"sybils\">Routers in the Same /16 (4 minimum)</h3>");
    660665        List<Integer> foo = new ArrayList<Integer>(map.keySet());
    661666        Collections.sort(foo, new FooComparator(map));
     
    669674            String sip = i0 + "." + i1 + ".0.0/16";
    670675            if (buf != null) {
    671                 buf.append("<p class=\"sybil_info\"><b>").append(count).append(" floodfills with IP <a href=\"/netdb?ip=")
     676                buf.append("<p class=\"sybil_info\"><b>").append(count).append(" routers with IP <a href=\"/netdb?ip=")
    672677                   .append(sip).append("&amp;sybil\">").append(sip)
    673678                   .append("</a></b></p>");
     
    687692     */
    688693    private void renderIPGroupsFamily(Writer out, StringBuilder buf, Map<String, List<RouterInfo>> map) throws IOException {
    689         buf.append("<h3 id=\"samefamily\" class=\"sybils\">Floodfills in the same Family</h3><div class=\"sybil_container\">");
     694        buf.append("<h3 id=\"samefamily\" class=\"sybils\">Routers in the same Family</h3><div class=\"sybil_container\">");
    690695        List<String> foo = new ArrayList<String>(map.keySet());
    691696        Collections.sort(foo, new FoofComparator(map));
     
    698703            String ss = DataHelper.escapeHTML(s);
    699704            if (count > 1) {
    700                 buf.append("<p class=\"family\"><b>").append(count).append(" floodfills in family: &nbsp;<a href=\"/netdb?fam=")
     705                buf.append("<p class=\"family\"><b>").append(count).append(" routers in family: &nbsp;<a href=\"/netdb?fam=")
    701706                   .append(ss).append("&amp;sybil\">").append(ss).append("</a></b></p>");
    702707                found = true;
     
    829834        if (kr != null) {
    830835            buf.append("<p><b>Routers:</b> ").append(DataHelper.stripHTML(kr)).append("</p>");
    831         } else {
    832             buf.append("<p class=\"sybil_filler\"><b>Routers:</b> ").append(_t("n/a")).append("</p>");
     836        //} else {
     837        //    buf.append("<p class=\"sybil_filler\"><b>Routers:</b> ").append(_t("n/a")).append("</p>");
    833838        }
    834839        String kls = info.getOption("netdb.knownLeaseSets");
    835840        if (kls != null) {
    836841            buf.append("<p class=\"sybilinfo_leasesets\"><b>").append(_t("LeaseSets")).append(":</b> ").append(DataHelper.stripHTML(kls)).append("</p>\n");
    837         } else {
    838             buf.append("<p class=\"sybilinfo_leasesets filler\"><b>").append(_t("LeaseSets")).append(":</b> ").append(_t("n/a")).append("</p>");
     842        //} else {
     843        //    buf.append("<p class=\"sybilinfo_leasesets filler\"><b>").append(_t("LeaseSets")).append(":</b> ").append(_t("n/a")).append("</p>");
    839844        }
    840845        String fam = info.getOption("family");
     
    873878                        long age = Math.max(now - heard, 1);
    874879                        buf.append("<p><b>").append(_t("Last Good Lookup")).append(":</b> ").append(_t("{0} ago", DataHelper.formatDuration2(age))).append("</p>");
    875                     } else {
    876                         buf.append("<p class=\"sybil_filler\"><b>").append(_t("Last Good Lookup")).append(":</b> ").append(_t("n/a")).append("</p>");
     880                    //} else {
     881                    //    buf.append("<p class=\"sybil_filler\"><b>").append(_t("Last Good Lookup")).append(":</b> ").append(_t("n/a")).append("</p>");
    877882                    }
    878883                    heard = dbh.getLastLookupFailed();
     
    880885                        long age = Math.max(now - heard, 1);
    881886                        buf.append("<p><b>").append(_t("Last Bad Lookup")).append(":</b> ").append(_t("{0} ago", DataHelper.formatDuration2(age))).append("</p>");
    882                     } else {
    883                         buf.append("<p class=\"sybil_filler\"><b>").append(_t("Last Bad Lookup")).append(":</b> ").append(_t("n/a")).append("</p>");
     887                    //} else {
     888                    //    buf.append("<p class=\"sybil_filler\"><b>").append(_t("Last Bad Lookup")).append(":</b> ").append(_t("n/a")).append("</p>");
    884889                    }
    885890                    heard = dbh.getLastStoreSuccessful();
     
    887892                        long age = Math.max(now - heard, 1);
    888893                        buf.append("<p><b>").append(_t("Last Good Store")).append(":</b> ").append(_t("{0} ago", DataHelper.formatDuration2(age))).append("</p>");
    889                     } else {
    890                         buf.append("<p class=\"sybil_filler\"><b>").append(_t("Last Good Store")).append(":</b> ").append(_t("n/a")).append("</p>");
     894                    //} else {
     895                    //    buf.append("<p class=\"sybil_filler\"><b>").append(_t("Last Good Store")).append(":</b> ").append(_t("n/a")).append("</p>");
    891896                    }
    892897                    heard = dbh.getLastStoreFailed();
     
    894899                        long age = Math.max(now - heard, 1);
    895900                        buf.append("<p><b>").append(_t("Last Bad Store")).append(":</b> ").append(_t("{0} ago", DataHelper.formatDuration2(age))).append("</p>");
    896                     } else {
    897                         buf.append("<p class=\"sybil_filler\"><b>").append(_t("Last Bad Store")).append(":</b> ").append(_t("n/a")).append("</p>");
     901                    //} else {
     902                    //    buf.append("<p class=\"sybil_filler\"><b>").append(_t("Last Bad Store")).append(":</b> ").append(_t("n/a")).append("</p>");
    898903                    }
    899904                }
  • history.txt

    r10354df rf2f5df0  
     12019-05-19 zzz
     2 * Sybil: Run IP and family tests on all routers
     3
     42019-05-18 zzz
     5 * Javadoc: fixes from FreeBSD ports
     6 * Sybil:
     7   - Option to run on non-floodfills too
     8   - Show routers in analysis even if no RI available
     9   - Date format and reason text fixes
     10   - Add link to banlist
     11
     122019-05-15 zzz
     13 * EepGet: Don't continue when requested a partial but didn't
     14   get it, and the output is to a stream
     15 * Streaming: Fix NPE in debug logging (ticket #2504)
     16
     172019-05-14 zzz
     18 * Util: Don't set restrictive permissions on exported certs
     19
    1202019-05-13 zzz
    2  * Console: Hide transport table unless advanced
     21 * Console:
     22   - Hide transport table unless advanced
     23   - Prevent editing a client while it's starting
    324 * Sybil: Add support for auto-blocking
    425 * Tunnels: Fix connection checker for NTCP2
  • router/java/src/net/i2p/router/RouterVersion.java

    r10354df rf2f5df0  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 3;
     21    public final static long BUILD = 4;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.