Add linters and fix lint issues

This commit is contained in:
Quentin McGaw
2020-10-20 02:45:28 +00:00
parent f9bef8ecda
commit 9c73faaaeb
107 changed files with 739 additions and 422 deletions

View File

@@ -6,21 +6,21 @@ import (
)
type (
// VPNDevice is the device name used to tunnel using Openvpn
// VPNDevice is the device name used to tunnel using Openvpn.
VPNDevice string
// DNSProvider is a DNS over TLS server provider name
// DNSProvider is a DNS over TLS server provider name.
DNSProvider string
// DNSHost is the DNS host to use for TLS validation
// DNSHost is the DNS host to use for TLS validation.
DNSHost string
// URL is an HTTP(s) URL address
// URL is an HTTP(s) URL address.
URL string
// Filepath is a local filesytem file path
// Filepath is a local filesytem file path.
Filepath string
// TinyProxyLogLevel is the log level for TinyProxy
// TinyProxyLogLevel is the log level for TinyProxy.
TinyProxyLogLevel string
// VPNProvider is the name of the VPN provider to be used
// VPNProvider is the name of the VPN provider to be used.
VPNProvider string
// NetworkProtocol contains the network protocol to be used to communicate with the VPN servers
// NetworkProtocol contains the network protocol to be used to communicate with the VPN servers.
NetworkProtocol string
)

View File

@@ -2,7 +2,7 @@ package models
import "net"
// DNSProviderData contains information for a DNS provider
// DNSProviderData contains information for a DNS provider.
type DNSProviderData struct {
IPs []net.IP
SupportsTLS bool

View File

@@ -6,7 +6,7 @@ import (
"strings"
)
// ProviderSettings contains settings specific to a VPN provider
// ProviderSettings contains settings specific to a VPN provider.
type ProviderSettings struct {
Name VPNProvider `json:"name"`
ServerSelection ServerSelection `json:"serverSelection"`
@@ -14,7 +14,7 @@ type ProviderSettings struct {
PortForwarding PortForwarding `json:"portForwarding"`
}
type ServerSelection struct { //nolint:maligned
type ServerSelection struct {
// Common
Protocol NetworkProtocol `json:"networkProtocol"`
TargetIP net.IP `json:"targetIP,omitempty"`
@@ -49,7 +49,7 @@ type ExtraConfigOptions struct {
OpenVPNIPv6 bool `json:"openvpnIPv6"` // Mullvad
}
// PortForwarding contains settings for port forwarding
// PortForwarding contains settings for port forwarding.
type PortForwarding struct {
Enabled bool `json:"enabled"`
Filepath Filepath `json:"filepath"`

View File

@@ -47,6 +47,7 @@ func Test_MullvadServer_String(t *testing.T) {
ISP: "not spying on you",
Owned: true,
},
//nolint:lll
s: `{Country: "That Country", City: "That City", ISP: "not spying on you", Owned: true, IPs: []net.IP{{1, 1, 1, 1}}, IPsV6: []net.IP{{0x20, 0x1, 0xd, 0xb8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x1}}}`,
},
}
@@ -127,6 +128,7 @@ func Test_stringifyIPs(t *testing.T) {
{0x20, 0x1, 0xd, 0xb8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x1},
{0, 0, 0, 0},
},
//nolint:lll
s: "[]net.IP{{10, 16, 54, 25}, {0x20, 0x1, 0xd, 0xb8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x1}, {}}",
},
}