forked from I2P_Developers/i2p.i2p
Revise lookup code
This commit is contained in:
@@ -32,11 +32,12 @@ import java.net.Socket;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
import net.i2p.client.I2PClientFactory;
|
import net.i2p.client.I2PClientFactory;
|
||||||
import net.i2p.data.DataFormatException;
|
//import net.i2p.data.DataFormatException;
|
||||||
import net.i2p.data.Destination;
|
import net.i2p.data.Destination;
|
||||||
import net.i2p.i2ptunnel.I2PTunnel;
|
//import net.i2p.i2ptunnel.I2PTunnel;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
// needed only for debugging.
|
// needed only for debugging.
|
||||||
// import java.util.logging.Level;
|
// import java.util.logging.Level;
|
||||||
@@ -52,7 +53,7 @@ public class DoCMDS implements Runnable {
|
|||||||
|
|
||||||
// FIX ME
|
// FIX ME
|
||||||
// I need a better way to do versioning, but this will do for now.
|
// I need a better way to do versioning, but this will do for now.
|
||||||
public static final String BMAJ = "00", BMIN = "00", BREV = "0E", BEXT = "";
|
public static final String BMAJ = "00", BMIN = "00", BREV = "0F", BEXT = "";
|
||||||
public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT;
|
public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT;
|
||||||
private Socket server;
|
private Socket server;
|
||||||
private Properties props;
|
private Properties props;
|
||||||
@@ -456,11 +457,14 @@ public class DoCMDS implements Runnable {
|
|||||||
String reply = null;
|
String reply = null;
|
||||||
if (Arg.endsWith(".i2p")) {
|
if (Arg.endsWith(".i2p")) {
|
||||||
try {
|
try {
|
||||||
try {
|
//try {
|
||||||
dest = I2PTunnel.destFromName(Arg);
|
//dest = I2PTunnel.destFromName(Arg);
|
||||||
} catch (DataFormatException ex) {
|
//} catch (DataFormatException ex) {
|
||||||
|
//}
|
||||||
|
dest = I2PAppContext.getGlobalContext().namingService().lookup(Arg);
|
||||||
|
if(dest != null) {
|
||||||
|
reply = dest.toBase64();
|
||||||
}
|
}
|
||||||
reply = dest.toBase64();
|
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
// Could not find the destination!?
|
// Could not find the destination!?
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,8 @@ import net.i2p.client.streaming.I2PSocket;
|
|||||||
import net.i2p.client.streaming.I2PSocketManager;
|
import net.i2p.client.streaming.I2PSocketManager;
|
||||||
import net.i2p.data.DataFormatException;
|
import net.i2p.data.DataFormatException;
|
||||||
import net.i2p.data.Destination;
|
import net.i2p.data.Destination;
|
||||||
import net.i2p.i2ptunnel.I2PTunnel;
|
//import net.i2p.i2ptunnel.I2PTunnel;
|
||||||
|
import net.i2p.I2PAppContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -146,11 +147,11 @@ public class TCPtoI2P implements Runnable {
|
|||||||
input = line.toLowerCase();
|
input = line.toLowerCase();
|
||||||
Destination dest = null;
|
Destination dest = null;
|
||||||
if (input.endsWith(".i2p")) {
|
if (input.endsWith(".i2p")) {
|
||||||
try {
|
//dest = I2PTunnel.destFromName(input);
|
||||||
dest = I2PTunnel.destFromName(input);
|
dest = I2PAppContext.getGlobalContext().namingService().lookup(input);
|
||||||
|
if (dest != null) {
|
||||||
line = dest.toBase64();
|
line = dest.toBase64();
|
||||||
} catch (NullPointerException npe) {
|
} else {
|
||||||
// Could not find the destination!?
|
|
||||||
Emsg("Can't find destination: " + input, out);
|
Emsg("Can't find destination: " + input, out);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user