* Blocklist: Include IP in shitlist reason

This commit is contained in:
zzz
2011-09-08 14:20:19 +00:00
parent f3521228e9
commit 0a83510690
3 changed files with 22 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2011-09-08 zzz
* Blocklist: Include IP in shitlist reason
* Ministreaming: Drop old classes replaced by streaming
years ago.
* NTCP: Hopefully fix race NPE, thx devzero
* Tunnels: Limit Bloom filter size based on max memory
2011-09-07 zzz
* Console: Limit max displayed participating tunnels
* JobQueue: Change queue from a Set to a TreeSet for more efficiency
@ -6,7 +13,7 @@
time List for space savings.
2011-09-06 zzz
* Console: Move configservice.jsp rendering code from
* Console: Move jobs.jsp rendering code from
the router to the console
* Crypto: Rework use of SHA256 for efficiency and
to avoid clogging the Hash cache with one-time hashes,

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 13;
public final static long BUILD = 14;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -13,9 +13,9 @@ import net.i2p.util.DecayingHashSet;
*
*/
public class BloomFilterIVValidator implements IVValidator {
private RouterContext _context;
private DecayingBloomFilter _filter;
private ByteCache _ivXorCache = ByteCache.getInstance(32, HopProcessor.IV_LENGTH);
private final RouterContext _context;
private final DecayingBloomFilter _filter;
private final ByteCache _ivXorCache = ByteCache.getInstance(32, HopProcessor.IV_LENGTH);
/**
* After 2*halflife, an entry is completely forgotten from the bloom filter.
@ -27,18 +27,24 @@ public class BloomFilterIVValidator implements IVValidator {
private static final int MIN_SHARE_KBPS_TO_USE_BLOOM = 64;
private static final int MIN_SHARE_KBPS_FOR_BIG_BLOOM = 512;
private static final int MIN_SHARE_KBPS_FOR_HUGE_BLOOM = 1536;
private static final long MIN_MEM_TO_USE_BLOOM = 64*1024*1024l;
private static final long MIN_MEM_FOR_BIG_BLOOM = 128*1024*1024l;
private static final long MIN_MEM_FOR_HUGE_BLOOM = 256*1024*1024l;
public BloomFilterIVValidator(RouterContext ctx, int KBps) {
_context = ctx;
// Select the filter based on share bandwidth.
// Select the filter based on share bandwidth and memory.
// Note that at rates above 512KB, we increase the filter size
// to keep acceptable false positive rates.
// See DBF, BloomSHA1, and KeySelector for details.
if (KBps < MIN_SHARE_KBPS_TO_USE_BLOOM)
long maxMemory = Runtime.getRuntime().maxMemory();
if (maxMemory == Long.MAX_VALUE)
maxMemory = 96*1024*1024l;
if (KBps < MIN_SHARE_KBPS_TO_USE_BLOOM || maxMemory < MIN_MEM_TO_USE_BLOOM)
_filter = new DecayingHashSet(ctx, HALFLIFE_MS, 16, "TunnelIVV"); // appx. 4MB max
else if (KBps >= MIN_SHARE_KBPS_FOR_HUGE_BLOOM)
else if (KBps >= MIN_SHARE_KBPS_FOR_HUGE_BLOOM && maxMemory >= MIN_MEM_FOR_HUGE_BLOOM)
_filter = new DecayingBloomFilter(ctx, HALFLIFE_MS, 16, "TunnelIVV", 25); // 8MB fixed
else if (KBps >= MIN_SHARE_KBPS_FOR_BIG_BLOOM)
else if (KBps >= MIN_SHARE_KBPS_FOR_BIG_BLOOM && maxMemory >= MIN_MEM_FOR_BIG_BLOOM)
_filter = new DecayingBloomFilter(ctx, HALFLIFE_MS, 16, "TunnelIVV", 24); // 4MB fixed
else
_filter = new DecayingBloomFilter(ctx, HALFLIFE_MS, 16, "TunnelIVV"); // 2MB fixed