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(8080, 553, 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{
AuthUserPass: 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

@@ -1,7 +1,8 @@
package updater
func getUniqueHosts(tcpHostToURL, udpHostToURL map[string]string) (
hosts []string) {
hosts []string,
) {
uniqueHosts := make(map[string]struct{}, len(tcpHostToURL))
for host := range tcpHostToURL {
uniqueHosts[host] = struct{}{}

View File

@@ -9,7 +9,8 @@ import (
)
func getAllHostToURL(ctx context.Context, client *http.Client) (
tcpHostToURL, udpHostToURL map[string]string, err error) {
tcpHostToURL, udpHostToURL map[string]string, err error,
) {
tcpHostToURL, err = getHostToURL(ctx, client, "TCP")
if err != nil {
return nil, nil, err
@@ -24,7 +25,8 @@ func getAllHostToURL(ctx context.Context, client *http.Client) (
}
func getHostToURL(ctx context.Context, client *http.Client, protocol string) (
hostToURL map[string]string, err error) {
hostToURL map[string]string, err error,
) {
const baseURL = "https://vpn.hidemyass.com/vpn-config"
indexURL := baseURL + "/" + strings.ToUpper(protocol) + "/"

View File

@@ -11,7 +11,8 @@ import (
var indexOpenvpnLinksRegex = regexp.MustCompile(`<a[ ]+href=".+\.ovpn">.+\.ovpn</a>`)
func fetchIndex(ctx context.Context, client *http.Client, indexURL string) (
openvpnURLs []string, err error) {
openvpnURLs []string, err error,
) {
request, err := http.NewRequestWithContext(ctx, http.MethodGet, indexURL, nil)
if err != nil {
return nil, err

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,
) {
tcpHostToURL, udpHostToURL, err := getAllHostToURL(ctx, u.client)
if err != nil {
return nil, 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,