From f583a28694be3ec3b99318673c6cdb6e42ee1372 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 16 Aug 2023 13:25:15 +0200 Subject: Client + Exports + Python: Add a startup boolean to getconfig To be used for autoconnect on startup. If autoconnect on startup set to true This ignores any callbacks that require user input (profile, authorization & location callbacks) --- exports/exports.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'exports') diff --git a/exports/exports.go b/exports/exports.go index 4a92f1a..9ca053b 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -312,6 +312,8 @@ func ServerList() (*C.char, *C.char) { // - In case of custom server: The base URL // - In case of institute access: The base URL // pTCP is if we prefer TCP or not to get the configuration, non-zero means yes +// startup is if the client is just starting up, set this to true (non-zero) if you autoconnect to a server on startup +// If this startup value is true (non-zero) then any authorization or other callacks (profile/location) are not triggered // If the server cannot be added it returns the error as types/error/error.go Error // Note that the server is removed when an error has occured // The current state callbacks MUST be handled @@ -349,7 +351,7 @@ func ServerList() (*C.char, *C.char) { // This is nil if an error is returned as types/error/error.go Error // //export GetConfig -func GetConfig(c C.uintptr_t, _type C.int, id *C.char, pTCP C.int) (*C.char, *C.char) { +func GetConfig(c C.uintptr_t, _type C.int, id *C.char, pTCP C.int, startup C.int) (*C.char, *C.char) { state, stateErr := getVPNState() if stateErr != nil { return nil, getCError(stateErr) @@ -359,7 +361,8 @@ func GetConfig(c C.uintptr_t, _type C.int, id *C.char, pTCP C.int) (*C.char, *C. return nil, getCError(err) } preferTCPBool := pTCP != 0 - cfg, err := state.GetConfig(ck, C.GoString(id), srvtypes.Type(_type), preferTCPBool) + startupBool := startup != 0 + cfg, err := state.GetConfig(ck, C.GoString(id), srvtypes.Type(_type), preferTCPBool, startupBool) if cfg != nil && err == nil { d, err := getReturnData(cfg) if err == nil { -- cgit v1.2.3