chore: use gofumpt for code formatting

This commit is contained in:
Quentin McGaw
2024-10-11 19:20:48 +00:00
parent 3daf15a612
commit 76a4bb5dc3
289 changed files with 784 additions and 548 deletions

View File

@@ -7,7 +7,8 @@ import (
)
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
connection models.Connection, err error) {
connection models.Connection, err error,
) {
defaults := utils.NewConnectionDefaults(443, 1194, 51820) //nolint:mnd
return utils.GetConnection(p.Name(),
p.storage, selection, defaults, ipv6Supported, p.randSource)

View File

@@ -8,7 +8,8 @@ import (
)
func (p *Provider) OpenVPNConfig(connection models.Connection,
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
settings settings.OpenVPN, ipv6Supported bool,
) (lines []string) {
//nolint:mnd
providerSettings := utils.OpenVPNProviderSettings{
AuthUserPass: true,

View File

@@ -16,7 +16,8 @@ type Provider struct {
}
func New(storage common.Storage, randSource rand.Source,
client *http.Client, updaterWarner common.Warner) *Provider {
client *http.Client, updaterWarner common.Warner,
) *Provider {
return &Provider{
storage: storage,
randSource: randSource,

View File

@@ -8,12 +8,11 @@ import (
"net/http"
)
var (
ErrHTTPStatusCodeNotOK = errors.New("HTTP status code not OK")
)
var ErrHTTPStatusCodeNotOK = errors.New("HTTP status code not OK")
func fetchAPI(ctx context.Context, client *http.Client,
limit uint) (data serversData, err error) {
limit uint,
) (data serversData, err error) {
url := "https://api.nordvpn.com/v2/servers"
url += fmt.Sprintf("?limit=%d", limit) // 0 means no limit

View File

@@ -175,7 +175,8 @@ var (
// wireguardPublicKey returns the Wireguard public key for the server.
func (s *serverData) wireguardPublicKey(technologies map[uint32]technologyData) (
wgPubKey string, err error) {
wgPubKey string, err error,
) {
for _, technology := range s.Technologies {
data, ok := technologies[technology.ID]
if !ok || data.Identifier != "wireguard_udp" {

View File

@@ -11,12 +11,11 @@ import (
"github.com/qdm12/gluetun/internal/provider/common"
)
var (
ErrNotIPv4 = errors.New("IP address is not IPv4")
)
var ErrNotIPv4 = errors.New("IP address is not IPv4")
func (u *Updater) FetchServers(ctx context.Context, minServers int) (
servers []models.Server, err error) {
servers []models.Server, err error,
) {
const limit = 0
data, err := fetchAPI(ctx, u.client, limit)
if err != nil {
@@ -47,7 +46,8 @@ func (u *Updater) FetchServers(ctx context.Context, minServers int) (
func extractServers(jsonServer serverData, groups map[uint32]groupData,
services map[uint32]serviceData, locations map[uint32]locationData,
technologies map[uint32]technologyData) (servers []models.Server,
warnings []string) {
warnings []string,
) {
ignoreReason := ""
switch {
case jsonServer.Status != "online":