The app figures out all settings and passes them in the
'options' parameter of startTunnel().
The network extension just takes them as is and just plugs the supplied
values into the right places.
This is based on Jeroen Leenarts' work (commit a3cdb84)
and Jason Donenfeld's work (commit 9d01829).
To reproduce:
In Xcode, add a new target called 'WireGuardGoBridge' with
the Cross-platform > External build system template. Configure
that target with the 'make' build tool and ask it to build on the
wireguard-go-bridge directory.
The Makefile in wireguard-go-bridge is already configured to
handle being called from Xcode as an external build system.
In WireGuardNetworkExtension's build phases, add a dependancy to
WireGuardGoBridge, and ask it to link to libwg-go.a (the make command
shall generate this archive). Add libwg-go.a as a library to be linked
with.
Edit the Xcode pbxproj file and in the file reference entry for
libwg-go.a, set path as "libwg-go.a" and sourceTree as
BUILT_PRODUCTS_DIR.
This is required because when we add an app extension to the
project, there will be two PRODUCT_BUNDLE_IDENTIFIER fields
in our project file, so we cannot use xcconfig to set that
key directly.
This is so that other developers can work on this codebase
by copying Developer.xcconfig.template to Developer.xcconfig
and setting the DEVELOPMENT_TEAM to their respective Team IDs.
The Team IDs need not be checked into source control.