diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-03-23 12:10:47 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-03-23 12:10:47 +0100 |
| commit | b9b2659908d5fe8afcc74f2769a8da7bab243018 (patch) | |
| tree | c8d524cb99cd98d326d78b78ce988395e4fb3e26 /exports | |
| parent | ed6073f2c2c6600063f2e5062937b7a2a1162eb2 (diff) | |
Add wrapping functionality for getting a wireguard config
Diffstat (limited to 'exports')
| -rw-r--r-- | exports/exports.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/exports/exports.go b/exports/exports.go index 8236977..4e998bf 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -34,7 +34,8 @@ func StateCallback(old_state string, new_state string, data string) { //export Register func Register(name *C.char, config_directory *C.char, stateCallback C.PythonCB) *C.char { P_StateCallback = stateCallback - registerErr := eduvpn.Register(eduvpn.GetVPNState(), C.GoString(name), C.GoString(config_directory), StateCallback) + state := eduvpn.GetVPNState() + registerErr := state.Register(C.GoString(name), C.GoString(config_directory), StateCallback) return C.CString(ErrorToString(registerErr)) } @@ -46,6 +47,13 @@ func ErrorToString(error error) string { return error.Error() } +//export Connect +func Connect(url *C.char) (*C.char, *C.char) { + state := eduvpn.GetVPNState() + config, configErr := state.Connect(C.GoString(url)) + return C.CString(config), C.CString(ErrorToString(configErr)) +} + //export GetOrganizationsList func GetOrganizationsList() (*C.char, *C.char) { state := eduvpn.GetVPNState() |
