This is some Java code I wrote for a school project to save some time when iterating in
random order over a part of list (until some condition becomes true):
Here is a sample on how to use the code:
Simple rate calculator for periodically sampled data points - determining an
average value over a period, the number of events in that period, the maximum number
of events (using the interval between events), and lifetime data.
Pool of running threads which will process any read bytes on any of the
NTCPConnections, including the decryption of the data read, connection
handshaking, parsing bytes into I2NP messages, etc.
Read a newline delimited line from the stream, returning the line (without
the newline), or null if EOF reached before the newline was found
Warning - strips \n but not \r
Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
Warning - not UTF-8
update the hash along the way
Warning - strips \n but not \r
Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
Warning - not UTF-8
update the hash along the way
Warning - strips \n but not \r
Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
Warning - not UTF-8
Read the body into the data structures, after the initial type byte and
the uniqueId / expiration, using the current class's format as defined by
the I2NP specification
Note that while a SessionConfirmed could in theory be fragmented,
in practice a RouterIdentity is 387 bytes and a single fragment is 512 bytes max,
so it will never be fragmented.
Got a SessionDestroy - maybe during an inbound establish?
TODO - PacketHandler won't look up inbound establishes
As this packet was essentially unauthenticated (i.e.
Receive the raw preprocessed message at the endpoint, parsing out each
of the fragments, using those to fill various FragmentedMessages, and
sending the resulting I2NPMessages where necessary.
Instruct the router that the message received was abusive (including how
abusive on a 1-100 scale) in the hopes the router can do something to
minimize receiving abusive messages like that in the future.
At 10 seconds, we were receiving about 20% of replies after expiration
Todo: make this variable on a per-request basis, to account for tunnel length,
expl.
Moved from RouterConsoleRunner.java
Reseeding is not strictly a router function, it used to be
in the routerconsole app, but this made it impossible to
bootstrap an embedded router lacking a routerconsole,
in iMule or android for example, without additional modifications.
If a class started via clients.config implements this interface,
it will be used to manage the client, instead of starting with main()
Clients implementing this interface MUST provide the following constructor:
public MyClientApp(RouterContext context, ClientAppManager listener, String[] args) {...}
All parameters are non-null.
// migrate these to b64
private static final String[] MIGRATE_FROM = {
// This has a separate router.reseedProxy.username prop,
// so let's not mess with it
"router.reseedProxy.password",
// Don't migrate these until we have a console form for them,
// which we aren't likely to ever bother with
"routerconsole.keyPassword",
"routerconsole.keystorePassword",
"i2cp.keyPassword",
"i2cp.keystorePassword"
};
private static final String[] MIGRATE_TO = {
"router.reseedProxy.auth",
"routerconsole.ssl.key.auth",
"routerconsole.ssl.keystore.auth",
"i2cp.ssl.key.auth",
"i2cp.ssl.keystore.auth"
};
Run the client on the given port number pointing at the specified destination
(either the base64 of the destination or file:fileNameContainingDestination).
Run the HTTP server pointing at the host and port specified using the private i2p
destination loaded from the specified file, replacing the HTTP headers
so that the Host: specified is the one spoofed.
Run the HTTP server pointing at the host and port specified using the private i2p
destination loaded from the specified file, replacing the HTTP headers
so that the Host: specified is the one spoofed.
Specify the hostname / IP address of the interface that the tunnels should bind to
Sets the event "listen_onResult" = "ok" or "error" after the interface has been specified
running -
Variable in class net.i2p.i2ptunnel.streamr.Pinger
RUNNING -
Static variable in class net.i2p.i2ptunnel.web.IndexBean
Specify the read timeout going to be used for newly-created I2PSockets
Sets the event "read_timeoutResult" = "ok" or "error" after the interface has been specified