Changeset 5d06de8
- Timestamp:
- Dec 14, 2018 4:54:10 PM (2 years ago)
- Branches:
- master
- Children:
- 3054a24
- Parents:
- 468871f
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/routerconsole/java/src/net/i2p/router/web/helpers/SybilRenderer.java
r468871f r5d06de8 31 31 import net.i2p.router.peermanager.DBHistory; 32 32 import net.i2p.router.peermanager.PeerProfile; 33 import net.i2p.router.sybil.Points; 33 34 import net.i2p.router.tunnel.pool.TunnelPool; 34 35 import net.i2p.router.util.HashDistance; … … 51 52 * 52 53 */ 53 class SybilRenderer {54 public class SybilRenderer { 54 55 55 56 private final RouterContext _context; … … 103 104 } 104 105 105 /**106 * A total score and a List of reason Strings107 */108 public static class Points implements Comparable<Points> {109 private double points;110 private final List<String> reasons;111 112 public Points(double points, String reason) {113 this.points = points;114 reasons = new ArrayList<String>(4);115 reasons.add(reason);116 }117 public int compareTo(Points r) {118 return Double.compare(points, r.points);119 }120 }121 122 106 private static class PointsComparator implements Comparator<Hash>, Serializable { 123 107 private final Map<Hash, Points> _points; … … 160 144 * points1 is unmodified. 161 145 */ 146 /**** 162 147 private void mergePoints(Map<Hash, Points> points1, Map<Hash, Points> points2) { 163 148 for (Map.Entry<Hash, Points> e : points1.entrySet()) { … … 173 158 } 174 159 } 175 160 ****/ 161 162 /** */ 176 163 private void addPoints(Map<Hash, Points> points, Hash h, double d, String reason) { 177 String rsn = fmt.format(d) + ": " + reason;178 164 Points dd = points.get(h); 179 165 if (dd != null) { 180 dd.points += d; 181 dd.reasons.add(rsn); 166 dd.addPoints(d, reason); 182 167 } else { 183 points.put(h, new Points(d, r sn));168 points.put(h, new Points(d, reason)); 184 169 } 185 170 } … … 324 309 continue; 325 310 Points pp = points.get(h); 326 double p = pp. points;311 double p = pp.getPoints(); 327 312 if (p < MIN_DISPLAY_POINTS) 328 313 break; // sorted 329 314 buf.append("<p class=\"threatpoints\"><b>Threat Points: " + fmt.format(p) + "</b></p><ul>"); 330 if (pp.reasons.size() > 1) 331 Collections.sort(pp.reasons, new ReasonComparator()); 332 for (String s : pp.reasons) { 315 List<String> reasons = pp.getReasons(); 316 if (reasons.size() > 1) 317 Collections.sort(reasons, new ReasonComparator()); 318 for (String s : reasons) { 333 319 int c = s.indexOf(':'); 334 320 if (c <= 0) -
build.xml
r468871f r5d06de8 826 826 <group title="Streaming Library" packages="net.i2p.client.streaming:net.i2p.client.streaming.impl" /> 827 827 <group title="Router" packages="net.i2p.router:net.i2p.router.*:net.i2p.data.i2np:net.i2p.data.router:org.cybergarage:org.cybergarage.*:org.freenetproject:org.xlattice.crypto.filters:com.maxmind.*:com.southernstorm.noise.*" /> 828 <group title="Router Console" packages="net.i2p.router.web:net.i2p.router.web.*:net.i2p.router.update: edu.internet2.ndt:net.i2p.router.news:com.vuze.*" />828 <group title="Router Console" packages="net.i2p.router.web:net.i2p.router.web.*:net.i2p.router.update:net.i2p.router.sybil:edu.internet2.ndt:net.i2p.router.news:com.vuze.*" /> 829 829 <!-- apps and bridges starting here, alphabetical please --> 830 830 <group title="Addressbook Application" packages="net.i2p.addressbook:net.i2p.router.naming:net.metanotion:net.metanotion.*" />
Note: See TracChangeset
for help on using the changeset viewer.