Build: More prep for different release and API versions

Use API version as manifest Specification-Version
Use API version in I2CP
Reduce sybil penalty for version and banlist
This commit is contained in:
zzz
2021-02-23 10:43:32 -05:00
parent 58e5c55cfd
commit 6e2292354a
11 changed files with 77 additions and 30 deletions

View File

@@ -18,11 +18,13 @@ package net.i2p;
public class CoreVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String ID = "Git";
/**
* The version used when checking for router updates,
* and exchanged between router and client over I2CP.
* This is the marketing and user-visible version.
*
* If we ever need a point release for a specific
* architecture only, append ".1" to VERSION
* and leave PUBLISHED_VERSION unchanged.
@@ -33,6 +35,11 @@ public class CoreVersion {
/**
* The version published in the netdb via StatisticsManager.
* This is the API version.
* It must not go to 1.x for several years, because through
* 0.9.49, the Sybil analyzer blocked releases that didn't
* start with "0.9."
*
* If we ever need a point release for a specific
* architecture only, append ".1" to VERSION
* and leave PUBLISHED_VERSION unchanged.
@@ -41,7 +48,7 @@ public class CoreVersion {
*
* @since 0.9.46
*/
public final static String PUBLISHED_VERSION = VERSION;
public final static String PUBLISHED_VERSION = "0.9.49";
/**
* For Vuze.
@@ -54,6 +61,7 @@ public class CoreVersion {
public static void main(String args[]) {
System.out.println("I2P Core version: " + VERSION);
System.out.println("I2P API version: " + PUBLISHED_VERSION);
System.out.println("ID: " + ID);
}
}

View File

@@ -769,7 +769,7 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
auth.setProperty(I2PClient.PROP_USER, _options.getProperty(I2PClient.PROP_USER));
auth.setProperty(I2PClient.PROP_PW, _options.getProperty(I2PClient.PROP_PW));
}
sendMessage_unchecked(new GetDateMessage(CoreVersion.VERSION, auth));
sendMessage_unchecked(new GetDateMessage(CoreVersion.PUBLISHED_VERSION, auth));
waitForDate();
if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "Before producer.connect()");
@@ -1880,7 +1880,7 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
*/
public String getRouterVersion() {
if (_context.isRouterContext())
return CoreVersion.VERSION;
return CoreVersion.PUBLISHED_VERSION;
return _routerVersion;
}

View File

@@ -123,11 +123,11 @@ public class I2PSimpleSession extends I2PSessionImpl2 {
Properties auth = new OrderedProperties();
auth.setProperty(I2PClient.PROP_USER, opts.getProperty(I2PClient.PROP_USER));
auth.setProperty(I2PClient.PROP_PW, opts.getProperty(I2PClient.PROP_PW));
sendMessage_unchecked(new GetDateMessage(CoreVersion.VERSION, auth));
sendMessage_unchecked(new GetDateMessage(CoreVersion.PUBLISHED_VERSION, auth));
} else {
// we must now send a GetDate even in SimpleSession, or we won't know
// what version we are talking with and cannot use HostLookup
sendMessage_unchecked(new GetDateMessage(CoreVersion.VERSION));
sendMessage_unchecked(new GetDateMessage(CoreVersion.PUBLISHED_VERSION));
}
waitForDate();
}