bump golangci-lint to 2.13.1 (#6129)
* bump golangci-lint to 2.13.1 * additional changes --------- Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
@@ -26,7 +26,7 @@ jobs:
|
||||
|
||||
- uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.12.2
|
||||
version: v2.13.1
|
||||
|
||||
go_mod:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
@@ -295,7 +295,7 @@ func (m *Manager) pullJWTJWKS() (jwt.Keyfunc, error) {
|
||||
defer tr.CloseIdleConnections()
|
||||
|
||||
httpClient := &http.Client{
|
||||
Timeout: (m.ReadTimeout),
|
||||
Timeout: m.ReadTimeout,
|
||||
Transport: tr,
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -30,7 +30,7 @@ func loadEnvInternal(env map[string]string, prefix string, prv reflect.Value) er
|
||||
|
||||
rt := prv.Type().Elem()
|
||||
|
||||
if i, ok := prv.Interface().(Unmarshaler); ok {
|
||||
if i, ok := reflect.TypeAssert[Unmarshaler](prv); ok {
|
||||
if ev, ok2 := env[prefix]; ok2 {
|
||||
if prv.IsNil() {
|
||||
prv.Set(reflect.New(rt))
|
||||
@@ -124,8 +124,8 @@ func loadEnvInternal(env map[string]string, prefix string, prv reflect.Value) er
|
||||
continue
|
||||
}
|
||||
|
||||
mapKey := strings.Split(k[len(prefix+"_"):], "_")[0]
|
||||
if len(mapKey) == 0 {
|
||||
mapKey, _, _ := strings.Cut(k[len(prefix+"_"):], "_")
|
||||
if mapKey == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ func decode(v reflect.Value, raw json.RawMessage, path string) error {
|
||||
v = v.Elem()
|
||||
}
|
||||
|
||||
if unm, ok := v.Addr().Interface().(json.Unmarshaler); ok {
|
||||
if unm, ok := reflect.TypeAssert[json.Unmarshaler](v.Addr()); ok {
|
||||
return unm.UnmarshalJSON(raw)
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ func (e *Estimator) Estimate(pts int64) time.Time {
|
||||
return now
|
||||
}
|
||||
|
||||
computed := e.refNTP.Add((multiplyAndDivide(time.Duration(pts-e.refPTS), time.Second, time.Duration(e.ClockRate))))
|
||||
computed := e.refNTP.Add(multiplyAndDivide(time.Duration(pts-e.refPTS), time.Second, time.Duration(e.ClockRate)))
|
||||
|
||||
if computed.After(now) || computed.Before(now.Add(-maxTimeDifference)) {
|
||||
e.refNTP = now
|
||||
|
||||
@@ -40,9 +40,10 @@ func writeSegment1(t *testing.T, fpath string) {
|
||||
TimeScale: 48000,
|
||||
Codec: &mcodecs.MPEG4Audio{
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
ChannelConfig: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -118,9 +119,10 @@ func writeSegment2(t *testing.T, fpath string) {
|
||||
TimeScale: 48000,
|
||||
Codec: &mcodecs.MPEG4Audio{
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -260,9 +262,10 @@ func TestOnGet(t *testing.T) {
|
||||
TimeScale: 48000,
|
||||
Codec: &mcodecs.MPEG4Audio{
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
ChannelConfig: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -662,7 +665,7 @@ func TestOnGet(t *testing.T) {
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
ChannelConfig: 2,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -32,9 +32,10 @@ func writeBenchInit(f io.WriteSeeker) {
|
||||
TimeScale: 90000,
|
||||
Codec: &mcodecs.MPEG4Audio{
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
ChannelConfig: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -98,9 +99,10 @@ func TestSegmentFMP4CanBeConcatenated(t *testing.T) {
|
||||
TimeScale: 48000,
|
||||
Codec: &mcodecs.MPEG4Audio{
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -406,9 +408,10 @@ func TestSegmentFMP4CanBeConcatenated(t *testing.T) {
|
||||
TimeScale: 90000,
|
||||
Codec: &mcodecs.MPEG4Audio{
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: 48000,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -66,9 +66,10 @@ func TestToStream(t *testing.T) {
|
||||
Programs: []*mpeg4audio.StreamMuxConfigProgram{{
|
||||
Layers: []*mpeg4audio.StreamMuxConfigLayer{{
|
||||
AudioSpecificConfig: &mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Type: 2,
|
||||
SampleRate: 48000,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
LatmBufferFullness: 255,
|
||||
}},
|
||||
@@ -137,7 +138,7 @@ func TestToStream(t *testing.T) {
|
||||
AudioSpecificConfig: &mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
ChannelConfig: 2,
|
||||
},
|
||||
LatmBufferFullness: 255,
|
||||
|
||||
@@ -23,8 +23,8 @@ type Listener struct {
|
||||
func (l *Listener) Initialize() {
|
||||
l.inner = &proxyproto.Listener{
|
||||
Listener: l.Wrapped,
|
||||
Policy: func(upstream net.Addr) (proxyproto.Policy, error) {
|
||||
tcpAddr, ok := upstream.(*net.TCPAddr)
|
||||
ConnPolicy: func(connPolicyOptions proxyproto.ConnPolicyOptions) (proxyproto.Policy, error) {
|
||||
tcpAddr, ok := connPolicyOptions.Upstream.(*net.TCPAddr)
|
||||
if ok && l.TrustedProxies.Contains(tcpAddr.IP) {
|
||||
return proxyproto.USE, nil
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package proxy
|
||||
package proxy_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/proxy"
|
||||
)
|
||||
|
||||
func trustedProxies(cidrs ...string) conf.IPNetworks {
|
||||
@@ -30,7 +31,7 @@ func TestListenerTrustedWithHeader(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer ln.Close()
|
||||
|
||||
wrapped := &Listener{Wrapped: ln, TrustedProxies: trustedProxies("127.0.0.1/32")}
|
||||
wrapped := &proxy.Listener{Wrapped: ln, TrustedProxies: trustedProxies("127.0.0.1/32")}
|
||||
wrapped.Initialize()
|
||||
|
||||
done := make(chan struct{})
|
||||
@@ -69,7 +70,7 @@ func TestListenerTrustedWithoutHeader(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer ln.Close()
|
||||
|
||||
wrapped := &Listener{Wrapped: ln, TrustedProxies: trustedProxies("127.0.0.1/32")}
|
||||
wrapped := &proxy.Listener{Wrapped: ln, TrustedProxies: trustedProxies("127.0.0.1/32")}
|
||||
wrapped.Initialize()
|
||||
|
||||
done := make(chan struct{})
|
||||
@@ -102,7 +103,7 @@ func TestListenerUntrustedIgnoresHeader(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer ln.Close()
|
||||
|
||||
wrapped := &Listener{Wrapped: ln, TrustedProxies: trustedProxies("10.0.0.0/8")}
|
||||
wrapped := &proxy.Listener{Wrapped: ln, TrustedProxies: trustedProxies("10.0.0.0/8")}
|
||||
wrapped.Initialize()
|
||||
|
||||
done := make(chan struct{})
|
||||
|
||||
@@ -710,7 +710,7 @@ func TestFromStreamLegacyClientMultipleTracks(t *testing.T) {
|
||||
aacConfig2 := &mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2, // MPEG4-AAC LC
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
ChannelConfig: 2,
|
||||
}
|
||||
|
||||
|
||||
@@ -772,7 +772,6 @@ func (f *formatFMP4) initialize() bool {
|
||||
codec := &mcodecs.AC3{
|
||||
SampleRate: origFormat.SampleRate,
|
||||
ChannelCount: origFormat.ChannelCount,
|
||||
Fscod: 0,
|
||||
Bsid: 8,
|
||||
Bsmod: 0,
|
||||
Acmod: 7,
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4video"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
tscodecs "github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts/codecs"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts/substructs"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/defs"
|
||||
"github.com/bluenviron/mediamtx/internal/formatlabel"
|
||||
@@ -243,7 +244,9 @@ func (f *formatMPEGTS) initialize() bool {
|
||||
|
||||
case *rtspformat.Opus:
|
||||
track := addTrack(&tscodecs.Opus{
|
||||
ChannelCount: forma.ChannelCount,
|
||||
Desc: &substructs.OpusAudioDescriptor{
|
||||
ChannelConfigCode: 2,
|
||||
},
|
||||
})
|
||||
|
||||
f.ri.reader.OnData(
|
||||
|
||||
@@ -43,9 +43,10 @@ func TestRecorder(t *testing.T) {
|
||||
Formats: []rtspformat.Format{&rtspformat.MPEG4Audio{
|
||||
PayloadTyp: 96,
|
||||
Config: &mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
SizeLength: 13,
|
||||
IndexLength: 3,
|
||||
@@ -280,7 +281,7 @@ func TestRecorder(t *testing.T) {
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
ChannelConfig: 2,
|
||||
},
|
||||
},
|
||||
@@ -411,9 +412,10 @@ func TestRecorderFMP4NegativeInitialDTS(t *testing.T) {
|
||||
Formats: []rtspformat.Format{&rtspformat.MPEG4Audio{
|
||||
PayloadTyp: 96,
|
||||
Config: &mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
SizeLength: 13,
|
||||
IndexLength: 3,
|
||||
@@ -504,9 +506,10 @@ func TestRecorderFMP4NegativeDTSDiff(t *testing.T) {
|
||||
Formats: []rtspformat.Format{&rtspformat.MPEG4Audio{
|
||||
PayloadTyp: 96,
|
||||
Config: &mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
SizeLength: 13,
|
||||
IndexLength: 3,
|
||||
@@ -863,9 +866,10 @@ func TestRecorderTimeDriftDetector(t *testing.T) {
|
||||
Formats: []rtspformat.Format{&rtspformat.MPEG4Audio{
|
||||
PayloadTyp: 96,
|
||||
Config: &mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
SizeLength: 13,
|
||||
IndexLength: 3,
|
||||
|
||||
@@ -397,7 +397,7 @@ func TestServerRead(t *testing.T) {
|
||||
Codec: &codecs.MPEG4Audio{
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
ChannelCount: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
ChannelConfig: 2,
|
||||
SampleRate: 44100,
|
||||
},
|
||||
|
||||
@@ -238,7 +238,7 @@ func (s *Server) Log(level logger.Level, format string, args ...any) {
|
||||
func (s *Server) Close() {
|
||||
s.Log(logger.Info, "closing")
|
||||
|
||||
if !interfaceIsEmpty((s.Metrics)) {
|
||||
if !interfaceIsEmpty(s.Metrics) {
|
||||
if s.Encryption {
|
||||
s.Metrics.SetRTMPSServer(nil)
|
||||
} else {
|
||||
|
||||
@@ -25,9 +25,10 @@ func TestSource(t *testing.T) {
|
||||
track2 := &mpegts.Track{
|
||||
Codec: &tscodecs.MPEG4Audio{
|
||||
Config: mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ func mediasFromAlwaysAvailableTracks(alwaysAvailableTracks []conf.AlwaysAvailabl
|
||||
Type: mpeg4audio.ObjectTypeAACLC,
|
||||
SampleRate: track.SampleRate,
|
||||
ChannelConfig: uint8(track.ChannelCount),
|
||||
ChannelCount: track.ChannelCount,
|
||||
ChannelCount: track.ChannelCount, //nolint:staticcheck
|
||||
},
|
||||
}},
|
||||
})
|
||||
|
||||
@@ -520,7 +520,7 @@ func TestStreamAlwaysAvailable(t *testing.T) {
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
},
|
||||
Samples: []*pmp4.Sample{
|
||||
@@ -768,7 +768,7 @@ func TestStreamAlwaysAvailable(t *testing.T) {
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelConfig: 2,
|
||||
ChannelCount: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
},
|
||||
}},
|
||||
},
|
||||
|
||||
@@ -46,7 +46,7 @@ var FormatMPEG4Audio = &format.MPEG4Audio{
|
||||
Config: &mpeg4audio.AudioSpecificConfig{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
ChannelCount: 2, //nolint:staticcheck
|
||||
ChannelConfig: 2,
|
||||
},
|
||||
SizeLength: 13,
|
||||
|
||||
Reference in New Issue
Block a user