summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/src/api/go/functions.md6
-rw-r--r--docs/src/api/overview/getconfig.md12
-rw-r--r--docs/src/api/python/functions.md6
-rw-r--r--exports/exports.go18
-rw-r--r--internal/server/common.go8
-rw-r--r--state.go32
-rw-r--r--wrappers/python/eduvpn_common/main.py16
7 files changed, 49 insertions, 49 deletions
diff --git a/docs/src/api/go/functions.md b/docs/src/api/go/functions.md
index fc4f0a1..2cbab78 100644
--- a/docs/src/api/go/functions.md
+++ b/docs/src/api/go/functions.md
@@ -26,11 +26,11 @@ Returns a string of JSON data with the servers/organizations and an `error`, nil
## OpenVPN/Wireguard config
See [Overview](../overview/getconfig.html)
```go
-func GetConfigInstituteAccess(url string, forceTCP bool) (string, string, error)
-func GetConfigSecureInternet(url string, forceTCP bool) (string, string, error)
+func GetConfigInstituteAccess(url string, preferTCP bool) (string, string, error)
+func GetConfigSecureInternet(url string, preferTCP bool) (string, string, error)
```
- `url`: The URL of the Institute Access or Secure Internet server to get a connect config for
-- `forceTCP`: Whether or not we want to force enable TCP
+- `preferTCP`: Whether or not we want to prefer TCP
Returns:
- A `string` of the OpenVPN/Wireguard config
diff --git a/docs/src/api/overview/getconfig.md b/docs/src/api/overview/getconfig.md
index 65ca948..4e1e9fb 100644
--- a/docs/src/api/overview/getconfig.md
+++ b/docs/src/api/overview/getconfig.md
@@ -2,10 +2,10 @@
## Summary
name: `Get Config Institute Access` and `Get Config Secure Internet`
-| Arguments | Description | type |
-| --------- | -------------------------------------- | -------- |
-| URL | The url of the VPN server to connect to | string |
-| Force TCP | Whether or not to force the use of TCP | string |
+| Arguments | Description | type |
+| --------- | ---------------------------------------- | -------- |
+| URL | The url of the VPN server to connect to | string |
+| Prefer TCP | Whether or not to prefer the use of TCP | string |
Returns: `OpenVPN/Wireguard config (string)` `wireguard/openvpn type (string)`, `Error`
@@ -13,12 +13,12 @@ Used to obtain the OpenVPN/Wireguard config
## Detailed information
-To get a configuration that is used to actually establish a tunnel with the VPN server, we have the Get Config function for Institute Access and Secure Internet (the exact name depends on the language you're using) function in the library. This function has two parameters *URL* and *Force TCP*.
+To get a configuration that is used to actually establish a tunnel with the VPN server, we have the Get Config function for Institute Access and Secure Internet (the exact name depends on the language you're using) function in the library. This function has two parameters *URL* and *Prefer TCP*.
*URL* is the base url of the server to connect to
e.g. `nl.eduvpn.org`. Use the correct function to indicate if it is an Institute Access server or a Secure Internet server. A user configured server is often an Institute Access server. In case of a Secure Internet server and no Secure Internet was configured previously, this URL is set as the home server. This means that this server is set as the authorization server for all secure internet servers.
-The *Force TCP* flag is a boolean that indicates whether or not we want to use TCP to connect over the VPN. This flag is useful if the user has enabled e.g. a setting that forces the use of TCP, which is only supported by OpenVPN. If the Force TCP flag is set to `true` but the server only supports Wireguard then an error is returned and the config will be empty.
+The *Prefer TCP* flag is a boolean that indicates whether or not we want to prefer TCP to connect over the VPN. This flag is useful if the user has enabled e.g. a setting that prefers the use of TCP, which is only supported by OpenVPN. Note that this setting may be ignored by the server.
This function takes care of OAuth which has certain callbacks with data. Additionally, there are also callbacks that need to be registered for selecting the right profile to connect to. These callbacks will be explained now.
diff --git a/docs/src/api/python/functions.md b/docs/src/api/python/functions.md
index ecc4982..2b909a8 100644
--- a/docs/src/api/python/functions.md
+++ b/docs/src/api/python/functions.md
@@ -32,13 +32,13 @@ Returns a `string` of JSON data with the servers/organizations. Raises an except
## OpenVPN/Wireguard config
See [Overview](../overview/getconfig.html)
```python
-def get_config_institute_access(self, url: str, forceTCP: bool = False) -> Tuple[str, str]
+def get_config_institute_access(self, url: str, preferTCP: bool = False) -> Tuple[str, str]
```
```python
-def get_config_secure_internet(self, url: str, forceTCP: bool = False) -> Tuple[str, str]
+def get_config_secure_internet(self, url: str, preferTCP: bool = False) -> Tuple[str, str]
```
- `url`: The url of the Secure Internet or Institute Access server to get a connect config for
-- `forceTCP`: Whether or not we want to force enable TCP, default: `False`
+- `preferTCP`: Whether or not we want to prefer TCP, default: `False`
Returns:
- A `string` of the OpenVPN/Wireguard config
diff --git a/exports/exports.go b/exports/exports.go
index a2d97c7..a5c008a 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -195,38 +195,38 @@ func RemoveCustomServer(name *C.char, url *C.char) *C.error {
}
//export GetConfigSecureInternet
-func GetConfigSecureInternet(name *C.char, orgID *C.char, forceTCP C.int) (*C.char, *C.char, *C.error) {
+func GetConfigSecureInternet(name *C.char, orgID *C.char, preferTCP C.int) (*C.char, *C.char, *C.error) {
nameStr := C.GoString(name)
state, stateErr := GetVPNState(nameStr)
if stateErr != nil {
return nil, nil, getError(stateErr)
}
- forceTCPBool := forceTCP == 1
- config, configType, configErr := state.GetConfigSecureInternet(C.GoString(orgID), forceTCPBool)
+ preferTCPBool := preferTCP == 1
+ config, configType, configErr := state.GetConfigSecureInternet(C.GoString(orgID), preferTCPBool)
return C.CString(config), C.CString(configType), getError(configErr)
}
//export GetConfigInstituteAccess
-func GetConfigInstituteAccess(name *C.char, url *C.char, forceTCP C.int) (*C.char, *C.char, *C.error) {
+func GetConfigInstituteAccess(name *C.char, url *C.char, preferTCP C.int) (*C.char, *C.char, *C.error) {
nameStr := C.GoString(name)
state, stateErr := GetVPNState(nameStr)
if stateErr != nil {
return nil, nil, getError(stateErr)
}
- forceTCPBool := forceTCP == 1
- config, configType, configErr := state.GetConfigInstituteAccess(C.GoString(url), forceTCPBool)
+ preferTCPBool := preferTCP == 1
+ config, configType, configErr := state.GetConfigInstituteAccess(C.GoString(url), preferTCPBool)
return C.CString(config), C.CString(configType), getError(configErr)
}
//export GetConfigCustomServer
-func GetConfigCustomServer(name *C.char, url *C.char, forceTCP C.int) (*C.char, *C.char, *C.error) {
+func GetConfigCustomServer(name *C.char, url *C.char, preferTCP C.int) (*C.char, *C.char, *C.error) {
nameStr := C.GoString(name)
state, stateErr := GetVPNState(nameStr)
if stateErr != nil {
return nil, nil, getError(stateErr)
}
- forceTCPBool := forceTCP == 1
- config, configType, configErr := state.GetConfigCustomServer(C.GoString(url), forceTCPBool)
+ preferTCPBool := preferTCP == 1
+ config, configType, configErr := state.GetConfigCustomServer(C.GoString(url), preferTCPBool)
return C.CString(config), C.CString(configType), getError(configErr)
}
diff --git a/internal/server/common.go b/internal/server/common.go
index 7f4a0de..36dba32 100644
--- a/internal/server/common.go
+++ b/internal/server/common.go
@@ -422,7 +422,7 @@ func HasValidProfile(server Server) (bool, error) {
return false, nil
}
-func GetConfig(server Server, forceTCP bool) (string, string, error) {
+func GetConfig(server Server, preferTCP bool) (string, string, error) {
errorMessage := "failed getting an OpenVPN/WireGuard configuration"
profile, profileErr := getCurrentProfile(server)
@@ -433,8 +433,8 @@ func GetConfig(server Server, forceTCP bool) (string, string, error) {
supportsOpenVPN := profile.supportsOpenVPN()
supportsWireguard := profile.supportsWireguard()
- // If forceTCP we must be able to get a config with OpenVPN
- if forceTCP && supportsOpenVPN {
+ // If preferTCP we must be able to get a config with OpenVPN
+ if preferTCP && supportsOpenVPN {
return "", "", &types.WrappedErrorMessage{
Message: errorMessage,
Err: &ServerGetConfigForceTCPError{},
@@ -475,7 +475,7 @@ func (e *ServerGetCurrentProfileNotFoundError) Error() string {
type ServerGetConfigForceTCPError struct{}
func (e *ServerGetConfigForceTCPError) Error() string {
- return "failed to get config, force TCP is on but the server does not support OpenVPN"
+ return "failed to get config, prefer TCP is on but the server does not support OpenVPN"
}
type ServerEnsureServerEmptyURLError struct{}
diff --git a/state.go b/state.go
index cef2e23..4812fab 100644
--- a/state.go
+++ b/state.go
@@ -200,7 +200,7 @@ func (state *VPNState) ensureLogin(chosenServer server.Server) error {
// It also asks for a profile if no valid profile is found.
func (state *VPNState) getConfigAuth(
chosenServer server.Server,
- forceTCP bool,
+ preferTCP bool,
) (string, string, error) {
loginErr := state.ensureLogin(chosenServer)
if loginErr != nil {
@@ -222,17 +222,17 @@ func (state *VPNState) getConfigAuth(
}
// We return the error otherwise we wrap it too much
- return server.GetConfig(chosenServer, forceTCP)
+ return server.GetConfig(chosenServer, preferTCP)
}
// retryConfigAuth retries the getConfigAuth function if the tokens are invalid.
// If OAuth is cancelled, it makes sure that we only forward the error as additional info.
func (state *VPNState) retryConfigAuth(
chosenServer server.Server,
- forceTCP bool,
+ preferTCP bool,
) (string, string, error) {
errorMessage := "failed authorized config retry"
- config, configType, configErr := state.getConfigAuth(chosenServer, forceTCP)
+ config, configType, configErr := state.getConfigAuth(chosenServer, preferTCP)
if configErr != nil {
level := types.ERR_OTHER
var error *oauth.OAuthTokensInvalidError
@@ -242,7 +242,7 @@ func (state *VPNState) retryConfigAuth(
if errors.As(configErr, &error) {
config, configType, configErr = state.getConfigAuth(
chosenServer,
- forceTCP,
+ preferTCP,
)
if configErr == nil {
return config, configType, nil
@@ -260,7 +260,7 @@ func (state *VPNState) retryConfigAuth(
// getConfig gets an OpenVPN/WireGuard configuration by contacting the server, moving the FSM towards the DISCONNECTED state and then saving the local configuration file.
func (state *VPNState) getConfig(
chosenServer server.Server,
- forceTCP bool,
+ preferTCP bool,
) (string, string, error) {
errorMessage := "failed to get a configuration for OpenVPN/Wireguard"
if state.InFSMState(STATE_DEREGISTERED) {
@@ -270,7 +270,7 @@ func (state *VPNState) getConfig(
}
}
- config, configType, configErr := state.retryConfigAuth(chosenServer, forceTCP)
+ config, configType, configErr := state.retryConfigAuth(chosenServer, preferTCP)
if configErr != nil {
return "", "", &types.WrappedErrorMessage{Level: GetErrorLevel(configErr), Message: errorMessage, Err: configErr}
@@ -475,10 +475,10 @@ func (state *VPNState) RemoveCustomServer(url string) error {
// GetConfigSecureInternet gets a configuration for a Secure Internet Server.
// It ensures that the Secure Internet Server exists by creating or using an existing one with the orgID.
-// `forceTCP` indicates that the client wants to use TCP (through OpenVPN) to establish the VPN tunnel.
+// `preferTCP` indicates that the client wants to use TCP (through OpenVPN) to establish the VPN tunnel.
func (state *VPNState) GetConfigSecureInternet(
orgID string,
- forceTCP bool,
+ preferTCP bool,
) (string, string, error) {
errorMessage := fmt.Sprintf(
"failed getting a configuration for Secure Internet organization %s",
@@ -499,7 +499,7 @@ func (state *VPNState) GetConfigSecureInternet(
state.FSM.GoTransition(STATE_CHOSEN_SERVER)
- config, configType, configErr := state.getConfig(server, forceTCP)
+ config, configType, configErr := state.getConfig(server, preferTCP)
if configErr != nil {
state.Logger.Inherit(
configErr,
@@ -559,8 +559,8 @@ func (state *VPNState) addCustomServer(url string) (server.Server, error) {
// GetConfigInstituteAccess gets a configuration for an Institute Access Server.
// It ensures that the Institute Access Server exists by creating or using an existing one with the url.
-// `forceTCP` indicates that the client wants to use TCP (through OpenVPN) to establish the VPN tunnel.
-func (state *VPNState) GetConfigInstituteAccess(url string, forceTCP bool) (string, string, error) {
+// `preferTCP` indicates that the client wants to use TCP (through OpenVPN) to establish the VPN tunnel.
+func (state *VPNState) GetConfigInstituteAccess(url string, preferTCP bool) (string, string, error) {
errorMessage := fmt.Sprintf("failed getting a configuration for Institute Access %s", url)
state.FSM.GoTransition(STATE_LOADING_SERVER)
server, serverErr := state.addInstituteServer(url)
@@ -575,7 +575,7 @@ func (state *VPNState) GetConfigInstituteAccess(url string, forceTCP bool) (stri
return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: serverErr}
}
- config, configType, configErr := state.getConfig(server, forceTCP)
+ config, configType, configErr := state.getConfig(server, preferTCP)
if configErr != nil {
state.Logger.Inherit(configErr,
fmt.Sprintf(
@@ -590,8 +590,8 @@ func (state *VPNState) GetConfigInstituteAccess(url string, forceTCP bool) (stri
// GetConfigCustomServer gets a configuration for a Custom Server.
// It ensures that the Custom Server exists by creating or using an existing one with the url.
-// `forceTCP` indicates that the client wants to use TCP (through OpenVPN) to establish the VPN tunnel.
-func (state *VPNState) GetConfigCustomServer(url string, forceTCP bool) (string, string, error) {
+// `preferTCP` indicates that the client wants to use TCP (through OpenVPN) to establish the VPN tunnel.
+func (state *VPNState) GetConfigCustomServer(url string, preferTCP bool) (string, string, error) {
errorMessage := fmt.Sprintf("failed getting a configuration for custom server %s", url)
state.FSM.GoTransition(STATE_LOADING_SERVER)
server, serverErr := state.addCustomServer(url)
@@ -607,7 +607,7 @@ func (state *VPNState) GetConfigCustomServer(url string, forceTCP bool) (string,
return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: serverErr}
}
- config, configType, configErr := state.getConfig(server, forceTCP)
+ config, configType, configErr := state.getConfig(server, preferTCP)
if configErr != nil {
state.Logger.Inherit(
configErr,
diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py
index c6bd2de..9d63c4d 100644
--- a/wrappers/python/eduvpn_common/main.py
+++ b/wrappers/python/eduvpn_common/main.py
@@ -132,13 +132,13 @@ class EduVPN(object):
if remove_err:
raise remove_err
- def get_config(self, url: str, func: callable, force_tcp: bool = False):
+ def get_config(self, url: str, func: callable, prefer_tcp: bool = False):
# Because it could be the case that a profile callback is started, store a threading event
# In the constructor, we have defined a wait event for Ask_Profile, this waits for this event to be set
# The event is set in self.set_profile
self.profile_event = threading.Event()
- config, config_type, config_err = self.go_function(func, url, force_tcp)
+ config, config_type, config_err = self.go_function(func, url, prefer_tcp)
self.profile_event = None
self.location_event = None
@@ -149,20 +149,20 @@ class EduVPN(object):
return config, config_type
def get_config_custom_server(
- self, url: str, force_tcp: bool = False
+ self, url: str, prefer_tcp: bool = False
) -> Tuple[str, str]:
- return self.get_config(url, self.lib.GetConfigCustomServer, force_tcp)
+ return self.get_config(url, self.lib.GetConfigCustomServer, prefer_tcp)
def get_config_institute_access(
- self, url: str, force_tcp: bool = False
+ self, url: str, prefer_tcp: bool = False
) -> Tuple[str, str]:
- return self.get_config(url, self.lib.GetConfigInstituteAccess, force_tcp)
+ return self.get_config(url, self.lib.GetConfigInstituteAccess, prefer_tcp)
def get_config_secure_internet(
- self, url: str, force_tcp: bool = False
+ self, url: str, prefer_tcp: bool = False
) -> Tuple[str, str]:
self.location_event = threading.Event()
- return self.get_config(url, self.lib.GetConfigSecureInternet, force_tcp)
+ return self.get_config(url, self.lib.GetConfigSecureInternet, prefer_tcp)
def go_back(self) -> None:
# Ignore the error