Passing custom options through I2CP
As part of an ongoing effort to improve the router console, I've been trying to work out how to get the IP:port for a tunnel created with i2ptunnel to be shown on the summary bar. This wasn't as simple as I originally thought: the router console only has access to information it receives over the I2CP connection.
The destination nickname is passed specifically through I2CP as a known option, and originally I was contemplating appending data to that; but then I discovered that
net.i2p.router.TunnelPoolSettings (which is where the config options end up after going through I2CP) has a
Perfect! Except for one little hurdle that I subsequently discovered after many hours tracing the options through the code - on the router side, any extra options are allocated into separate inbound and outbound tunnel settings, and these require that the custom option be prefixed with
outbound. while anything else is ignored.
So, to sum up: to get custom options through I2CP, add the options on the client side of I2CP (i2ptunnel or whatever) in the form
inbound.foobar=baz, and then fetch them back (minus the
inbound.) from the Properties object returned by
_context.tunnelManager().getInboundSettings(destHash).getUnknownOptions(). Also note that if you are setting the option in code, it may need to be in the form