diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-28 14:29:12 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-28 14:29:12 +0100 |
| commit | 0bfb35520d7e138e6219e550187e0b55bc8a29ac (patch) | |
| tree | a087049edae0ff932bc7a14fef323783b26a2ff1 /client | |
| parent | 59e6ccd051452162fab852a25deb4f0f8a9e22b2 (diff) | |
Formatting: Run gofumpt -w
Diffstat (limited to 'client')
| -rw-r--r-- | client/client.go | 10 | ||||
| -rw-r--r-- | client/client_test.go | 3 | ||||
| -rw-r--r-- | client/fsm.go | 2 | ||||
| -rw-r--r-- | client/server.go | 8 |
4 files changed, 9 insertions, 14 deletions
diff --git a/client/client.go b/client/client.go index fda6f6a..d6b04a3 100644 --- a/client/client.go +++ b/client/client.go @@ -65,10 +65,11 @@ type Client struct { } // Register initializes the clientwith the following parameters: -// - name: the name of the client -// - directory: the directory where the config files are stored. Absolute or relative -// - stateCallback: the callback function for the FSM that takes two states (old and new) and the data as an interface -// - debug: whether or not we want to enable debugging +// - name: the name of the client +// - directory: the directory where the config files are stored. Absolute or relative +// - stateCallback: the callback function for the FSM that takes two states (old and new) and the data as an interface +// - debug: whether or not we want to enable debugging +// // It returns an error if initialization failed, for example when discovery cannot be obtained and when there are no servers. func (client *Client) Register( name string, @@ -221,4 +222,3 @@ type LetsConnectNotSupportedError struct{} func (e LetsConnectNotSupportedError) Error() string { return "Any operation that involves discovery is not allowed with the Let's Connect! client" } - diff --git a/client/client_test.go b/client/client_test.go index fe2dec5..1b9a488 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -172,10 +172,9 @@ func TestConnectOAuthParameters(t *testing.T) { var ( failedCallbackParameterError *oauth.CallbackParameterError failedCallbackStateMatchError *oauth.CallbackStateMatchError - failedCallbackISSMatchError *oauth.CallbackISSMatchError + failedCallbackISSMatchError *oauth.CallbackISSMatchError ) - serverURI := getServerURI(t) // serverURI already ends with a / due to using the util EnsureValidURL function iss := serverURI diff --git a/client/fsm.go b/client/fsm.go index 88d71f2..79d0f62 100644 --- a/client/fsm.go +++ b/client/fsm.go @@ -244,7 +244,6 @@ func (e FSMWrongStateError) CustomError() *types.WrappedErrorMessage { ) } - // SetSearchServer sets the FSM to the SEARCH_SERVER state. // This indicates that the user wants to search for a new server. // Returns an error if this state transition is not possible. @@ -437,7 +436,6 @@ func (client *Client) CancelOAuth() error { return nil } - // InFSMState is a helper to check if the FSM is in state `checkState`. func (client *Client) InFSMState(checkState FSMStateID) bool { return client.FSM.InState(checkState) diff --git a/client/server.go b/client/server.go index a32b7df..01f965a 100644 --- a/client/server.go +++ b/client/server.go @@ -4,10 +4,10 @@ import ( "errors" "fmt" - "github.com/eduvpn/eduvpn-common/types" "github.com/eduvpn/eduvpn-common/internal/oauth" "github.com/eduvpn/eduvpn-common/internal/server" "github.com/eduvpn/eduvpn-common/internal/util" + "github.com/eduvpn/eduvpn-common/types" ) // getConfigAuth gets a config with authorization and authentication. @@ -298,7 +298,7 @@ func (client *Client) AddSecureInternetHomeServer(orgID string) (server.Server, currentErr := client.Servers.SetSecureInternet(server) if currentErr != nil { client.goBackInternal() - return nil, client.handleError(errorMessage, currentErr) + return nil, client.handleError(errorMessage, currentErr) } // Server has been chosen for authentication @@ -526,7 +526,6 @@ func (client *Client) ChangeSecureLocation() error { return nil } - // RenewSession renews the session for the current VPN server. // This logs the user back in. func (client *Client) RenewSession() error { @@ -539,7 +538,7 @@ func (client *Client) RenewSession() error { // The server has not been chosen yet, this means that we want to manually renew if client.FSM.InState(StateNoServer) { - client.FSM.GoTransition(StateChosenServer) + client.FSM.GoTransition(StateChosenServer) } server.MarkTokensForRenew(currentServer) @@ -623,4 +622,3 @@ func (client *Client) SetProfileID(profileID string) error { base.Profiles.Current = profileID return nil } - |
