propagate from branch 'i2p.i2p' (head e02e6d733a703970e20e732e5156cbabc394e88e)

to branch 'i2p.i2p.str4d.eddsa' (head 3910d01bed7c5a216f52bfd1d9fd96b59f058745)
This commit is contained in:
str4d
2014-07-10 09:29:34 +00:00
152 changed files with 2430 additions and 1328 deletions

View File

@@ -25,6 +25,7 @@
<isfalse value="${require.gettext}" />
</condition>
<!-- only used if not set by a higher build.xml -->
<property name="javac.compilerargs" value="" />
<property name="javac.version" value="1.6" />
<property name="require.gettext" value="true" />
@@ -34,7 +35,7 @@
<mkdir dir="./build/obj" />
<javac
srcdir="./src"
debug="true" deprecation="on" source="1.5" target="1.5"
debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
destdir="./build/obj"
includeAntRuntime="false"
classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" >
@@ -281,7 +282,7 @@
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<!-- We need the ant runtime, as it includes junit -->
<javac srcdir="./src:./test/junit" debug="true" source="1.5" target="1.5"
<javac srcdir="./src:./test/junit" debug="true" source="${javac.version}" target="${javac.version}"
includeAntRuntime="true"
deprecation="on" destdir="./build/obj" >
<compilerarg line="${javac.compilerargs}" />

View File

@@ -1247,11 +1247,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
if(host.length() == 60 && host.toLowerCase(Locale.US).endsWith(".b32.i2p")) {
return host;
}
Destination _dest = _context.namingService().lookup(host);
if(_dest == null) {
Destination dest = _context.namingService().lookup(host);
if (dest == null)
return "i2p";
}
return Base32.encode(_dest.calculateHash().getData()) + ".b32.i2p";
return dest.toBase32();
}
public static final String DEFAULT_JUMP_SERVERS =

View File

