summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.md1
-rw-r--r--client/client.go8
-rw-r--r--exports/exports.go20
-rw-r--r--internal/api/profiles/profiles.go15
-rw-r--r--internal/server/server.go28
-rw-r--r--internal/server/servers.go9
-rw-r--r--wrappers/python/eduvpn_common/loader.py3
-rw-r--r--wrappers/python/eduvpn_common/main.py12
8 files changed, 13 insertions, 83 deletions
diff --git a/CHANGES.md b/CHANGES.md
index 42f4150..ca22adb 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,7 @@
* Expose default gateway in profile settings too. For clients, use the default gateway set on the config object, this is maybe only useful for suggesting some profiles in the client profile chooser UI
* Add a server internally before authorizing and remove it again if authorization has failed. This makes sure the internal state is always up-to-date with what is happening. This also allows us to move to the main state when authorization is done as previously it could be the case where authorization was done but the server was not added yet
* Fix previous state not being set correctly when getting a config and an error happens
+* Make WireGuard support mandatory
# 1.99.1 (2024-03-11)
* Disable type annotation for global eduVPN class as it gave a `SyntaxError` on some Python versions. See https://bugs.python.org/issue34939
diff --git a/client/client.go b/client/client.go
index d97d6e0..73f94d3 100644
--- a/client/client.go
+++ b/client/client.go
@@ -34,9 +34,6 @@ type Client struct {
// The fsm
FSM fsm.FSM
- // Whether or not this client supports WireGuard
- SupportsWireguard bool
-
// Whether to enable debugging
Debug bool
@@ -145,16 +142,13 @@ func New(name string, version string, directory string, stateCallback func(FSMSt
// Initialize the FSM
c.FSM = newFSM(stateCallback, directory, debug)
- // By default we support wireguard
- c.SupportsWireguard = true
-
// Debug only if given
c.Debug = debug
c.cfg = config.NewFromDirectory(directory)
// set the servers
- c.Servers = server.NewServers(c.Name, c, c.SupportsWireguard, c.cfg.V2)
+ c.Servers = server.NewServers(c.Name, c, c.cfg.V2)
return c, nil
}
diff --git a/exports/exports.go b/exports/exports.go
index 28b6e42..a955899 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -837,26 +837,6 @@ func RenewSession(c C.uintptr_t) *C.char {
return getCError(renewSessionErr)
}
-// SetSupportWireguard enables or disables WireGuard for the client.
-// *WARNING: This function will be removed*
-//
-// By default WireGuard support is enabled
-// To disable it you can pass a 0 int to this
-//
-// `support` thus indicates whether or not to enable WireGuard
-// An error is returned if this is not possible
-//
-//export SetSupportWireguard
-func SetSupportWireguard(support C.int) *C.char {
- state, stateErr := getVPNState()
- if stateErr != nil {
- return getCError(stateErr)
- }
- // TODO: Do not do any nested struct member here
- state.Servers.WGSupport = support != 0
- return nil
-}
-
// StartFailover starts the 'failover' procedure in eduvpn-common
//
// Failover has one primary goal: check if the VPN can reach the gateway.
diff --git a/internal/api/profiles/profiles.go b/internal/api/profiles/profiles.go
index 1df17e3..eba5ece 100644
--- a/internal/api/profiles/profiles.go
+++ b/internal/api/profiles/profiles.go
@@ -100,21 +100,6 @@ func (p *Profile) HasWireGuard() bool {
return hasProtocol(p.VPNProtoList, protocol.WireGuard)
}
-// FilterWireGuard gets a profile list but without WireGuard profiles
-func (i Info) FilterWireGuard() *Info {
- var ret []Profile
- for _, p := range i.Info.ProfileList {
- if !p.HasOpenVPN() {
- continue
- }
- }
- return &Info{
- Info: ListInfo{
- ProfileList: ret,
- },
- }
-}
-
// Public gets the server list as a structure that we return to clients
func (i Info) Public() server.Profiles {
m := make(map[string]server.Profile)
diff --git a/internal/server/server.go b/internal/server/server.go
index 97a25b4..1182f15 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -72,30 +72,20 @@ func (s *Server) api() (*api.API, error) {
return s.apiw, nil
}
-func (s *Server) findProfile(ctx context.Context, wgSupport bool) (*profiles.Profile, error) {
+func (s *Server) findProfile(ctx context.Context) (*profiles.Profile, error) {
// Get the profiles by ignoring the cache
prfs, err := s.FreshProfiles(ctx)
if err != nil {
return nil, err
}
- // No profiles available
- if prfs.Len() == 0 {
- return nil, errors.New("the server has no available profiles for your account")
- }
-
- // No WireGuard support, we have to filter the profiles that only have WireGuard
- if !wgSupport {
- prfs = prfs.FilterWireGuard()
- }
-
var chosenP profiles.Profile
n := prfs.Len()
switch n {
// If we now get no profiles then that means a profile with only WireGuard was removed
case 0:
- return nil, errors.New("the server has only WireGuard profiles but the client does not support WireGuard")
+ return nil, errors.New("the server has no available profiles for your account")
case 1:
// Only one profile, make sure it is set
chosenP = prfs.MustIndex(0)
@@ -114,14 +104,14 @@ func (s *Server) findProfile(ctx context.Context, wgSupport bool) (*profiles.Pro
return &chosenP, nil
}
-func (s *Server) connect(ctx context.Context, wgSupport bool, pTCP bool) (*srvtypes.Configuration, error) {
+func (s *Server) connect(ctx context.Context, pTCP bool) (*srvtypes.Configuration, error) {
a, err := s.api()
if err != nil {
return nil, err
}
// find a suitable profile to connect
- chosenP, err := s.findProfile(ctx, wgSupport)
+ chosenP, err := s.findProfile(ctx)
if err != nil {
return nil, err
}
@@ -130,13 +120,11 @@ func (s *Server) connect(ctx context.Context, wgSupport bool, pTCP bool) (*srvty
return nil, err
}
- protos := []protocol.Protocol{protocol.OpenVPN}
- if wgSupport {
- protos = append(protos, protocol.WireGuard)
- }
- // If the client supports WireGuard and the profile supports both protocols we remove openvpn from client support if EDUVPN_PREFER_WG is set to "1"
+ // protos supported by the client
+ protos := []protocol.Protocol{protocol.OpenVPN, protocol.WireGuard}
+ // If profile supports both protocols we remove openvpn from client support if EDUVPN_PREFER_WG is set to "1"
// This also only happens if prefer TCP is set to false
- if wgSupport && os.Getenv("EDUVPN_PREFER_WG") == "1" {
+ if os.Getenv("EDUVPN_PREFER_WG") == "1" {
if chosenP.HasWireGuard() && chosenP.HasOpenVPN() {
protos = []protocol.Protocol{protocol.WireGuard}
}
diff --git a/internal/server/servers.go b/internal/server/servers.go
index 64e64b6..36f9ea7 100644
--- a/internal/server/servers.go
+++ b/internal/server/servers.go
@@ -26,8 +26,6 @@ type Callbacks interface {
type Servers struct {
clientID string
cb Callbacks
- // WGSupport defines whether or not wireguard support is enabled
- WGSupport bool
config *v2.V2
}
@@ -37,11 +35,10 @@ func (s *Servers) Remove(identifier string, t srvtypes.Type) error {
}
// NewServers creates a new servers struct
-func NewServers(name string, cb Callbacks, wgSupport bool, cfg *v2.V2) Servers {
+func NewServers(name string, cb Callbacks, cfg *v2.V2) Servers {
return Servers{
clientID: name,
cb: cb,
- WGSupport: wgSupport,
config: cfg,
}
}
@@ -107,7 +104,7 @@ func (s *Servers) ConnectWithCallbacks(ctx context.Context, srv *Server, pTCP bo
if err != nil {
return nil, err
}
- cfg, err := srv.connect(ctx, s.WGSupport, pTCP)
+ cfg, err := srv.connect(ctx, pTCP)
if err == nil {
return cfg, nil
}
@@ -127,5 +124,5 @@ func (s *Servers) ConnectWithCallbacks(ctx context.Context, srv *Server, pTCP bo
if err != nil {
return nil, err
}
- return srv.connect(ctx, s.WGSupport, pTCP)
+ return srv.connect(ctx, pTCP)
}
diff --git a/wrappers/python/eduvpn_common/loader.py b/wrappers/python/eduvpn_common/loader.py
index 674c010..f1e27e1 100644
--- a/wrappers/python/eduvpn_common/loader.py
+++ b/wrappers/python/eduvpn_common/loader.py
@@ -112,9 +112,6 @@ def initialize_functions(lib: CDLL) -> None:
c_char_p,
c_char_p,
], c_void_p
- lib.SetSupportWireguard.argtypes, lib.SetSupportWireguard.restype = [
- c_int,
- ], c_void_p
lib.SetState.argtypes, lib.SetState.restype = [
c_int,
], c_void_p
diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py
index 1494b48..3a91ebb 100644
--- a/wrappers/python/eduvpn_common/main.py
+++ b/wrappers/python/eduvpn_common/main.py
@@ -328,18 +328,6 @@ class EduVPN(object):
if renew_err:
forwardError(renew_err)
- def set_support_wireguard(self, support: bool) -> None:
- """Indicates whether or not the OS supports WireGuard connections.
-
- :param support: bool: whether or not wireguard is supported
-
- :raises WrappedError: An error by the Go library
- """
- support_err = self.go_function(self.lib.SetSupportWireguard, support)
-
- if support_err:
- forwardError(support_err)
-
def start_failover(
self, gateway: str, wg_mtu: int, readrxbytes: ReadRxBytes
) -> bool: