Integrate Android into ABI #286
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First, logging. Repurpose NSLogDestination as platform-oriented SimpleLogDestination:
Then, rather than exposing complex C functions in the ABI, only receive an optional subject for the tunctrl.h signatures (the
refargument):If present, VirtualTunnelController will forward the ref to all the tunctrl.h callbacks in the similarly named methods of TunnelController:
Therefore, VirtualTunnelControllerImpl is no longer needed.
The Android basic tun controller is paired with the Kotlin code in PartoutVpnWrapper, which tunctrl.c invokes via JNI. Later, VirtualTunnelController will need to encode the TunnelRemoteInfo parameter as JSON so that Kotlin can decode and apply the modules with VpnService.Builder. Linux/Windows will likely be pure C.
Finally, simplify the way wg-go is linked because there's no need to use dlopen() / LoadLibrary(). However, cgo doesn't generate an import lib on Windows, so this must be done POSTBUILD with gendef/dlltool.