@@ -646,7 +646,7 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
/**
* @param jumpServers comma- or space-separated list, or null
* @param msg extra message
* @param extraMessage extra message
* @since 0.9.14
*/
protected void writeErrorMessage(byte[] errMessage, String extraMessage,

View File

@@ -30,7 +30,6 @@ import net.i2p.util.ByteCache;
import net.i2p.util.EventDispatcher;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
import net.i2p.data.Base32;
/**
* Simple extension to the I2PTunnelServer that filters the HTTP
@@ -249,7 +248,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
}
addEntry(headers, HASH_HEADER, peerHash.toBase64());
addEntry(headers, DEST32_HEADER, Base32.encode(peerHash.getData()) + ".b32.i2p");
addEntry(headers, DEST32_HEADER, socket.getPeerDestination().toBase32());
addEntry(headers, DEST64_HEADER, socket.getPeerDestination().toBase64());
// Port-specific spoofhost

View File

@@ -10,7 +10,6 @@ import java.util.StringTokenizer;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketAddress;
import net.i2p.data.Base32;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.i2ptunnel.irc.DCCClientManager;
@@ -239,7 +238,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase {
}
public String getB32Hostname() {
return Base32.encode(sockMgr.getSession().getMyDestination().calculateHash().getData()) + ".b32.i2p";
return sockMgr.getSession().getMyDestination().toBase32();
}
public byte[] getLocalAddress() {

View File

@@ -14,7 +14,6 @@ import net.i2p.client.I2PClient;
import net.i2p.client.I2PClientFactory;
import net.i2p.client.I2PSession;
import net.i2p.crypto.SigType;
import net.i2p.data.Base32;
import net.i2p.data.Destination;
import net.i2p.i2ptunnel.socks.I2PSOCKSTunnel;
import net.i2p.util.FileUtil;
@@ -156,7 +155,7 @@ public class TunnelController implements Logging {
log("Private key created and saved in " + keyFile.getAbsolutePath());
log("You should backup this file in a secure place.");
log("New destination: " + destStr);
String b32 = Base32.encode(dest.calculateHash().getData()) + ".b32.i2p";
String b32 = dest.toBase32();
log("Base32: " + b32);
File backupDir = new SecureFile(I2PAppContext.getGlobalContext().getConfigDir(), KEY_BACKUP_DIR);
if (backupDir.isDirectory() || backupDir.mkdir()) {
@@ -633,6 +632,9 @@ public class TunnelController implements Logging {
return null;
}
/**
* @return "{52 chars}.b32.i2p" or null
*/
public String getMyDestHashBase32() {
if (_tunnel != null) {
List<I2PSession> sessions = _tunnel.getSessions();
@@ -640,7 +642,7 @@ public class TunnelController implements Logging {
I2PSession session = sessions.get(i);
Destination dest = session.getMyDestination();
if (dest != null)
return Base32.encode(dest.calculateHash().getData());
return dest.toBase32();
}
}
return null;

View File

@@ -1,7 +1,6 @@
package net.i2p.i2ptunnel.socks;
import net.i2p.I2PAppContext;
import net.i2p.data.Base32;
import net.i2p.data.Destination;
/**
@@ -44,7 +43,7 @@ public class SOCKSHeader {
}
private static final byte[] beg = {0,0,0,3,60};
private static final byte[] end = {'.','b','3','2','.','i','2','p',0,0};
private static final byte[] end = {0,0};
/**
* Make a dummy header from a dest,
@@ -52,11 +51,11 @@ public class SOCKSHeader {
* Unused for now.
*/
public SOCKSHeader(Destination dest) {
this.header = new byte[beg.length + 52 + end.length];
this.header = new byte[beg.length + 60 + end.length];
System.arraycopy(this.header, 0, beg, 0, beg.length);
String b32 = Base32.encode(dest.calculateHash().getData());
System.arraycopy(this.header, beg.length, b32.getBytes(), 0, 52);
System.arraycopy(this.header, beg.length + 52, end, 0, end.length);
String b32 = dest.toBase32();
System.arraycopy(this.header, beg.length, b32.getBytes(), 0, 60);
System.arraycopy(this.header, beg.length + 60, end, 0, end.length);
}
public String getHost() {

View File

@@ -25,7 +25,6 @@ import net.i2p.I2PAppContext;
import net.i2p.app.ClientAppManager;
import net.i2p.app.Outproxy;
import net.i2p.client.I2PClient;
import net.i2p.data.Base32;
import net.i2p.data.Certificate;
import net.i2p.data.Destination;
import net.i2p.data.PrivateKeyFile;
@@ -649,6 +648,9 @@ public class IndexBean {
return "";
}
/**
* @return "{52 chars}.b32.i2p" or ""
*/
public String getDestHashBase32(int tunnel) {
TunnelController tun = getController(tunnel);
if (tun != null) {
@@ -1127,7 +1129,7 @@ public class IndexBean {
return "Modification failed: " + e;
}
return "Destination modified - " +
"New Base32 is " + Base32.encode(newdest.calculateHash().getData()) + ".b32.i2p " +
"New Base32 is " + newdest.toBase32() +
"New Destination is " + newdest.toBase64();
}

View File

@@ -440,7 +440,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
</div>
<div id="destinationField" class="rowItem">
<label><%=intl._("Local Base 32")%>:</label>
<%=editBean.getDestHashBase32(curTunnel)%>.b32.i2p
<%=editBean.getDestHashBase32(curTunnel)%>
</div>
<% } // if destb64 %>

View File

@@ -134,10 +134,10 @@
<%
if (("httpserver".equals(indexBean.getInternalType(curServer)) || ("httpbidirserver".equals(indexBean.getInternalType(curServer)))) && indexBean.getTunnelStatus(curServer) == IndexBean.RUNNING) {
%><label><%=intl._("Preview")%>:</label>
<a class="control" title="Test HTTP server through I2P" href="http://<%=indexBean.getDestHashBase32(curServer)%>.b32.i2p" target="_top"><%=intl._("Preview")%></a>
<a class="control" title="Test HTTP server through I2P" href="http://<%=indexBean.getDestHashBase32(curServer)%>" target="_top"><%=intl._("Preview")%></a>
<%
} else if (indexBean.getTunnelStatus(curServer) == IndexBean.RUNNING) {
%><span class="text"><%=intl._("Base32 Address")%>:<br /><%=indexBean.getDestHashBase32(curServer)%>.b32.i2p</span>
%><span class="text"><%=intl._("Base32 Address")%>:<br /><%=indexBean.getDestHashBase32(curServer)%></span>
<%
} else {
%><span class="comment"><%=intl._("No Preview")%></span>