Changeset 8840532
- Timestamp:
- May 13, 2019 1:28:04 PM (22 months ago)
- Branches:
- master
- Children:
- 0531801
- Parents:
- 48a92ca
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/routerconsole/java/src/net/i2p/router/sybil/Analysis.java
r48a92ca r8840532 88 88 private static final double POINTS_NEW = 4.0; 89 89 private static final double POINTS_BANLIST = 25.0; 90 private static final double DEFAULT_BLOCK_THRESHOLD = 50.0; 91 private static final long DEFAULT_BLOCK_TIME = 7*24*60*60*1000L; 92 public static final float MIN_BLOCK_POINTS = 12.01f; 90 93 91 94 /** Get via getInstance() */ … … 340 343 addProfilePoints(ris, points); 341 344 addVersionPoints(ris, points); 345 if (_context.getBooleanProperty(PROP_BLOCK)) 346 doBlocking(points); 342 347 return points; 348 } 349 350 /** 351 * Blocklist and Banlist if configured 352 * @since 0.9.41 353 */ 354 private void doBlocking(Map<Hash, Points> points) { 355 double threshold = DEFAULT_BLOCK_THRESHOLD; 356 long blockUntil = _context.getProperty(Analysis.PROP_BLOCKTIME, DEFAULT_BLOCK_TIME) + _context.clock().now(); 357 try { 358 threshold = Double.parseDouble(_context.getProperty(PROP_THRESHOLD, Double.toString(DEFAULT_BLOCK_THRESHOLD))); 359 if (threshold < MIN_BLOCK_POINTS) 360 threshold = MIN_BLOCK_POINTS; 361 } catch (NumberFormatException nfe) {} 362 for (Map.Entry<Hash, Points> e : points.entrySet()) { 363 double p = e.getValue().getPoints(); 364 if (p >= threshold) { 365 Hash h = e.getKey(); 366 RouterInfo ri = _context.netDb().lookupRouterInfoLocally(h); 367 if (ri != null) { 368 for (RouterAddress ra : ri.getAddresses()) { 369 byte[] ip = ra.getIP(); 370 if (ip != null) 371 _context.blocklist().add(ip); 372 } 373 } 374 String reason = "Sybil analysis with " + fmt.format(p) + " threat points"; 375 _context.banlist().banlistRouter(h, reason, null, null, blockUntil); 376 } 377 } 343 378 } 344 379 -
apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbHelper.java
r48a92ca r8840532 233 233 String thresh = getJettyString("threshold"); 234 234 if (thresh != null && thresh.length() > 0) { 235 float val = Float.parseFloat(thresh);235 float val = Math.max(Float.parseFloat(thresh), Analysis.MIN_BLOCK_POINTS); 236 236 toSave.put(Analysis.PROP_THRESHOLD, Float.toString(val)); 237 237 } -
apps/routerconsole/java/src/net/i2p/router/web/helpers/SybilRenderer.java
r48a92ca r8840532 302 302 boolean auto = _context.getBooleanProperty(Analysis.PROP_BLOCK); 303 303 String thresh = _context.getProperty(Analysis.PROP_THRESHOLD, "50"); 304 long days = 7; 305 String time = _context.getProperty(Analysis.PROP_BLOCKTIME); 306 if (time != null) { 307 try { 308 days = Long.parseLong(time) / (24*60*60*1000L); 309 } catch (NumberFormatException nfe) {} 310 } 304 long days = _context.getProperty(Analysis.PROP_BLOCKTIME, 7*24*60*60*1000L) / (24*60*60*1000L); 311 305 buf.append("</select></td></tr>\n<tr><td>" + 312 306 "Auto-block routers?</td><td><input type=\"checkbox\" class=\"optbox\" value=\"1\" name=\"block\" "); -
history.txt
r48a92ca r8840532 1 2019-05-13 zzz 2 * Console: Hide transport table unless advanced 3 * Sybil: Add support for auto-blocking 4 * Tunnels: Fix connection checker for NTCP2 5 6 2019-05-12 zzz 7 * Jetty: Fix webapps in eepsite (ticket #2477) 8 * Util: Consolidate Java version checking code, fix bugs 9 1 10 2019-05-11 zzz 2 11 * Utils: Allow absolute path to certs in I2PSSLSocketFactory -
router/java/src/net/i2p/router/RouterVersion.java
r48a92ca r8840532 19 19 public final static String ID = "Monotone"; 20 20 public final static String VERSION = CoreVersion.VERSION; 21 public final static long BUILD = 2;21 public final static long BUILD = 3; 22 22 23 23 /** for example "-test" */
Note: See TracChangeset
for help on using the changeset viewer.