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(110, 1282, 0) //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{
RemoteCertTLS: true,

View File

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

View File

@@ -11,7 +11,8 @@ import (
)
func (u *Updater) FetchServers(ctx context.Context, minServers int) (
servers []models.Server, err error) {
servers []models.Server, err error,
) {
servers, err = fetchServers(ctx, u.client, u.warner)
if err != nil {
return nil, fmt.Errorf("fetching servers: %w", err)

View File

@@ -13,7 +13,8 @@ type Updater struct {
}
func New(client *http.Client, warner common.Warner,
parallelResolver common.ParallelResolver) *Updater {
parallelResolver common.ParallelResolver,
) *Updater {
return &Updater{
client: client,
parallelResolver: parallelResolver,

View File

@@ -14,7 +14,8 @@ import (
)
func fetchServers(ctx context.Context, client *http.Client,
warner common.Warner) (servers []models.Server, err error) {
warner common.Warner,
) (servers []models.Server, err error) {
const url = "https://www.vpnsecure.me/vpn-locations/"
rootNode, err := htmlutils.Fetch(ctx, client, url)
if err != nil {
@@ -32,14 +33,13 @@ func fetchServers(ctx context.Context, client *http.Client,
return servers, nil
}
var (
ErrHTMLServersDivNotFound = errors.New("HTML servers container div not found")
)
var ErrHTMLServersDivNotFound = errors.New("HTML servers container div not found")
const divString = "div"
func parseHTML(rootNode *html.Node) (servers []models.Server,
warnings []string, err error) {
warnings []string, err error,
) {
// Find div container for all servers, searching with BFS.
serversDiv := findServersDiv(rootNode)
if serversDiv == nil {
@@ -86,7 +86,8 @@ func parseHTML(rootNode *html.Node) (servers []models.Server,
}
func parseHTMLGridItem(gridItem *html.Node) (
server models.Server, warning string) {
server models.Server, warning string,
) {
gridItemDT := htmlutils.DirectChild(gridItem, matchDT)
if gridItemDT == nil {
return server, htmlutils.WrapWarning("grid item <dt> not found", gridItem)
@@ -221,7 +222,8 @@ func matchStatusSpan(node *html.Node) (match bool) {
}
func findSpanStrong(gridItemDD *html.Node, spanData string) (
strongValue string) {
strongValue string,
) {
spanFound := false
for child := gridItemDD.FirstChild; child != nil; child = child.NextSibling {
if !htmlutils.MatchData("div")(child) {