summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/api/profiles/profiles.go10
-rw-r--r--internal/failover/monitor.go2
-rw-r--r--internal/server/server.go2
-rw-r--r--internal/wireguard/ini/ini_test.go116
4 files changed, 65 insertions, 65 deletions
diff --git a/internal/api/profiles/profiles.go b/internal/api/profiles/profiles.go
index 7b9dafc..111a835 100644
--- a/internal/api/profiles/profiles.go
+++ b/internal/api/profiles/profiles.go
@@ -6,12 +6,12 @@ import (
)
type Profile struct {
- ID string `json:"profile_id"`
- DisplayName string `json:"display_name"`
- VPNProtoList []string `json:"vpn_proto_list"`
+ ID string `json:"profile_id"`
+ DisplayName string `json:"display_name"`
+ VPNProtoList []string `json:"vpn_proto_list"`
VPNProtoTransportList []string `json:"vpn_proto_transport_list"`
- DefaultGateway bool `json:"default_gateway"`
- DNSSearchDomains []string `json:"dns_search_domain_list"`
+ DefaultGateway bool `json:"default_gateway"`
+ DNSSearchDomains []string `json:"dns_search_domain_list"`
}
type ListInfo struct {
diff --git a/internal/failover/monitor.go b/internal/failover/monitor.go
index 987cce6..d9028f2 100644
--- a/internal/failover/monitor.go
+++ b/internal/failover/monitor.go
@@ -1,9 +1,9 @@
package failover
import (
- "fmt"
"context"
"errors"
+ "fmt"
"time"
"github.com/eduvpn/eduvpn-common/internal/log"
diff --git a/internal/server/server.go b/internal/server/server.go
index 1f73791..bffeb2c 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -150,7 +150,7 @@ func (s *Server) connect(ctx context.Context, wgSupport bool, pTCP bool) (*srvty
Protocol: apicfg.Protocol,
DefaultGateway: chosenP.DefaultGateway,
DNSSearchDomains: chosenP.DNSSearchDomains,
- ShouldFailover: chosenP.ShouldFailover(),
+ ShouldFailover: chosenP.ShouldFailover(),
Proxy: proxy,
}, nil
}
diff --git a/internal/wireguard/ini/ini_test.go b/internal/wireguard/ini/ini_test.go
index 5382878..5168dda 100644
--- a/internal/wireguard/ini/ini_test.go
+++ b/internal/wireguard/ini/ini_test.go
@@ -8,20 +8,20 @@ import (
)
func TestShouldSkip(t *testing.T) {
- cases := []struct{
- in string
+ cases := []struct {
+ in string
want bool
}{
{
- in: "test",
+ in: "test",
want: false,
},
{
- in: "#test",
+ in: "#test",
want: true,
},
{
- in: "",
+ in: "",
want: true,
},
}
@@ -35,25 +35,25 @@ func TestShouldSkip(t *testing.T) {
}
func TestIsSection(t *testing.T) {
- cases := []struct{
- in string
+ cases := []struct {
+ in string
want bool
}{
{
- in: "[test]",
+ in: "[test]",
want: true,
},
{
- in: "#test",
+ in: "#test",
want: false,
},
{
- in: "key=val",
+ in: "key=val",
want: false,
},
// sections with empty names will be ignored later
{
- in: "[]",
+ in: "[]",
want: true,
},
}
@@ -67,24 +67,24 @@ func TestIsSection(t *testing.T) {
}
func TestSectionName(t *testing.T) {
- cases := []struct{
- in string
+ cases := []struct {
+ in string
want string
}{
{
- in: "[test]",
+ in: "[test]",
want: "test",
},
{
- in: "[ spaces ]",
+ in: "[ spaces ]",
want: "spaces",
},
{
- in: "[]",
+ in: "[]",
want: "",
},
{
- in: "",
+ in: "",
want: "",
},
}
@@ -98,52 +98,52 @@ func TestSectionName(t *testing.T) {
}
func TestKeyValue(t *testing.T) {
- cases := []struct{
- in string
- wantk string
- wantv string
+ cases := []struct {
+ in string
+ wantk string
+ wantv string
wanterr string
}{
{
- in: "bla",
- wantk: "",
- wantv: "",
+ in: "bla",
+ wantk: "",
+ wantv: "",
wanterr: "no key/value found",
},
{
- in: "foo=bar",
- wantk: "foo",
- wantv: "bar",
+ in: "foo=bar",
+ wantk: "foo",
+ wantv: "bar",
wanterr: "",
},
{
- in: " foo = bar ",
- wantk: "foo",
- wantv: "bar",
+ in: " foo = bar ",
+ wantk: "foo",
+ wantv: "bar",
wanterr: "",
},
{
- in: "foo = bar",
- wantk: "foo",
- wantv: "bar",
+ in: "foo = bar",
+ wantk: "foo",
+ wantv: "bar",
wanterr: "",
},
{
- in: "",
- wantk: "",
- wantv: "",
+ in: "",
+ wantk: "",
+ wantv: "",
wanterr: "no key/value found",
},
{
- in: "=",
- wantk: "",
- wantv: "",
+ in: "=",
+ wantk: "",
+ wantv: "",
wanterr: "key cannot be empty",
},
{
- in: "empty=",
- wantk: "empty",
- wantv: "",
+ in: "empty=",
+ wantk: "empty",
+ wantv: "",
wanterr: "",
},
}
@@ -161,30 +161,30 @@ func TestKeyValue(t *testing.T) {
}
func TestOrderedKeysFind(t *testing.T) {
- cases := []struct{
- v OrderedKeys
+ cases := []struct {
+ v OrderedKeys
in string
- w int
+ w int
}{
{
- v: []string{""},
+ v: []string{""},
in: "test",
- w: -1,
+ w: -1,
},
{
- v: []string{"bla"},
+ v: []string{"bla"},
in: "bla",
- w: 0,
+ w: 0,
},
{
- v: []string{"ha"},
+ v: []string{"ha"},
in: "bla",
- w: -1,
+ w: -1,
},
{
- v: []string{"ha", "ga"},
+ v: []string{"ha", "ga"},
in: "ga",
- w: 1,
+ w: 1,
},
}
@@ -197,23 +197,23 @@ func TestOrderedKeysFind(t *testing.T) {
}
func TestOrderedKeysRemove(t *testing.T) {
- cases := []struct{
- v OrderedKeys
+ cases := []struct {
+ v OrderedKeys
rem string
out OrderedKeys
}{
{
- v: []string{"bla"},
+ v: []string{"bla"},
rem: "test",
out: []string{"bla"},
},
{
- v: []string{"bla"},
+ v: []string{"bla"},
rem: "bla",
out: []string{},
},
{
- v: []string{"ha", "ga"},
+ v: []string{"ha", "ga"},
rem: "ga",
out: []string{"ha"},
},