Router: Update list of hidden mode countries

List updated using the Freedom in the World Index 2020
Force hidden mode routers to LU
Don't publish stats in first hour of uptime
Add H.323 to invalid ports list
Improve crashed message in event log
This commit is contained in:
zzz
2021-01-31 12:32:52 -05:00
parent 0b4fe1aa56
commit 20c7c8785b
6 changed files with 50 additions and 13 deletions

View File

@@ -1159,7 +1159,8 @@ public class Router implements RouterClock.ClockShiftListener {
*/
public String getCapabilities() {
StringBuilder rv = new StringBuilder(4);
char bw = getBandwidthClass();
boolean hidden = isHidden();
char bw = hidden ? CAPABILITY_BW32 : getBandwidthClass();
rv.append(bw);
// 512 and unlimited supported as of 0.9.18;
// Add 256 as well for compatibility
@@ -1174,7 +1175,7 @@ public class Router implements RouterClock.ClockShiftListener {
if(_context.getBooleanProperty(PROP_HIDDEN))
rv.append(RouterInfo.CAPABILITY_HIDDEN);
if (_context.getBooleanProperty(PROP_FORCE_UNREACHABLE)) {
if (hidden || _context.getBooleanProperty(PROP_FORCE_UNREACHABLE)) {
rv.append(CAPABILITY_UNREACHABLE);
return rv.toString();
}
@@ -1935,9 +1936,10 @@ public class Router implements RouterClock.ClockShiftListener {
}
if (downtime > LIVELINESS_DELAY) {
System.err.println("WARN: Old router was not shut down gracefully, deleting " + f);
if (lastWritten > 0)
_eventLog.addEvent(EventLog.CRASHED, (downtime / 60000) + " minutes ago");
f.delete();
if (lastWritten > 0)
_eventLog.addEvent(EventLog.CRASHED,
Translate.getString("{0} ago", DataHelper.formatDuration2(downtime), _context, "net.i2p.router.web.messages"));
} else {
return false;
}

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 = 14;
public final static long BUILD = 15;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -77,9 +77,9 @@ public class StatisticsManager {
stats.setProperty(RouterInfo.PROP_CAPABILITIES, _context.router().getCapabilities());
if (_context.getBooleanPropertyDefaultTrue(PROP_PUBLISH_RANKINGS) &&
_context.random().nextInt(RANDOM_INCLUDE_STATS) == 0) {
//long publishedUptime = _context.router().getUptime();
// Don't publish these for first hour
_context.random().nextInt(RANDOM_INCLUDE_STATS) == 0 &&
_context.router().getUptime() > 62*60*1000) {
// Disabled in 0.9
//if (publishedUptime > 62*60*1000)
// includeAverageThroughput(stats);

View File

@@ -14,9 +14,11 @@ public abstract class StrictCountries {
private static final Set<String> _countries;
// List updated using the Freedom in the World Index 2019
// https://freedomhouse.org/report/countries-world-freedom-2019
// General guidance: Include countries with a Civil Liberties (CL) score of 6 or 7.
// List updated using the Freedom in the World Index 2020
// https://freedomhouse.org/
// General guidance: Include countries with a Civil Liberties (CL) score of 16 or less
// (equivalent to a CL rating of 6 or 7 in their raw data)
// or a Internet Freedom score of 39 or less (not free)
static {
String[] c = {
@@ -37,12 +39,14 @@ public abstract class StrictCountries {
/* Eritrea */ "ER",
/* Ethiopia */ "ET",
/* Iran */ "IR",
/* Iraq */ "IQ",
/* Kazakhstan */ "KZ",
/* Laos */ "LA",
/* Libya */ "LY",
/* Myanmar */ "MM",
/* North Korea */ "KP",
/* Palestinian Territories */ "PS",
/* Pakistan */ "PK",
/* Rwanda */ "RW",
/* Saudi Arabia */ "SA",
/* Somalia */ "SO",
@@ -57,6 +61,7 @@ public abstract class StrictCountries {
/* Venezuela */ "VE",
/* United Arab Emirates */ "AE",
/* Uzbekistan */ "UZ",
/* Vietnam */ "VN",
/* Western Sahara */ "EH",
/* Yemen */ "YE"
};

View File

@@ -241,6 +241,8 @@ public abstract class TransportUtil {
return port >= 1024 &&
port <= 65535 &&
port != 1900 && // UPnP SSDP
port != 1719 && // H.323
port != 1720 && // H.323
port != 2049 && // NFS
port != 2827 && // BOB
port != 3659 && // Apple-sasl
@@ -270,7 +272,7 @@ public abstract class TransportUtil {
*/
public static void logInvalidPort(Log log, String transportStyle, int port) {
log.error("Specified " + transportStyle + " port " + port + " is not valid, selecting a new port");
log.error("Invalid ports are: 0-1023, 1900, 2049, 2827, 3659, 4045, 4444, 4445, 5060, 5061, 6000, 6665-6669, 6697, 7650-7668, 8998, 9001, 9030, 9050, 9100, 9150, 31000, 32000, 65536+");
log.error("Invalid ports are: 0-1023, 1719, 1720, 1900, 2049, 2827, 3659, 4045, 4444, 4445, 5060, 5061, 6000, 6665-6669, 6697, 7650-7668, 8998, 9001, 9030, 9050, 9100, 9150, 31000, 32000, 65536+");
}
/**