mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 09:54:01 +03:00
fix: address staticcheck lint issues
- avoid deprecated DefaultIdleTimeout, use time.Minute directly - simplify embedded field selectors (QF1008)
This commit is contained in:
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user