Changeset 3846e08
- Timestamp:
- Dec 22, 2016 12:46:38 PM (4 years ago)
- Branches:
- master
- Children:
- 63a2a6d
- Parents:
- e625e67b
- Location:
- router/java/src/net/i2p/router
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
router/java/src/net/i2p/router/Blocklist.java
re625e67b r3846e08 80 80 // temp 81 81 private Map<Hash, String> _peerBlocklist = new HashMap<Hash, String>(4); 82 83 private static final String PROP_BLOCKLIST_ENABLED = "router.blocklist.enable"; 84 private static final String PROP_BLOCKLIST_DETAIL = "router.blocklist.detail"; 85 private static final String PROP_BLOCKLIST_FILE = "router.blocklist.file"; 86 private static final String BLOCKLIST_FILE_DEFAULT = "blocklist.txt"; 87 private static final String BLOCKLIST_FEED_FILE = "docs/feed/blocklist/blocklist.txt"; 82 88 83 89 /** … … 106 112 _blocklistFeedFile = new File(BLOCKLIST_FEED_FILE); 107 113 } 108 109 private static final String PROP_BLOCKLIST_ENABLED = "router.blocklist.enable";110 private static final String PROP_BLOCKLIST_DETAIL = "router.blocklist.detail";111 private static final String PROP_BLOCKLIST_FILE = "router.blocklist.file";112 private static final String BLOCKLIST_FILE_DEFAULT = "blocklist.txt";113 private static final String BLOCKLIST_FEED_FILE = "docs/feed/blocklist/blocklist.txt";114 114 115 115 /** … … 657 657 if (pinfo == null) 658 658 return Collections.emptyList(); 659 return getAddresses(pinfo); 660 } 661 662 /** 663 * Will not contain duplicates. 664 * @since 0.9.29 665 */ 666 private static List<byte[]> getAddresses(RouterInfo pinfo) { 659 667 List<byte[]> rv = new ArrayList<byte[]>(4); 660 668 // for each peer address … … 686 694 for (byte[] ip : ips) { 687 695 if (isBlocklisted(ip)) { 696 if (! _context.banlist().isBanlisted(peer)) 697 // nice knowing you... 698 banlist(peer, ip); 699 return true; 700 } 701 } 702 return false; 703 } 704 705 /** 706 * Does the peer's IP address appear in the blocklist? 707 * If so, and it isn't banlisted, banlist it forever... 708 * @since 0.9.29 709 */ 710 public boolean isBlocklisted(RouterInfo pinfo) { 711 List<byte[]> ips = getAddresses(pinfo); 712 if (ips.isEmpty()) 713 return false; 714 for (byte[] ip : ips) { 715 if (isBlocklisted(ip)) { 716 Hash peer = pinfo.getHash(); 688 717 if (! _context.banlist().isBanlisted(peer)) 689 718 // nice knowing you... -
router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java
re625e67b r3846e08 161 161 if (prevNetDb == null) { 162 162 if ((!getContext().banlist().isBanlistedForever(key)) && 163 getContext().blocklist().isBlocklisted( key) &&163 getContext().blocklist().isBlocklisted(ri) && 164 164 _log.shouldLog(Log.WARN)) 165 165 _log.warn("Blocklisting new peer " + key + ' ' + ri); … … 169 169 if ((!newAddr.equals(oldAddr)) && 170 170 (!getContext().banlist().isBanlistedForever(key)) && 171 getContext().blocklist().isBlocklisted( key) &&171 getContext().blocklist().isBlocklisted(ri) && 172 172 _log.shouldLog(Log.WARN)) 173 173 _log.warn("New address received, Blocklisting old peer " + key + ' ' + ri);
Note: See TracChangeset
for help on using the changeset viewer.