forked from I2P_Developers/i2p.i2p
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
This commit is contained in:
11
history.txt
11
history.txt
@@ -1,3 +1,14 @@
|
|||||||
|
2014-10-10 zzz
|
||||||
|
* Banlist: Remove unused banlist tracking in the profile
|
||||||
|
causing deadlock (ticket #1394)
|
||||||
|
* 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
|
||||||
|
|
||||||
|
2014-10-08 zzz
|
||||||
|
* UPnP: Comment out unused parsers
|
||||||
|
|
||||||
2014-10-07 zzz
|
2014-10-07 zzz
|
||||||
* CPUID: Remove Intel model 2 again, this is spoofed in the VM
|
* CPUID: Remove Intel model 2 again, this is spoofed in the VM
|
||||||
* Graphs: Catch an error caused by missing fonts
|
* Graphs: Catch an error caused by missing fonts
|
||||||
|
@@ -14,6 +14,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.i2p.data.Hash;
|
import net.i2p.data.Hash;
|
||||||
import net.i2p.data.router.RouterAddress;
|
import net.i2p.data.router.RouterAddress;
|
||||||
|
import net.i2p.data.router.RouterInfo;
|
||||||
import net.i2p.router.transport.Transport;
|
import net.i2p.router.transport.Transport;
|
||||||
import net.i2p.router.transport.crypto.DHSessionKeyBuilder;
|
import net.i2p.router.transport.crypto.DHSessionKeyBuilder;
|
||||||
|
|
||||||
@@ -73,6 +74,12 @@ public abstract class CommSystemFacade implements Service {
|
|||||||
/** @since 0.8.13 */
|
/** @since 0.8.13 */
|
||||||
public boolean isInBadCountry() { return false; }
|
public boolean isInBadCountry() { return false; }
|
||||||
|
|
||||||
|
/** @since 0.9.16 */
|
||||||
|
public boolean isInBadCountry(Hash peer) { return false; }
|
||||||
|
|
||||||
|
/** @since 0.9.16 */
|
||||||
|
public boolean isInBadCountry(RouterInfo ri) { return false; }
|
||||||
|
|
||||||
public String getCountry(Hash peer) { return null; }
|
public String getCountry(Hash peer) { return null; }
|
||||||
public String getCountryName(String code) { return code; }
|
public String getCountryName(String code) { return code; }
|
||||||
public String renderPeerHTML(Hash peer) {
|
public String renderPeerHTML(Hash peer) {
|
||||||
|
@@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 7;
|
public final static long BUILD = 8;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
@@ -85,6 +85,9 @@ class FloodfillMonitorJob extends JobImpl {
|
|||||||
if (SystemVersion.isARM())
|
if (SystemVersion.isARM())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (getContext().commSystem().isInBadCountry())
|
||||||
|
return false;
|
||||||
|
|
||||||
// Only if up a while...
|
// Only if up a while...
|
||||||
if (getContext().router().getUptime() < MIN_UPTIME)
|
if (getContext().router().getUptime() < MIN_UPTIME)
|
||||||
return false;
|
return false;
|
||||||
|
@@ -245,6 +245,10 @@ class FloodfillPeerSelector extends PeerSelector {
|
|||||||
badff.add(entry);
|
badff.add(entry);
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Old: " + entry);
|
_log.debug("Old: " + entry);
|
||||||
|
} else if (info != null && _context.commSystem().isInBadCountry(info)) {
|
||||||
|
badff.add(entry);
|
||||||
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("Bad country: " + entry);
|
||||||
} else {
|
} else {
|
||||||
PeerProfile prof = _context.profileOrganizer().getProfile(entry);
|
PeerProfile prof = _context.profileOrganizer().getProfile(entry);
|
||||||
double maxGoodRespTime = MAX_GOOD_RESP_TIME;
|
double maxGoodRespTime = MAX_GOOD_RESP_TIME;
|
||||||
|
@@ -1404,7 +1404,8 @@ public class ProfileOrganizer {
|
|||||||
// if not selectable for a tunnel (banlisted for example),
|
// if not selectable for a tunnel (banlisted for example),
|
||||||
// don't allow them in the high-cap pool, what would the point of that be?
|
// don't allow them in the high-cap pool, what would the point of that be?
|
||||||
if (_thresholdCapacityValue <= profile.getCapacityValue() &&
|
if (_thresholdCapacityValue <= profile.getCapacityValue() &&
|
||||||
isSelectable(peer)) {
|
isSelectable(peer) &&
|
||||||
|
!_context.commSystem().isInBadCountry(peer)) {
|
||||||
_highCapacityPeers.put(peer, profile);
|
_highCapacityPeers.put(peer, profile);
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("High capacity: \t" + peer);
|
_log.debug("High capacity: \t" + peer);
|
||||||
|
@@ -343,15 +343,42 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
|||||||
* Are we in a bad place
|
* Are we in a bad place
|
||||||
* @since 0.8.13
|
* @since 0.8.13
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isInBadCountry() {
|
public boolean isInBadCountry() {
|
||||||
String us = getOurCountry();
|
String us = getOurCountry();
|
||||||
return us != null && (BadCountries.contains(us) || _context.getBooleanProperty("router.forceBadCountry"));
|
return (us != null && BadCountries.contains(us)) || _context.getBooleanProperty("router.forceBadCountry");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are they in a bad place
|
||||||
|
* @param peer non-null
|
||||||
|
* @since 0.9.16
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isInBadCountry(Hash peer) {
|
||||||
|
String c = getCountry(peer);
|
||||||
|
return c != null && BadCountries.contains(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are they in a bad place
|
||||||
|
* @param ri non-null
|
||||||
|
* @since 0.9.16
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isInBadCountry(RouterInfo ri) {
|
||||||
|
byte[] ip = getIP(ri);
|
||||||
|
if (ip == null)
|
||||||
|
return false;
|
||||||
|
String c = _geoIP.get(ip);
|
||||||
|
return c != null && BadCountries.contains(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses the transport IP first because that lookup is fast,
|
* Uses the transport IP first because that lookup is fast,
|
||||||
* then the IP from the netDb.
|
* then the IP from the netDb.
|
||||||
*
|
*
|
||||||
|
* @param peer not ourselves - use getOurCountry() for that
|
||||||
* @return two-letter lower-case country code or null
|
* @return two-letter lower-case country code or null
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user