|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.klomp.snark.I2PSnarkUtil
public class I2PSnarkUtil
I2P specific helpers for I2PSnark We use this class as a sort of context for i2psnark so we can run multiple instances of single Snarks (but not multiple SnarkManagers, it is still static)
Field Summary | |
---|---|
static int |
DEFAULT_MAX_UP_BW
|
static String |
DEFAULT_OPENTRACKERS
|
static int |
DEFAULT_STARTUP_DELAY
|
static boolean |
DEFAULT_USE_OPENTRACKERS
|
static int |
MAX_CONNECTIONS
|
static String |
PROP_OPENTRACKERS
|
static String |
PROP_USE_OPENTRACKERS
|
Constructor Summary | |
---|---|
I2PSnarkUtil(I2PAppContext ctx)
|
Method Summary | |
---|---|
boolean |
configured()
public void setProxy(String host, int port) { if ( (host != null) && (port > 0) ) { _shouldProxy = true; _proxyHost = host; _proxyPort = port; } else { _shouldProxy = false; _proxyHost = null; _proxyPort = -1; } _configured = true; } |
boolean |
connect()
Connect to the router, if we aren't already |
(package private) I2PSocket |
connect(PeerID peer)
connect to the given destination |
boolean |
connected()
|
(package private) void |
debug(String msg,
int snarkDebugLevel)
hook between snark's logger and an i2p log |
(package private) void |
debug(String msg,
int snarkDebugLevel,
Throwable t)
|
void |
disconnect()
Destroy the destination itself |
File |
get(String url)
fetch the given URL, returning the file it is stored in, or null on error |
File |
get(String url,
boolean rewrite)
|
File |
get(String url,
boolean rewrite,
int retries)
|
File |
get(String url,
int retries)
|
(package private) Destination |
getDestination(String ip)
Base64 Hash or Hash.i2p or name.i2p using naming service |
(package private) static Destination |
getDestinationFromBase64(String ip)
Base64 only - static (no naming service) |
String |
getEepProxyHost()
|
int |
getEepProxyPort()
|
boolean |
getEepProxySet()
|
String |
getI2CPHost()
|
Map<String,String> |
getI2CPOptions()
|
int |
getI2CPPort()
|
int |
getMaxConnections()
|
int |
getMaxUpBW()
|
int |
getMaxUploaders()
|
List |
getOpenTrackers()
sorted map of name to announceURL=baseURL |
String |
getOpenTrackerString()
|
(package private) String |
getOurIPString()
|
I2PServerSocket |
getServerSocket()
|
int |
getStartupDelay()
|
String |
getString(int n,
String s,
String p)
ngettext @since 0.7.14 |
String |
getString(String key)
lang in routerconsole.lang property, else current locale |
String |
getString(String s,
Object o)
translate a string with a parameter This is a lot more expensive than getString(s, ctx), so use sparingly. |
String |
getString(String s,
Object o,
Object o2)
{0} and {1} |
String |
lookup(String name)
|
(package private) String |
rewriteAnnounce(String origAnnounce)
Given http://KEY.i2p/foo/announce turn it into http://i2p/KEY/foo/announce Given http://tracker.blah.i2p/foo/announce leave it alone |
void |
setI2CPConfig(String i2cpHost,
int i2cpPort,
Map opts)
|
void |
setMaxConnections(int limit)
|
void |
setMaxUpBW(int limit)
|
void |
setMaxUploaders(int limit)
|
void |
setOpenTrackerString(String ot)
|
void |
setStartupDelay(int minutes)
|
boolean |
shouldUseOpenTrackers()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_STARTUP_DELAY
public static final String PROP_USE_OPENTRACKERS
public static final boolean DEFAULT_USE_OPENTRACKERS
public static final String PROP_OPENTRACKERS
public static final String DEFAULT_OPENTRACKERS
public static final int DEFAULT_MAX_UP_BW
public static final int MAX_CONNECTIONS
Constructor Detail |
---|
public I2PSnarkUtil(I2PAppContext ctx)
Method Detail |
---|
public boolean configured()
public void setI2CPConfig(String i2cpHost, int i2cpPort, Map opts)
public void setMaxUploaders(int limit)
public void setMaxUpBW(int limit)
public void setMaxConnections(int limit)
public void setStartupDelay(int minutes)
public String getI2CPHost()
public int getI2CPPort()
public Map<String,String> getI2CPOptions()
public String getEepProxyHost()
public int getEepProxyPort()
public boolean getEepProxySet()
public int getMaxUploaders()
public int getMaxUpBW()
public int getMaxConnections()
public int getStartupDelay()
public boolean connect()
public boolean connected()
public void disconnect()
I2PSocket connect(PeerID peer) throws IOException
IOException
public File get(String url)
public File get(String url, boolean rewrite)
public File get(String url, int retries)
public File get(String url, boolean rewrite, int retries)
public I2PServerSocket getServerSocket()
String getOurIPString()
static Destination getDestinationFromBase64(String ip)
Destination getDestination(String ip)
public String lookup(String name)
String rewriteAnnounce(String origAnnounce)
public void setOpenTrackerString(String ot)
ot
- non-nullpublic String getOpenTrackerString()
public List getOpenTrackers()
public boolean shouldUseOpenTrackers()
void debug(String msg, int snarkDebugLevel)
void debug(String msg, int snarkDebugLevel, Throwable t)
public String getString(String key)
public String getString(String s, Object o)
s
- string to be translated containing {0}
The {0} will be replaced by the parameter.
Single quotes must be doubled, i.e. ' -> '' in the string.o
- parameter, not translated.
To tranlslate parameter also, use _("foo {0} bar", _("baz"))
Do not double the single quotes in the parameter.
Use autoboxing to call with ints, longs, floats, etc.public String getString(String s, Object o, Object o2)
public String getString(int n, String s, String p)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |