diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-24 15:40:39 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-24 15:40:39 +0100 |
| commit | 8be555e5f91c6069c3d51cb014f1849fd182b1dc (patch) | |
| tree | 9c78f2ee1f5122da1e1ed3e452682f7f6744778f /internal/server/api.go | |
| parent | 791fffebff4499e4fad3217e2160596e1b8b3eea (diff) | |
Style: Use stylecheck and fix errors
Diffstat (limited to 'internal/server/api.go')
| -rw-r--r-- | internal/server/api.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/server/api.go b/internal/server/api.go index be7281c..d315ada 100644 --- a/internal/server/api.go +++ b/internal/server/api.go @@ -20,7 +20,9 @@ func APIGetEndpoints(baseURL string) (*ServerEndpoints, error) { return nil, types.NewWrappedError(errorMessage, urlErr) } - url.Path = path.Join(url.Path, WellKnownPath) + wellKnownPath := "/.well-known/vpn-user-portal" + + url.Path = path.Join(url.Path, wellKnownPath) _, body, bodyErr := httpw.HTTPGet(url.String()) if bodyErr != nil { @@ -140,7 +142,7 @@ func GetPreferTCPString(preferTCP bool) string { func APIConnectWireguard( server Server, - profile_id string, + profileID string, pubkey string, preferTCP bool, supportsOpenVPN bool, @@ -158,7 +160,7 @@ func APIConnectWireguard( } urlForm := url.Values{ - "profile_id": {profile_id}, + "profile_id": {profileID}, "public_key": {pubkey}, "prefer_tcp": {GetPreferTCPString(preferTCP)}, } @@ -191,7 +193,7 @@ func APIConnectWireguard( return string(connectBody), content, pTime, nil } -func APIConnectOpenVPN(server Server, profile_id string, preferTCP bool) (string, time.Time, error) { +func APIConnectOpenVPN(server Server, profileID string, preferTCP bool) (string, time.Time, error) { errorMessage := "failed obtaining an OpenVPN configuration" headers := http.Header{ "content-type": {"application/x-www-form-urlencoded"}, @@ -199,7 +201,7 @@ func APIConnectOpenVPN(server Server, profile_id string, preferTCP bool) (string } urlForm := url.Values{ - "profile_id": {profile_id}, + "profile_id": {profileID}, "prefer_tcp": {GetPreferTCPString(preferTCP)}, } |
