summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-11-28 11:52:04 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-11-28 12:03:16 +0100
commit7339e77c6eda5b96874dfc099d5c58da8ed53629 (patch)
treeb602159b0c397cbaa4f8983aea987274163fe357 /client
parente9f8db8ee8fccf60e58deb1d72766f94a053bb16 (diff)
Refactor: Remove most get prefixes for receiver functions
Diffstat (limited to 'client')
-rw-r--r--client/client.go4
-rw-r--r--client/client_test.go8
-rw-r--r--client/fsm.go2
-rw-r--r--client/server.go16
4 files changed, 15 insertions, 15 deletions
diff --git a/client/client.go b/client/client.go
index 34981db..958dd25 100644
--- a/client/client.go
+++ b/client/client.go
@@ -147,7 +147,7 @@ func (client *Client) Deregister() {
// Save the config
saveErr := client.Config.Save(&client)
if saveErr != nil {
- client.Logger.Info("failed saving configuration, error: %s", types.GetErrorTraceback(saveErr))
+ client.Logger.Info("failed saving configuration, error: %s", types.ErrorTraceback(saveErr))
}
// Empty out the state
@@ -157,7 +157,7 @@ func (client *Client) Deregister() {
// askProfile asks the user for a profile by moving the FSM to the ASK_PROFILE state.
func (client *Client) askProfile(chosenServer server.Server) error {
errorMessage := "failed asking for profiles"
- profiles, profilesErr := server.GetValidProfiles(chosenServer, client.SupportsWireguard)
+ profiles, profilesErr := server.ValidProfiles(chosenServer, client.SupportsWireguard)
if profilesErr != nil {
return types.NewWrappedError(errorMessage, profilesErr)
}
diff --git a/client/client_test.go b/client/client_test.go
index 2a240bd..a125e7e 100644
--- a/client/client_test.go
+++ b/client/client_test.go
@@ -120,7 +120,7 @@ func testConnectOAuthParameter(
if serverErr != nil {
t.Fatalf("No server with error: %v", serverErr)
}
- port, portErr := server.GetOAuth().GetListenerPort()
+ port, portErr := server.OAuth().ListenerPort()
if portErr != nil {
_ = state.CancelOAuth()
t.Fatalf("No port with error: %v", portErr)
@@ -247,7 +247,7 @@ func TestTokenExpired(t *testing.T) {
t.Fatalf("No server found")
}
- serverOAuth := currentServer.GetOAuth()
+ serverOAuth := currentServer.OAuth()
accessToken := serverOAuth.Token.Access
refreshToken := serverOAuth.Token.Refresh
@@ -310,7 +310,7 @@ func TestTokenInvalid(t *testing.T) {
t.Fatalf("No server found")
}
- serverOAuth := currentServer.GetOAuth()
+ serverOAuth := currentServer.OAuth()
// Override tokens with invalid values
serverOAuth.Token.Access = dummyValue
@@ -366,7 +366,7 @@ func TestInvalidProfileCorrected(t *testing.T) {
t.Fatalf("No server found")
}
- base, baseErr := currentServer.GetBase()
+ base, baseErr := currentServer.Base()
if baseErr != nil {
t.Fatalf("No base found")
}
diff --git a/client/fsm.go b/client/fsm.go
index 159464a..f4bfe21 100644
--- a/client/fsm.go
+++ b/client/fsm.go
@@ -393,7 +393,7 @@ func (client *Client) goBackInternal() {
client.Logger.Info(
fmt.Sprintf(
"Failed going back, error: %s",
- types.GetErrorTraceback(goBackErr),
+ types.ErrorTraceback(goBackErr),
),
)
}
diff --git a/client/server.go b/client/server.go
index 5b1a32b..5fed292 100644
--- a/client/server.go
+++ b/client/server.go
@@ -36,7 +36,7 @@ func (client *Client) getConfigAuth(
}
// We return the error otherwise we wrap it too much
- return server.GetConfig(chosenServer, client.SupportsWireguard, preferTCP)
+ return server.Config(chosenServer, client.SupportsWireguard, preferTCP)
}
// retryConfigAuth retries the getConfigAuth function if the tokens are invalid.
@@ -104,7 +104,7 @@ func (client *Client) getConfig(
if saveErr != nil {
client.Logger.Info(
"Failed saving configuration after getting a server: %s",
- types.GetErrorTraceback(saveErr),
+ types.ErrorTraceback(saveErr),
)
}
@@ -153,7 +153,7 @@ func (client *Client) RemoveSecureInternet() error {
if saveErr != nil {
client.Logger.Info(
"Failed saving configuration after removing a secure internet server: %s",
- types.GetErrorTraceback(saveErr),
+ types.ErrorTraceback(saveErr),
)
}
return nil
@@ -177,7 +177,7 @@ func (client *Client) RemoveInstituteAccess(url string) error {
if saveErr != nil {
client.Logger.Info(
"Failed saving configuration after removing an institute access server: %s",
- types.GetErrorTraceback(saveErr),
+ types.ErrorTraceback(saveErr),
)
}
return nil
@@ -201,7 +201,7 @@ func (client *Client) RemoveCustomServer(url string) error {
if saveErr != nil {
client.Logger.Info(
"Failed saving configuration after removing a custom server: %s",
- types.GetErrorTraceback(saveErr),
+ types.ErrorTraceback(saveErr),
)
}
return nil
@@ -566,7 +566,7 @@ func (client *Client) ShouldRenewButton() bool {
if currentServerErr != nil {
client.Logger.Info(
"No server found to renew with err: %s",
- types.GetErrorTraceback(currentServerErr),
+ types.ErrorTraceback(currentServerErr),
)
return false
}
@@ -581,7 +581,7 @@ func (client *Client) ensureLogin(chosenServer server.Server) error {
// Relogin with oauth
// This moves the state to authorized
if server.NeedsRelogin(chosenServer) {
- url, urlErr := server.GetOAuthURL(chosenServer, client.Name)
+ url, urlErr := server.OAuthURL(chosenServer, client.Name)
goTransitionErr := client.FSM.GoTransitionRequired(StateOAuthStarted, url)
if goTransitionErr != nil {
@@ -615,7 +615,7 @@ func (client *Client) SetProfileID(profileID string) error {
return client.handleError(errorMessage, serverErr)
}
- base, baseErr := server.GetBase()
+ base, baseErr := server.Base()
if baseErr != nil {
client.goBackInternal()
return client.handleError(errorMessage, baseErr)