summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client.go9
-rw-r--r--client_test.go32
-rw-r--r--cmd/cli/main.go24
-rw-r--r--exports/exports.go3
-rw-r--r--fsm.go2
-rw-r--r--internal/config/config.go6
-rw-r--r--internal/discovery/discovery.go2
-rw-r--r--internal/http/http.go2
-rw-r--r--internal/log/log.go5
-rw-r--r--internal/oauth/oauth.go4
-rw-r--r--internal/server/custom.go1
-rw-r--r--internal/verify/verify.go2
12 files changed, 46 insertions, 46 deletions
diff --git a/client.go b/client.go
index ffa8802..c7c6276 100644
--- a/client.go
+++ b/client.go
@@ -479,7 +479,7 @@ func (client *Client) AddInstituteServer(url string) (server.Server, error) {
// Authorize it
loginErr := client.ensureLogin(server)
if loginErr != nil {
- // Removing is best effort
+ // Removing is best effort
_ = client.RemoveInstituteAccess(url)
return nil, &types.WrappedErrorMessage{Level: types.GetErrorLevel(loginErr), Message: errorMessage, Err: loginErr}
}
@@ -520,7 +520,7 @@ func (client *Client) AddSecureInternetHomeServer(orgID string) (server.Server,
locationErr := client.askSecureLocation()
if locationErr != nil {
- // Removing is best effort
+ // Removing is best effort
_ = client.RemoveSecureInternet()
return nil, &types.WrappedErrorMessage{Message: errorMessage, Err: locationErr}
}
@@ -531,7 +531,7 @@ func (client *Client) AddSecureInternetHomeServer(orgID string) (server.Server,
// Authorize it
loginErr := client.ensureLogin(server)
if loginErr != nil {
- // Removing is best effort
+ // Removing is best effort
_ = client.RemoveSecureInternet()
return nil, &types.WrappedErrorMessage{Level: types.GetErrorLevel(loginErr), Message: errorMessage, Err: loginErr}
}
@@ -570,7 +570,7 @@ func (client *Client) AddCustomServer(url string) (server.Server, error) {
// Authorize it
loginErr := client.ensureLogin(server)
if loginErr != nil {
- // removing is best effort
+ // removing is best effort
_ = client.RemoveCustomServer(url)
return nil, &types.WrappedErrorMessage{Level: types.GetErrorLevel(loginErr), Message: errorMessage, Err: loginErr}
}
@@ -679,7 +679,6 @@ func (client *Client) GetConfigSecureInternet(
return config, configType, nil
}
-
// 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.
// `preferTCP` indicates that the client wants to use TCP (through OpenVPN) to establish the VPN tunnel.
diff --git a/client_test.go b/client_test.go
index 87d00f7..e6f991c 100644
--- a/client_test.go
+++ b/client_test.go
@@ -85,10 +85,10 @@ func Test_server(t *testing.T) {
t.Fatalf("Register error: %v", registerErr)
}
- _, addErr := state.AddCustomServer(serverURI)
- if addErr != nil {
+ _, addErr := state.AddCustomServer(serverURI)
+ if addErr != nil {
t.Fatalf("Add error: %v", addErr)
- }
+ }
_, _, configErr := state.GetConfigCustomServer(serverURI, false)
if configErr != nil {
t.Fatalf("Connect error: %v", configErr)
@@ -142,7 +142,7 @@ func test_connect_oauth_parameter(
t.Fatalf("Register error: %v", registerErr)
}
- _, addErr := state.AddCustomServer(serverURI)
+ _, addErr := state.AddCustomServer(serverURI)
var wrappedErr *types.WrappedErrorMessage
@@ -211,10 +211,10 @@ func Test_token_expired(t *testing.T) {
t.Fatalf("Register error: %v", registerErr)
}
- _, addErr := state.AddCustomServer(serverURI)
- if addErr != nil {
+ _, addErr := state.AddCustomServer(serverURI)
+ if addErr != nil {
t.Fatalf("Add error: %v", addErr)
- }
+ }
_, _, configErr := state.GetConfigCustomServer(serverURI, false)
@@ -271,10 +271,10 @@ func Test_token_invalid(t *testing.T) {
t.Fatalf("Register error: %v", registerErr)
}
- _, addErr := state.AddCustomServer(serverURI)
- if addErr != nil {
+ _, addErr := state.AddCustomServer(serverURI)
+ if addErr != nil {
t.Fatalf("Add error: %v", addErr)
- }
+ }
_, _, configErr := state.GetConfigCustomServer(serverURI, false)
@@ -328,10 +328,10 @@ func Test_invalid_profile_corrected(t *testing.T) {
t.Fatalf("Register error: %v", registerErr)
}
- _, addErr := state.AddCustomServer(serverURI)
- if addErr != nil {
+ _, addErr := state.AddCustomServer(serverURI)
+ if addErr != nil {
t.Fatalf("Add error: %v", addErr)
- }
+ }
_, _, configErr := state.GetConfigCustomServer(serverURI, false)
@@ -385,10 +385,10 @@ func Test_prefer_tcp(t *testing.T) {
t.Fatalf("Register error: %v", registerErr)
}
- _, addErr := state.AddCustomServer(serverURI)
- if addErr != nil {
+ _, addErr := state.AddCustomServer(serverURI)
+ if addErr != nil {
t.Fatalf("Add error: %v", addErr)
- }
+ }
// get a config with preferTCP set to true
config, configType, configErr := state.GetConfigCustomServer(serverURI, true)
diff --git a/cmd/cli/main.go b/cmd/cli/main.go
index dbded2d..68ebe8d 100644
--- a/cmd/cli/main.go
+++ b/cmd/cli/main.go
@@ -98,22 +98,22 @@ func getConfig(state *eduvpn.Client, url string, serverType ServerTypes) (string
}
// Prefer TCP is set to False
if serverType == ServerTypeInstituteAccess {
- _, addErr := state.AddInstituteServer(url)
- if addErr != nil {
- return "", "", addErr
- }
+ _, addErr := state.AddInstituteServer(url)
+ if addErr != nil {
+ return "", "", addErr
+ }
return state.GetConfigInstituteAccess(url, false)
} else if serverType == ServerTypeCustom {
- _, addErr := state.AddCustomServer(url)
- if addErr != nil {
- return "", "", addErr
- }
+ _, addErr := state.AddCustomServer(url)
+ if addErr != nil {
+ return "", "", addErr
+ }
return state.GetConfigCustomServer(url, false)
}
- _, addErr := state.AddSecureInternetHomeServer(url)
- if addErr != nil {
- return "", "", addErr
- }
+ _, addErr := state.AddSecureInternetHomeServer(url)
+ if addErr != nil {
+ return "", "", addErr
+ }
return state.GetConfigSecureInternet(url, false)
}
diff --git a/exports/exports.go b/exports/exports.go
index e319e87..63ef830 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -15,9 +15,10 @@ import "C"
import (
"fmt"
- "github.com/eduvpn/eduvpn-common/types"
"unsafe"
+ "github.com/eduvpn/eduvpn-common/types"
+
eduvpn "github.com/eduvpn/eduvpn-common"
)
diff --git a/fsm.go b/fsm.go
index 25d3e79..e476c83 100644
--- a/fsm.go
+++ b/fsm.go
@@ -131,7 +131,7 @@ func newFSM(
Transitions: []FSMTransition{
{To: STATE_CHOSEN_SERVER, Description: "Server info loaded"},
{
- To: STATE_ASK_LOCATION,
+ To: STATE_ASK_LOCATION,
Description: "User chooses a Secure Internet server but no location is configured",
},
{To: STATE_NO_SERVER, Description: "Go back or Error"},
diff --git a/internal/config/config.go b/internal/config/config.go
index ec9afa2..1d5a201 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -6,18 +6,18 @@ import (
"io/ioutil"
"path"
- "github.com/eduvpn/eduvpn-common/types"
"github.com/eduvpn/eduvpn-common/internal/util"
+ "github.com/eduvpn/eduvpn-common/types"
)
type Config struct {
Directory string
- Name string
+ Name string
}
func (config *Config) Init(directory string, name string) {
config.Directory = directory
- config.Name = name
+ config.Name = name
}
func (config *Config) GetFilename() string {
diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go
index e7270ea..1156dd0 100644
--- a/internal/discovery/discovery.go
+++ b/internal/discovery/discovery.go
@@ -6,9 +6,9 @@ import (
"time"
"github.com/eduvpn/eduvpn-common/internal/http"
- "github.com/eduvpn/eduvpn-common/types"
"github.com/eduvpn/eduvpn-common/internal/util"
"github.com/eduvpn/eduvpn-common/internal/verify"
+ "github.com/eduvpn/eduvpn-common/types"
)
type Discovery struct {
diff --git a/internal/http/http.go b/internal/http/http.go
index 15e2a17..02d83a6 100644
--- a/internal/http/http.go
+++ b/internal/http/http.go
@@ -157,7 +157,7 @@ func HTTPMethodWithOpts(
type HTTPStatusError struct {
URL string
- Body string
+ Body string
Status int
}
diff --git a/internal/log/log.go b/internal/log/log.go
index 7241164..970480f 100644
--- a/internal/log/log.go
+++ b/internal/log/log.go
@@ -6,8 +6,8 @@ import (
"os"
"path"
- "github.com/eduvpn/eduvpn-common/types"
"github.com/eduvpn/eduvpn-common/internal/util"
+ "github.com/eduvpn/eduvpn-common/types"
)
type FileLogger struct {
@@ -71,7 +71,7 @@ func (logger *FileLogger) Init(level LogLevel, name string, directory string) er
func (logger *FileLogger) Inherit(err error, msg string) {
level := types.GetErrorLevel(err)
- switch(level) {
+ switch level {
case types.ERR_INFO:
logger.Info(msg)
case types.ERR_WARNING:
@@ -81,7 +81,6 @@ func (logger *FileLogger) Inherit(err error, msg string) {
case types.ERR_FATAL:
logger.Fatal(msg)
}
-
}
func (logger *FileLogger) Info(msg string) {
diff --git a/internal/oauth/oauth.go b/internal/oauth/oauth.go
index 246f1e8..8db2d7e 100644
--- a/internal/oauth/oauth.go
+++ b/internal/oauth/oauth.go
@@ -87,8 +87,8 @@ type OAuthExchangeSession struct {
Verifier string
// filled in when constructing the callback
- Context context.Context
- Server *http.Server
+ Context context.Context
+ Server *http.Server
Listener net.Listener
}
diff --git a/internal/server/custom.go b/internal/server/custom.go
index 4d3c91c..feda1f3 100644
--- a/internal/server/custom.go
+++ b/internal/server/custom.go
@@ -3,6 +3,7 @@ package server
import (
"errors"
"fmt"
+
"github.com/eduvpn/eduvpn-common/types"
)
diff --git a/internal/verify/verify.go b/internal/verify/verify.go
index 458e5e5..43b6c74 100644
--- a/internal/verify/verify.go
+++ b/internal/verify/verify.go
@@ -3,8 +3,8 @@ package verify
import (
"fmt"
- "github.com/jedisct1/go-minisign"
"github.com/eduvpn/eduvpn-common/types"
+ "github.com/jedisct1/go-minisign"
)
// Verify verifies the signature (.minisig file format) on signedJson.