From 40705474e1998bf4a59b82c96d343e13247a9926 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 20 Mar 2023 13:48:47 +0100 Subject: Types: Split protocol into its own --- client/server.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'client/server.go') diff --git a/client/server.go b/client/server.go index 6e399c9..74f441a 100644 --- a/client/server.go +++ b/client/server.go @@ -9,18 +9,10 @@ import ( "github.com/eduvpn/eduvpn-common/internal/oauth" "github.com/eduvpn/eduvpn-common/internal/server" "github.com/eduvpn/eduvpn-common/types" + "github.com/eduvpn/eduvpn-common/types/protocol" "github.com/go-errors/errors" ) -func getProtocol(protocol string) types.Protocol { - if protocol == "openvpn" { - return types.PROTOCOL_OPENVPN - } else if protocol == "wireguard" { - return types.PROTOCOL_WIREGUARD - } - return types.PROTOCOL_UNKNOWN -} - // TODO: This should not be reliant on an internal type func getTokens(tok oauth.Token) types.Tokens { return types.Tokens{ @@ -68,7 +60,7 @@ func (c *Client) getConfigAuth(srv server.Server, preferTCP bool, t types.Tokens pCfg := &types.Configuration{ VPNConfig: cfg.Config, - Protocol: getProtocol(cfg.Type), + Protocol: protocol.New(cfg.Type), DefaultGateway: p.DefaultGateway, Tokens: getTokens(cfg.Tokens), } -- cgit v1.2.3