diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-07-05 13:17:24 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-07-05 13:17:24 +0200 |
| commit | 1865b016d0cca74cd3703db5a3b4217917988dec (patch) | |
| tree | 3da84dbc4f1ad49221c25fb83f402d27deb34138 /exports/exports.go | |
| parent | e39b9a8a405fa8e5f73c32bb03a3f349f7f9f92d (diff) | |
Refactor: Handling of different servers and identifiers
- Uses OrgID for Secure Internet and gets the data from discovery
- Uses URL for Institute/Custom and gets the data from discovery
- Implements SKIP WAYF as we now have the needed data
- Implements an initial change location with a default location (NL right now)
Diffstat (limited to 'exports/exports.go')
| -rw-r--r-- | exports/exports.go | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/exports/exports.go b/exports/exports.go index 567e189..6b33da6 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -107,22 +107,39 @@ func CancelOAuth(name *C.char) *C.char { return C.CString(cancelErrString) } -//export GetConnectConfig -func GetConnectConfig(name *C.char, url *C.char, isSecureInternet C.int, forceTCP C.int) (*C.char, *C.char, *C.char) { +//export GetConfigSecureInternet +func GetConfigSecureInternet(name *C.char, orgID *C.char, forceTCP C.int) (*C.char, *C.char, *C.char) { nameStr := C.GoString(name) state, stateErr := GetVPNState(nameStr) if stateErr != nil { return nil, nil, C.CString(ErrorToString(stateErr)) } - var config string - var configType string - var configErr error forceTCPBool := forceTCP == 1 - if isSecureInternet == 1 { - config, configType, configErr = state.GetConfigSecureInternet(C.GoString(url), forceTCPBool) - } else { - config, configType, configErr = state.GetConfigInstituteAccess(C.GoString(url), forceTCPBool) + config, configType, configErr := state.GetConfigSecureInternet(C.GoString(orgID), forceTCPBool) + return C.CString(config), C.CString(configType), C.CString(ErrorToString(configErr)) +} + +//export GetConfigInstituteAccess +func GetConfigInstituteAccess(name *C.char, url *C.char, forceTCP C.int) (*C.char, *C.char, *C.char) { + nameStr := C.GoString(name) + state, stateErr := GetVPNState(nameStr) + if stateErr != nil { + return nil, nil, C.CString(ErrorToString(stateErr)) } + forceTCPBool := forceTCP == 1 + config, configType, configErr := state.GetConfigInstituteAccess(C.GoString(url), forceTCPBool) + return C.CString(config), C.CString(configType), C.CString(ErrorToString(configErr)) +} + +//export GetConfigCustomServer +func GetConfigCustomServer(name *C.char, url *C.char, forceTCP C.int) (*C.char, *C.char, *C.char) { + nameStr := C.GoString(name) + state, stateErr := GetVPNState(nameStr) + if stateErr != nil { + return nil, nil, C.CString(ErrorToString(stateErr)) + } + forceTCPBool := forceTCP == 1 + config, configType, configErr := state.GetConfigCustomServer(C.GoString(url), forceTCPBool) return C.CString(config), C.CString(configType), C.CString(ErrorToString(configErr)) } |
