forked from I2P_Developers/i2p.i2p
* UDPAddress: Remove dependency in console; make package private
This commit is contained in:
@@ -7,7 +7,6 @@ import net.i2p.data.RouterAddress;
|
|||||||
import net.i2p.router.CommSystemFacade;
|
import net.i2p.router.CommSystemFacade;
|
||||||
import net.i2p.router.Router;
|
import net.i2p.router.Router;
|
||||||
import net.i2p.router.transport.TransportManager;
|
import net.i2p.router.transport.TransportManager;
|
||||||
import net.i2p.router.transport.udp.UDPAddress;
|
|
||||||
import net.i2p.router.transport.udp.UDPTransport;
|
import net.i2p.router.transport.udp.UDPTransport;
|
||||||
import net.i2p.util.Addresses;
|
import net.i2p.util.Addresses;
|
||||||
|
|
||||||
@@ -32,22 +31,15 @@ public class ConfigNetHelper extends HelperBase {
|
|||||||
return _context.getProperty(PROP_I2NP_NTCP_PORT, "");
|
return _context.getProperty(PROP_I2NP_NTCP_PORT, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUdpAddress() {
|
/** @return host or "unknown" */
|
||||||
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
|
|
||||||
if (addr == null)
|
|
||||||
return _("unknown");
|
|
||||||
UDPAddress ua = new UDPAddress(addr);
|
|
||||||
return ua.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUdpIP() {
|
public String getUdpIP() {
|
||||||
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
|
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
|
||||||
if (addr == null)
|
if (addr == null)
|
||||||
return _("unknown");
|
return _("unknown");
|
||||||
UDPAddress ua = new UDPAddress(addr);
|
String rv = addr.getHost();
|
||||||
if (ua.getHost() == null)
|
if (rv == null)
|
||||||
return _("unknown");
|
return _("unknown");
|
||||||
return ua.getHost();
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -11,9 +11,8 @@ import net.i2p.util.LHMCache;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* basic helper to parse out peer info from a udp address
|
* basic helper to parse out peer info from a udp address
|
||||||
* FIXME public for ConfigNetHelper
|
|
||||||
*/
|
*/
|
||||||
public class UDPAddress {
|
class UDPAddress {
|
||||||
private final String _host;
|
private final String _host;
|
||||||
private InetAddress _hostAddress;
|
private InetAddress _hostAddress;
|
||||||
private final int _port;
|
private final int _port;
|
||||||
|
Reference in New Issue
Block a user