chore(lint): upgrade from v1.51.2 to v1.52.2
This commit is contained in:
@@ -2,7 +2,7 @@ ARG ALPINE_VERSION=3.17
|
||||
ARG GO_ALPINE_VERSION=3.17
|
||||
ARG GO_VERSION=1.20
|
||||
ARG XCPUTRANSLATE_VERSION=v0.6.0
|
||||
ARG GOLANGCI_LINT_VERSION=v1.51.2
|
||||
ARG GOLANGCI_LINT_VERSION=v1.52.2
|
||||
ARG MOCKGEN_VERSION=v1.6.0
|
||||
ARG BUILDPLATFORM=linux/amd64
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (a *Alpine) Version(ctx context.Context) (version string, err error) {
|
||||
func (a *Alpine) Version(context.Context) (version string, err error) {
|
||||
file, err := os.OpenFile(a.alpineReleasePath, os.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
@@ -2,6 +2,6 @@ package cli
|
||||
|
||||
import "context"
|
||||
|
||||
func (c *CLI) CI(context context.Context) error {
|
||||
func (c *CLI) CI(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/healthcheck"
|
||||
)
|
||||
|
||||
func (c *CLI) HealthCheck(ctx context.Context, source Source, warner Warner) error {
|
||||
func (c *CLI) HealthCheck(ctx context.Context, source Source, _ Warner) error {
|
||||
// Extract the health server port from the configuration.
|
||||
config, err := source.ReadHealth()
|
||||
if err != nil {
|
||||
|
||||
@@ -8,9 +8,9 @@ func newNoopLogger() *noopLogger {
|
||||
return new(noopLogger)
|
||||
}
|
||||
|
||||
func (l *noopLogger) Debug(s string) {}
|
||||
func (l *noopLogger) Info(s string) {}
|
||||
func (l *noopLogger) Warn(s string) {}
|
||||
func (l *noopLogger) Error(s string) {}
|
||||
func (l *noopLogger) PatchLevel(level logging.Level) {}
|
||||
func (l *noopLogger) PatchPrefix(prefix string) {}
|
||||
func (l *noopLogger) Debug(string) {}
|
||||
func (l *noopLogger) Info(string) {}
|
||||
func (l *noopLogger) Warn(string) {}
|
||||
func (l *noopLogger) Error(string) {}
|
||||
func (l *noopLogger) PatchLevel(logging.Level) {}
|
||||
func (l *noopLogger) PatchPrefix(string) {}
|
||||
|
||||
@@ -95,14 +95,11 @@ func (c *Config) setIPv4AllPolicies(ctx context.Context, policy string) error {
|
||||
default:
|
||||
return fmt.Errorf("%w: %s", ErrPolicyUnknown, policy)
|
||||
}
|
||||
if err := c.runIptablesInstructions(ctx, []string{
|
||||
return c.runIptablesInstructions(ctx, []string{
|
||||
"--policy INPUT " + policy,
|
||||
"--policy OUTPUT " + policy,
|
||||
"--policy FORWARD " + policy,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (c *Config) acceptInputThroughInterface(ctx context.Context, intf string, remove bool) error {
|
||||
|
||||
@@ -64,6 +64,6 @@ var hopHeaders = [...]string{ //nolint:gochecknoglobals
|
||||
}
|
||||
|
||||
// Do not follow redirect, but directly return the redirect response.
|
||||
func returnRedirect(req *http.Request, via []*http.Request) error {
|
||||
func returnRedirect(*http.Request, []*http.Request) error {
|
||||
return http.ErrUseLastResponse
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ var _ Logger = (*testLogger)(nil)
|
||||
|
||||
type testLogger struct{}
|
||||
|
||||
func (t *testLogger) Info(msg string) {}
|
||||
func (t *testLogger) Warn(msg string) {}
|
||||
func (t *testLogger) Error(msg string) {}
|
||||
func (t *testLogger) Info(string) {}
|
||||
func (t *testLogger) Warn(string) {}
|
||||
func (t *testLogger) Error(string) {}
|
||||
|
||||
var _ gomock.Matcher = (*regexMatcher)(nil)
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
|
||||
portCh <- port
|
||||
|
||||
// Infinite loop
|
||||
err = startData.PortForwarder.KeepPortForward(ctx, l.client,
|
||||
port, startData.Gateway, startData.ServerName)
|
||||
err = startData.PortForwarder.KeepPortForward(ctx,
|
||||
startData.Gateway, startData.ServerName)
|
||||
errorCh <- err
|
||||
}(pfCtx, startData)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ var (
|
||||
)
|
||||
|
||||
// GetConnection gets the connection from the OpenVPN configuration file.
|
||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||
func (p *Provider) GetConnection(selection settings.ServerSelection, _ bool) (
|
||||
connection models.Connection, err error) {
|
||||
switch selection.VPN {
|
||||
case vpn.OpenVPN:
|
||||
|
||||
@@ -90,8 +90,8 @@ var (
|
||||
ErrPortForwardedExpired = errors.New("port forwarded data expired")
|
||||
)
|
||||
|
||||
func (p *Provider) KeepPortForward(ctx context.Context, client *http.Client,
|
||||
port uint16, gateway net.IP, serverName string) (err error) {
|
||||
func (p *Provider) KeepPortForward(ctx context.Context,
|
||||
gateway net.IP, serverName string) (err error) {
|
||||
privateIPClient, err := newHTTPClient(serverName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("creating custom HTTP client: %w", err)
|
||||
|
||||
@@ -18,8 +18,7 @@ type Provider struct {
|
||||
}
|
||||
|
||||
func New(storage common.Storage, randSource rand.Source,
|
||||
client *http.Client, updaterWarner common.Warner,
|
||||
parallelResolver common.ParallelResolver) *Provider {
|
||||
client *http.Client, updaterWarner common.Warner) *Provider {
|
||||
return &Provider{
|
||||
storage: storage,
|
||||
randSource: randSource,
|
||||
|
||||
@@ -24,6 +24,6 @@ type PortForwarder interface {
|
||||
PortForward(ctx context.Context, client *http.Client,
|
||||
logger utils.Logger, gateway net.IP, serverName string) (
|
||||
port uint16, err error)
|
||||
KeepPortForward(ctx context.Context, client *http.Client,
|
||||
port uint16, gateway net.IP, serverName string) (err error)
|
||||
KeepPortForward(ctx context.Context, gateway net.IP,
|
||||
serverName string) (err error)
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func NewProviders(storage Storage, timeNow func() time.Time,
|
||||
providers.Privado: privado.New(storage, randSource, ipFetcher, unzipper, updaterWarner, parallelResolver),
|
||||
providers.PrivateInternetAccess: privateinternetaccess.New(storage, randSource, timeNow, client),
|
||||
providers.Privatevpn: privatevpn.New(storage, randSource, unzipper, updaterWarner, parallelResolver),
|
||||
providers.Protonvpn: protonvpn.New(storage, randSource, client, updaterWarner, parallelResolver),
|
||||
providers.Protonvpn: protonvpn.New(storage, randSource, client, updaterWarner),
|
||||
providers.Purevpn: purevpn.New(storage, randSource, ipFetcher, unzipper, updaterWarner, parallelResolver),
|
||||
providers.SlickVPN: slickvpn.New(storage, randSource, client, updaterWarner, parallelResolver),
|
||||
providers.Surfshark: surfshark.New(storage, randSource, client, unzipper, updaterWarner, parallelResolver),
|
||||
|
||||
@@ -20,7 +20,7 @@ func NewNoFetcher(providerName string) *NoFetcher {
|
||||
|
||||
var ErrFetcherNotSupported = errors.New("fetching of servers is not supported")
|
||||
|
||||
func (n *NoFetcher) FetchServers(ctx context.Context, minServers int) (
|
||||
func (n *NoFetcher) FetchServers(context.Context, int) (
|
||||
servers []models.Server, err error) {
|
||||
return nil, fmt.Errorf("%w: for %s", ErrFetcherNotSupported, n.providerName)
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ type NoPortForwarder interface {
|
||||
PortForward(ctx context.Context, client *http.Client,
|
||||
logger Logger, gateway net.IP, serverName string) (
|
||||
port uint16, err error)
|
||||
KeepPortForward(ctx context.Context, client *http.Client,
|
||||
port uint16, gateway net.IP, serverName string) (err error)
|
||||
KeepPortForward(ctx context.Context, gateway net.IP,
|
||||
serverName string) (err error)
|
||||
}
|
||||
|
||||
type NoPortForwarding struct {
|
||||
@@ -28,12 +28,11 @@ func NewNoPortForwarding(providerName string) *NoPortForwarding {
|
||||
|
||||
var ErrPortForwardingNotSupported = errors.New("custom port forwarding obtention is not supported")
|
||||
|
||||
func (n *NoPortForwarding) PortForward(ctx context.Context, client *http.Client,
|
||||
logger Logger, gateway net.IP, serverName string) (port uint16, err error) {
|
||||
func (n *NoPortForwarding) PortForward(context.Context, *http.Client,
|
||||
Logger, net.IP, string) (port uint16, err error) {
|
||||
return 0, fmt.Errorf("%w: for %s", ErrPortForwardingNotSupported, n.providerName)
|
||||
}
|
||||
|
||||
func (n *NoPortForwarding) KeepPortForward(ctx context.Context, client *http.Client,
|
||||
port uint16, gateway net.IP, serverName string) (err error) {
|
||||
func (n *NoPortForwarding) KeepPortForward(context.Context, net.IP, string) (err error) {
|
||||
return fmt.Errorf("%w: for %s", ErrPortForwardingNotSupported, n.providerName)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ func (s *State) GetSettings() (settings settings.PublicIP) {
|
||||
return s.settings
|
||||
}
|
||||
|
||||
func (s *State) SetSettings(ctx context.Context, settings settings.PublicIP) (
|
||||
func (s *State) SetSettings(_ context.Context, settings settings.PublicIP) (
|
||||
outcome string) {
|
||||
s.settingsMu.Lock()
|
||||
|
||||
|
||||
@@ -31,9 +31,8 @@ func (c *closers) cleanup(logger Logger) {
|
||||
for i, closer := range closers {
|
||||
if closer.closed {
|
||||
continue
|
||||
} else {
|
||||
closers[i].closed = true
|
||||
}
|
||||
closers[i].closed = true
|
||||
logger.Debug(closer.operation + "...")
|
||||
err := closer.close()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user