fix: address staticcheck lint issues

- avoid deprecated DefaultIdleTimeout, use time.Minute directly
- simplify embedded field selectors (QF1008)
This commit is contained in:
Alexey Dolotov
2026-03-28 22:59:32 +03:00
parent 289bb283b1
commit f355512aa6
3 changed files with 5 additions and 4 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"net"
"os"
"time"
"github.com/9seconds/mtg/v2/antireplay"
"github.com/9seconds/mtg/v2/events"
@@ -262,7 +263,7 @@ func runProxy(conf *config.Config, version string) error { //nolint: funlen
AllowFallbackOnUnknownDC: conf.AllowFallbackOnUnknownDC.Get(false),
TolerateTimeSkewness: conf.TolerateTimeSkewness.Value,
IdleTimeout: conf.Network.Timeout.Idle.Get(mtglib.DefaultIdleTimeout),
IdleTimeout: conf.Network.Timeout.Idle.Get(time.Minute),
DoppelGangerURLs: doppelGangerURLs,
DoppelGangerPerRaid: conf.Defense.Doppelganger.Repeats.Get(mtglib.DoppelGangerPerRaid),
+2 -2
View File
@@ -104,13 +104,13 @@ type connIdleTimeout struct {
}
func (c connIdleTimeout) Read(b []byte) (int, error) {
c.Conn.SetReadDeadline(time.Now().Add(c.timeout)) //nolint: errcheck
c.SetReadDeadline(time.Now().Add(c.timeout)) //nolint: errcheck
return c.Conn.Read(b) //nolint: wrapcheck
}
func (c connIdleTimeout) Write(b []byte) (int, error) {
c.Conn.SetWriteDeadline(time.Now().Add(c.timeout)) //nolint: errcheck
c.SetWriteDeadline(time.Now().Add(c.timeout)) //nolint: errcheck
return c.Conn.Write(b) //nolint: wrapcheck
}
+1 -1
View File
@@ -218,7 +218,7 @@ func (p ProxyOpts) getPreferIP() string {
func (p ProxyOpts) getIdleTimeout() time.Duration {
if p.IdleTimeout == 0 {
return DefaultIdleTimeout
return time.Minute
}
return p.IdleTimeout