apiv5 mobile integration
this MR adds missing bits and required changes for the v5 integration into Android
main features:
- add panic handlers to the mobile API, in case bitmask-core crashes, an exception is thrown in Android, which can be caught and handled. Avoids app crashes in case bitmask-core panics
- change the mobile API to json-rpc style FFI: gomobile is not feature complete when it comes to auto-generating Java classes from golang structs. Various types are not supported, which resulted in generated Java classes that lacked some fields of the golang structs. I reverted the idea to pass golang model classes via the FFI, which would be translated to java classes by gomobile. Instead we're passing json strings via the FFI and deserialize them in Java. Therefore I've integrated a Java swagger code generator in bitmask_android, which fetches menshen's swagger definition and generates the according models. This way no member fields of menshen's response body get lost during the deserialization anymore.
- complete the API:
- Get and Set Introducer (URL)
- Do Geolocation lookup
- Set CountryCode - useful to set country code by other means than Geolocation lookup (in case it fails and there's no stored value, we can retrieve on android the CountryCode with the help of the Android API)
- Set UseTLS() - useful development API to connect against local development deployments
- Set ResolveWithDoH - configure DoH as DNS option
- SetSocksProxy - allow to use tor + snowflake in conjunction with bitmask-core
- SetDebug: set verbose debugging in bitmask-core, extended logs of http traffic and crash reports
- passing BitmaskCore as an interface to Java: this allows us to write better testable code in Java since we can mock any bitmask-core return value with a custom implementation of the BitmaskCore interface.
- tests
Admittedly this is a very large MR, my lame excuse: the required work to get bitmask-core working on Android was too much for the given time, which is why I went into yolo mode to get things done.
Edited by cyberta