summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api.go2
-rw-r--r--src/config.go2
-rw-r--r--src/http.go3
-rw-r--r--src/oauth.go8
-rw-r--r--src/server.go18
-rw-r--r--src/verify.go3
-rw-r--r--src/wireguard.go3
7 files changed, 19 insertions, 20 deletions
diff --git a/src/api.go b/src/api.go
index cc84989..5a6ba7d 100644
--- a/src/api.go
+++ b/src/api.go
@@ -1,8 +1,8 @@
package eduvpn
import (
- "fmt"
"encoding/json"
+ "fmt"
"net/http"
"net/url"
)
diff --git a/src/config.go b/src/config.go
index 0b7c1c7..6e085d0 100644
--- a/src/config.go
+++ b/src/config.go
@@ -22,7 +22,7 @@ func (eduvpn *VPNState) WriteConfig() error {
if marshalErr != nil {
return marshalErr
}
- return ioutil.WriteFile(eduvpn.GetConfigName(), jsonString, 0644)
+ return ioutil.WriteFile(eduvpn.GetConfigName(), jsonString, 0o644)
}
func (eduvpn *VPNState) LoadConfig() error {
diff --git a/src/http.go b/src/http.go
index 8cb32b2..bc2cc20 100644
--- a/src/http.go
+++ b/src/http.go
@@ -66,7 +66,6 @@ type HTTPOptionalParams struct {
// Construct an URL including on parameters
func HTTPConstructURL(baseURL string, parameters URLParameters) (string, error) {
url, err := url.Parse(baseURL)
-
if err != nil {
return "", err
}
@@ -116,7 +115,6 @@ func httpOptionalHeaders(req *http.Request, opts *HTTPOptionalParams) {
req.Header.Add(k, v[0])
}
}
-
}
func httpOptionalBodyReader(opts *HTTPOptionalParams) io.Reader {
@@ -127,7 +125,6 @@ func httpOptionalBodyReader(opts *HTTPOptionalParams) io.Reader {
}
func HTTPMethodWithOpts(method string, url string, opts *HTTPOptionalParams) (http.Header, []byte, error) {
-
// Make sure the url contains all the parameters
// This can return an error,
// it already has the right error so so we don't wrap it further
diff --git a/src/oauth.go b/src/oauth.go
index 291a409..92c64d4 100644
--- a/src/oauth.go
+++ b/src/oauth.go
@@ -19,7 +19,6 @@ import (
// client.
func genState() (string, error) {
randomBytes, err := MakeRandomByteSlice(32)
-
if err != nil {
return "", &OAuthGenStateUnableError{Err: err}
}
@@ -120,7 +119,8 @@ func (oauth *OAuth) getTokensWithAuthCode(authCode string) error {
"redirect_uri": {"http://127.0.0.1:8000/callback"},
}
headers := &http.Header{
- "content-type": {"application/x-www-form-urlencoded"}}
+ "content-type": {"application/x-www-form-urlencoded"},
+ }
opts := &HTTPOptionalParams{Headers: headers, Body: data}
current_time := generateTimeSeconds()
_, body, bodyErr := HTTPPostWithOpts(reqURL, opts)
@@ -157,7 +157,8 @@ func (oauth *OAuth) getTokensWithRefresh() error {
"grant_type": {"refresh_token"},
}
headers := &http.Header{
- "content-type": {"application/x-www-form-urlencoded"}}
+ "content-type": {"application/x-www-form-urlencoded"},
+ }
opts := &HTTPOptionalParams{Headers: headers, Body: data}
current_time := generateTimeSeconds()
_, body, bodyErr := HTTPPostWithOpts(reqURL, opts)
@@ -210,7 +211,6 @@ func (oauth *OAuth) Callback(w http.ResponseWriter, req *http.Request) {
// Now that we have obtained the authorization code, we can move to the next step:
// Obtaining the access and refresh tokens
err := oauth.getTokensWithAuthCode(extractedCode)
-
if err != nil {
oauth.Session.CallbackError = &OAuthFailedCallbackGetTokensError{Err: err}
go oauth.Session.Server.Shutdown(oauth.Session.Context)
diff --git a/src/server.go b/src/server.go
index 1dc0f88..d512049 100644
--- a/src/server.go
+++ b/src/server.go
@@ -1,27 +1,27 @@
package eduvpn
import (
- "errors"
"encoding/json"
+ "errors"
)
type Server struct {
- BaseURL string `json:"base_url"`
- Endpoints *ServerEndpoints `json:"endpoints"`
- OAuth *OAuth `json:"oauth"`
+ BaseURL string `json:"base_url"`
+ Endpoints *ServerEndpoints `json:"endpoints"`
+ OAuth *OAuth `json:"oauth"`
Profiles *ServerProfileInfo `json:"profiles"`
}
type ServerProfile struct {
- ID string `json:"profile_id"`
- DisplayName string `json:"display_name"`
- VPNProtoList []string `json:"vpn_proto_list"`
- DefaultGateway bool `json:"default_gateway"`
+ ID string `json:"profile_id"`
+ DisplayName string `json:"display_name"`
+ VPNProtoList []string `json:"vpn_proto_list"`
+ DefaultGateway bool `json:"default_gateway"`
}
type ServerProfileInfo struct {
Current uint8 `json:"current_profile"`
- Info struct {
+ Info struct {
ProfileList []ServerProfile `json:"profile_list"`
} `json:"info"`
}
diff --git a/src/verify.go b/src/verify.go
index fc30087..3c87fe1 100644
--- a/src/verify.go
+++ b/src/verify.go
@@ -3,8 +3,9 @@ package eduvpn
import (
"errors"
"fmt"
- "github.com/jedisct1/go-minisign"
"os"
+
+ "github.com/jedisct1/go-minisign"
)
// getKeys returns keys taken from https://git.sr.ht/~eduvpn/disco.eduvpn.org#public-keys.
diff --git a/src/wireguard.go b/src/wireguard.go
index 96e7547..b701b1d 100644
--- a/src/wireguard.go
+++ b/src/wireguard.go
@@ -2,8 +2,9 @@ package eduvpn
import (
"fmt"
- "golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"regexp"
+
+ "golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)
func wireguardGenerateKey() (wgtypes.Key, error) {