* I2CP, HostsTxtNamingService, I2PTunnel:

Implement Base32 Hash hostnames, via the naming service.
      Names are of the form [52-characters].i2p, where
      the 52 characters are the Base32 representation of our
      256-byte hash. The client requests a lookup of the hash
      via a brief I2CP session using new I2CP request/reply
      messages. The router looks up the leaseset for the hash
      to convert the hash to a dest. Convert the I2PTunnel
      'preview' links to use Base32 hostnames as a
      demonstration.
This commit is contained in:
zzz
2008-12-14 15:03:11 +00:00
parent 734818f651
commit 847c9dafce
18 changed files with 822 additions and 21 deletions

View File

@@ -14,6 +14,7 @@ import net.i2p.I2PException;
import net.i2p.client.I2PClient;
import net.i2p.client.I2PClientFactory;
import net.i2p.client.I2PSession;
import net.i2p.data.Base32;
import net.i2p.data.Destination;
import net.i2p.util.I2PThread;
import net.i2p.util.Log;
@@ -361,6 +362,19 @@ public class TunnelController implements Logging {
return null;
}
public String getMyDestHashBase32() {
if (_tunnel != null) {
List sessions = _tunnel.getSessions();
for (int i = 0; i < sessions.size(); i++) {
I2PSession session = (I2PSession)sessions.get(i);
Destination dest = session.getMyDestination();
if (dest != null)
return Base32.encode(dest.calculateHash().getData());
}
}
return null;
}
public boolean getIsRunning() { return _running; }
public boolean getIsStarting() { return _starting; }

View File

@@ -437,6 +437,19 @@ public class IndexBean {
}
}
public String getDestHashBase32(int tunnel) {
TunnelController tun = getController(tunnel);
if (tun != null) {
String rv = tun.getMyDestHashBase32();
if (rv != null)
return rv;
else
return "";
} else {
return "";
}
}
///
/// bean props for form submission
///