Skip to content

Add generic event functionality, use it for connection data

eta requested to merge events into main
  • We generalise the ProgressEvent machinery to work with a new generic version of OnionmasqEvent, which now includes connection details.
    • Note that this is a BREAKING CHANGE for the Java side -- cc @cyberta
  • This is done with a Rust enum, TunnelEvent, which contains all the event types (Bootstrap, NewConnection, FailedConnection, and ClosedConnection), and some Java logic that looks at the enum tag to deserialize it as a subclass of OnionmasqEvent.
  • Users can then destructure the event with Java instanceof.
  • In the sample app, we just log all events received in a relatively human-readable format, as a proof of concept.
    • Note that this suffers from none of the privacy issues of the previous implementations, since the logs aren't visible by other apps like they would be if put in logcat.

(Side note: I'm honestly astounded that this worked first time; I don't actually have any experience writing Java, so I'd have expected all my class deserialisation shenanigans to not work at all!)

Related to #38 (closed) -- this is most of the functionality apart from GeoIP/country code stuff.

This patch series also has some minor onion-tunnel fixes and refactorings to make it work better, fixing #56 (closed).

Edited by eta

Merge request reports