mirror of
https://github.com/pion/ice.git
synced 2025-09-26 19:41:11 +08:00
Update CI configs to v0.11.25
Update lint scripts and CI configs.
This commit is contained in:
@@ -80,10 +80,8 @@ linters:
|
||||
staticcheck:
|
||||
checks:
|
||||
- all
|
||||
# "could remove embedded field", to keep it explicit!
|
||||
- -QF1008
|
||||
# "could use tagged switch on enum", Cases conflicts with exhaustive!
|
||||
- -QF1003
|
||||
- -QF1008 # "could remove embedded field", to keep it explicit!
|
||||
- -QF1003 # "could use tagged switch on enum", Cases conflicts with exhaustive!
|
||||
exhaustive:
|
||||
default-signifies-exhaustive: true
|
||||
forbidigo:
|
||||
@@ -93,10 +91,6 @@ linters:
|
||||
- pattern: ^os.Exit$
|
||||
- pattern: ^panic$
|
||||
- pattern: ^print(ln)?$
|
||||
- pattern: ^testing.T.(Error|Errorf|Fatal|Fatalf|Fail|FailNow)$
|
||||
pkg: ^testing$
|
||||
msg: use testify/assert instead
|
||||
analyze-types: true
|
||||
gomodguard:
|
||||
blocked:
|
||||
modules:
|
||||
@@ -106,12 +100,6 @@ linters:
|
||||
govet:
|
||||
enable:
|
||||
- shadow
|
||||
revive:
|
||||
rules:
|
||||
# Prefer 'any' type alias over 'interface{}' for Go 1.18+ compatibility
|
||||
- name: use-any
|
||||
severity: warning
|
||||
disabled: false
|
||||
misspell:
|
||||
locale: US
|
||||
varnamelen:
|
||||
@@ -132,18 +120,15 @@ linters:
|
||||
- linters:
|
||||
- forbidigo
|
||||
- gocognit
|
||||
path: (examples|main\.go)
|
||||
- linters:
|
||||
- gocognit
|
||||
path: _test\.go
|
||||
path: (examples|main\.go|_test\.go)
|
||||
- linters:
|
||||
- forbidigo
|
||||
path: cmd
|
||||
formatters:
|
||||
enable:
|
||||
- gci
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goimports
|
||||
- gci # Gci control golang package import order and make it always deterministic.
|
||||
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
|
||||
- gofumpt # Gofumpt checks whether code was gofumpt-ed.
|
||||
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
|
||||
exclusions:
|
||||
generated: lax
|
||||
|
@@ -230,7 +230,7 @@ func TestActiveTCP_Respect_NetworkTypes(t *testing.T) {
|
||||
defer test.CheckRoutines(t)()
|
||||
defer test.TimeOut(time.Second * 5).Stop()
|
||||
|
||||
tcpListener, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
tcpListener, err := net.Listen("tcp", "127.0.0.1:0") // nolint: noctx
|
||||
require.NoError(t, err)
|
||||
|
||||
_, port, err := net.SplitHostPort(tcpListener.Addr().String())
|
||||
|
@@ -202,7 +202,7 @@ func TestWithDisableActiveTCP(t *testing.T) {
|
||||
func TestWithBindingRequestHandler(t *testing.T) {
|
||||
t.Run("sets binding request handler", func(t *testing.T) {
|
||||
handlerCalled := false
|
||||
handler := func(m *stun.Message, local, remote Candidate, pair *CandidatePair) bool {
|
||||
handler := func(_ *stun.Message, _, _ Candidate, _ *CandidatePair) bool {
|
||||
handlerCalled = true
|
||||
|
||||
return true
|
||||
@@ -232,7 +232,7 @@ func TestWithBindingRequestHandler(t *testing.T) {
|
||||
|
||||
t.Run("works with config", func(t *testing.T) {
|
||||
handlerCalled := false
|
||||
handler := func(m *stun.Message, local, remote Candidate, pair *CandidatePair) bool {
|
||||
handler := func(_ *stun.Message, _, _ Candidate, _ *CandidatePair) bool {
|
||||
handlerCalled = true
|
||||
|
||||
return true
|
||||
@@ -268,7 +268,7 @@ func TestMultipleConfigOptions(t *testing.T) {
|
||||
t.Run("can apply multiple options", func(t *testing.T) {
|
||||
customOffset := uint16(100)
|
||||
handlerCalled := false
|
||||
handler := func(m *stun.Message, local, remote Candidate, pair *CandidatePair) bool {
|
||||
handler := func(_ *stun.Message, _, _ Candidate, _ *CandidatePair) bool {
|
||||
handlerCalled = true
|
||||
|
||||
return true
|
||||
|
@@ -1952,7 +1952,8 @@ func TestRoleConflict(t *testing.T) {
|
||||
defer test.CheckRoutines(t)()
|
||||
defer test.TimeOut(time.Second * 30).Stop()
|
||||
|
||||
runTest := func(doDial bool) {
|
||||
runTest := func(t *testing.T, doDial bool) {
|
||||
t.Helper()
|
||||
cfg := &AgentConfig{
|
||||
NetworkTypes: supportedNetworkTypes(),
|
||||
MulticastDNSMode: MulticastDNSModeDisabled,
|
||||
@@ -2004,10 +2005,10 @@ func TestRoleConflict(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("Controlling", func(t *testing.T) {
|
||||
runTest(true)
|
||||
runTest(t, true)
|
||||
})
|
||||
|
||||
t.Run("Controlled", func(t *testing.T) {
|
||||
runTest(false)
|
||||
runTest(t, false)
|
||||
})
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ func TestRelayOnlyConnection(t *testing.T) {
|
||||
defer test.CheckRoutines(t)()
|
||||
|
||||
serverPort := randomPort(t)
|
||||
serverListener, err := net.ListenPacket("udp", localhostIPStr+":"+strconv.Itoa(serverPort))
|
||||
serverListener, err := net.ListenPacket("udp", localhostIPStr+":"+strconv.Itoa(serverPort)) // nolint: noctx
|
||||
require.NoError(t, err)
|
||||
|
||||
server, err := turn.NewServer(turn.ServerConfig{
|
||||
|
@@ -25,7 +25,7 @@ func TestServerReflexiveOnlyConnection(t *testing.T) {
|
||||
defer test.TimeOut(time.Second * 30).Stop()
|
||||
|
||||
serverPort := randomPort(t)
|
||||
serverListener, err := net.ListenPacket("udp4", "127.0.0.1:"+strconv.Itoa(serverPort))
|
||||
serverListener, err := net.ListenPacket("udp4", "127.0.0.1:"+strconv.Itoa(serverPort)) // nolint: noctx
|
||||
require.NoError(t, err)
|
||||
|
||||
server, err := turn.NewServer(turn.ServerConfig{
|
||||
|
@@ -129,7 +129,7 @@ func TestLoopbackCandidate(t *testing.T) {
|
||||
muxWithLo, errlo := NewMultiUDPMuxFromPort(12501, UDPMuxFromPortWithLoopback())
|
||||
require.NoError(t, errlo)
|
||||
|
||||
unspecConn, errconn := net.ListenPacket("udp", ":0")
|
||||
unspecConn, errconn := net.ListenPacket("udp", ":0") // nolint: noctx
|
||||
require.NoError(t, errconn)
|
||||
defer func() {
|
||||
_ = unspecConn.Close()
|
||||
@@ -233,7 +233,7 @@ func TestSTUNConcurrency(t *testing.T) {
|
||||
defer test.TimeOut(time.Second * 30).Stop()
|
||||
|
||||
serverPort := randomPort(t)
|
||||
serverListener, err := net.ListenPacket("udp4", localhostIPStr+":"+strconv.Itoa(serverPort))
|
||||
serverListener, err := net.ListenPacket("udp4", localhostIPStr+":"+strconv.Itoa(serverPort)) // nolint: noctx
|
||||
require.NoError(t, err)
|
||||
|
||||
server, err := turn.NewServer(turn.ServerConfig{
|
||||
@@ -388,7 +388,7 @@ func TestTURNConcurrency(t *testing.T) {
|
||||
|
||||
t.Run("UDP Relay", func(t *testing.T) {
|
||||
serverPort := randomPort(t)
|
||||
serverListener, err := net.ListenPacket("udp", localhostIPStr+":"+strconv.Itoa(serverPort))
|
||||
serverListener, err := net.ListenPacket("udp", localhostIPStr+":"+strconv.Itoa(serverPort)) // nolint: noctx
|
||||
require.NoError(t, err)
|
||||
|
||||
runTest(stun.ProtoTypeUDP, stun.SchemeTypeTURN, serverListener, nil, serverPort)
|
||||
@@ -396,7 +396,7 @@ func TestTURNConcurrency(t *testing.T) {
|
||||
|
||||
t.Run("TCP Relay", func(t *testing.T) {
|
||||
serverPort := randomPort(t)
|
||||
serverListener, err := net.Listen("tcp", localhostIPStr+":"+strconv.Itoa(serverPort))
|
||||
serverListener, err := net.Listen("tcp", localhostIPStr+":"+strconv.Itoa(serverPort)) // nolint: noctx
|
||||
require.NoError(t, err)
|
||||
|
||||
runTest(stun.ProtoTypeTCP, stun.SchemeTypeTURN, nil, serverListener, serverPort)
|
||||
@@ -440,7 +440,7 @@ func TestSTUNTURNConcurrency(t *testing.T) {
|
||||
defer test.TimeOut(time.Second * 8).Stop()
|
||||
|
||||
serverPort := randomPort(t)
|
||||
serverListener, err := net.ListenPacket("udp4", localhostIPStr+":"+strconv.Itoa(serverPort))
|
||||
serverListener, err := net.ListenPacket("udp4", localhostIPStr+":"+strconv.Itoa(serverPort)) // nolint: noctx
|
||||
require.NoError(t, err)
|
||||
|
||||
server, err := turn.NewServer(turn.ServerConfig{
|
||||
@@ -513,7 +513,7 @@ func TestTURNSrflx(t *testing.T) {
|
||||
defer test.TimeOut(time.Second * 30).Stop()
|
||||
|
||||
serverPort := randomPort(t)
|
||||
serverListener, err := net.ListenPacket("udp4", localhostIPStr+":"+strconv.Itoa(serverPort))
|
||||
serverListener, err := net.ListenPacket("udp4", localhostIPStr+":"+strconv.Itoa(serverPort)) // nolint: noctx
|
||||
require.NoError(t, err)
|
||||
|
||||
server, err := turn.NewServer(turn.ServerConfig{
|
||||
@@ -651,7 +651,7 @@ func TestUDPMuxDefaultWithNAT1To1IPsUsage(t *testing.T) {
|
||||
|
||||
defer test.TimeOut(time.Second * 30).Stop()
|
||||
|
||||
conn, err := net.ListenPacket("udp4", ":0")
|
||||
conn, err := net.ListenPacket("udp4", ":0") // nolint: noctx
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
_ = conn.Close()
|
||||
|
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/pion/ice/v4
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/google/uuid v1.6.0
|
||||
|
@@ -267,7 +267,7 @@ func onConnected() (func(ConnectionState), chan struct{}) {
|
||||
|
||||
func randomPort(tb testing.TB) int {
|
||||
tb.Helper()
|
||||
conn, err := net.ListenPacket("udp4", "127.0.0.1:0")
|
||||
conn, err := net.ListenPacket("udp4", "127.0.0.1:0") // nolint: noctx
|
||||
if err != nil {
|
||||
tb.Fatalf("failed to pickPort: %v", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user