Changeset e081f94


Ignore:
Timestamp:
Oct 10, 2014 3:26:17 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
73256f6
Parents:
e96cc09
Message:

GeoIP:

  • Don't rate peers in some countries as high capacity
  • Don't enable auto-floodfill in some countries
  • Don't prefer floodfills in some countries
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    re96cc09 re081f94  
     12014-10-10 zzz
     2 * Banlist: Remove unused banlist tracking in the profile
     3   causing deadlock (ticket #1394)
     4 * GeoIP:
     5   - Don't rate peers in some countries as high capacity
     6   - Don't enable auto-floodfill in some countries
     7   - Don't prefer floodfills in some countries
     8
     92014-10-08 zzz
     10 * UPnP: Comment out unused parsers
     11
    1122014-10-07 zzz
    213 * CPUID: Remove Intel model 2 again, this is spoofed in the VM
  • router/java/src/net/i2p/router/CommSystemFacade.java

    re96cc09 re081f94  
    1515import net.i2p.data.Hash;
    1616import net.i2p.data.router.RouterAddress;
     17import net.i2p.data.router.RouterInfo;
    1718import net.i2p.router.transport.Transport;
    1819import net.i2p.router.transport.crypto.DHSessionKeyBuilder;
     
    7374    /** @since 0.8.13 */
    7475    public boolean isInBadCountry() { return false; }
     76
     77    /** @since 0.9.16 */
     78    public boolean isInBadCountry(Hash peer) { return false; }
     79
     80    /** @since 0.9.16 */
     81    public boolean isInBadCountry(RouterInfo ri) { return false; }
    7582
    7683    public String getCountry(Hash peer) { return null; }
  • router/java/src/net/i2p/router/RouterVersion.java

    re96cc09 re081f94  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 7;
     21    public final static long BUILD = 8;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillMonitorJob.java

    re96cc09 re081f94  
    8484        // ARM ElG decrypt is too slow
    8585        if (SystemVersion.isARM())
     86            return false;
     87
     88        if (getContext().commSystem().isInBadCountry())
    8689            return false;
    8790
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java

    re96cc09 re081f94  
    246246                if (_log.shouldLog(Log.DEBUG))
    247247                    _log.debug("Old: " + entry);
     248            } else if (info != null && _context.commSystem().isInBadCountry(info)) {
     249                badff.add(entry);
     250                if (_log.shouldLog(Log.DEBUG))
     251                    _log.debug("Bad country: " + entry);
    248252            } else {
    249253                PeerProfile prof = _context.profileOrganizer().getProfile(entry);
  • router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java

    re96cc09 re081f94  
    14051405            // don't allow them in the high-cap pool, what would the point of that be?
    14061406            if (_thresholdCapacityValue <= profile.getCapacityValue() &&
    1407                 isSelectable(peer)) {
     1407                isSelectable(peer) &&
     1408                !_context.commSystem().isInBadCountry(peer)) {
    14081409                _highCapacityPeers.put(peer, profile);
    14091410                if (_log.shouldLog(Log.DEBUG))
  • router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java

    re96cc09 re081f94  
    344344     *  @since 0.8.13
    345345     */
     346    @Override
    346347    public boolean isInBadCountry() {
    347348        String us = getOurCountry();
    348         return us != null && (BadCountries.contains(us) || _context.getBooleanProperty("router.forceBadCountry"));
     349        return (us != null && BadCountries.contains(us)) || _context.getBooleanProperty("router.forceBadCountry");
     350    }
     351
     352    /**
     353     *  Are they in a bad place
     354     *  @param peer non-null
     355     *  @since 0.9.16
     356     */
     357    @Override
     358    public boolean isInBadCountry(Hash peer) {
     359        String c = getCountry(peer);
     360        return c != null && BadCountries.contains(c);
     361    }
     362
     363    /**
     364     *  Are they in a bad place
     365     *  @param ri non-null
     366     *  @since 0.9.16
     367     */
     368    @Override
     369    public boolean isInBadCountry(RouterInfo ri) {
     370        byte[] ip = getIP(ri);
     371        if (ip == null)
     372            return false;
     373        String c = _geoIP.get(ip);
     374        return c != null && BadCountries.contains(c);
    349375    }
    350376
     
    353379     *  then the IP from the netDb.
    354380     *
     381     *  @param peer not ourselves - use getOurCountry() for that
    355382     *  @return two-letter lower-case country code or null
    356383     */
Note: See TracChangeset for help on using the changeset viewer.