diff --git a/active_tcp_test.go b/active_tcp_test.go index b47ff6a..4959976 100644 --- a/active_tcp_test.go +++ b/active_tcp_test.go @@ -206,7 +206,7 @@ func TestActiveTCP_NonBlocking(t *testing.T) { require.NoError(t, bAgent.Close()) }() - isConnected := make(chan interface{}) + isConnected := make(chan any) err = aAgent.OnConnectionStateChange(func(c ConnectionState) { if c == ConnectionStateConnected { close(isConnected) @@ -269,7 +269,7 @@ func TestActiveTCP_Respect_NetworkTypes(t *testing.T) { require.NoError(t, bAgent.Close()) }() - isConnected := make(chan interface{}) + isConnected := make(chan any) err = aAgent.OnConnectionStateChange(func(c ConnectionState) { if c == ConnectionStateConnected { close(isConnected) diff --git a/agent_test.go b/agent_test.go index 0d97ea6..be86e29 100644 --- a/agent_test.go +++ b/agent_test.go @@ -505,7 +505,7 @@ func TestConnectionStateCallback(t *testing.T) { //nolint:cyclop InterfaceFilter: problematicNetworkInterfaces, } - isClosed := make(chan interface{}) + isClosed := make(chan any) aAgent, err := NewAgent(cfg) require.NoError(t, err) @@ -529,10 +529,10 @@ func TestConnectionStateCallback(t *testing.T) { //nolint:cyclop require.NoError(t, bAgent.Close()) }() - isChecking := make(chan interface{}) - isConnected := make(chan interface{}) - isDisconnected := make(chan interface{}) - isFailed := make(chan interface{}) + isChecking := make(chan any) + isConnected := make(chan any) + isDisconnected := make(chan any) + isFailed := make(chan any) err = aAgent.OnConnectionStateChange(func(c ConnectionState) { switch c { case ConnectionStateChecking: @@ -1058,7 +1058,7 @@ func TestConnectionStateFailedDeleteAllCandidates(t *testing.T) { require.NoError(t, bAgent.Close()) }() - isFailed := make(chan interface{}) + isFailed := make(chan any) require.NoError(t, aAgent.OnConnectionStateChange(func(c ConnectionState) { if c == ConnectionStateFailed { close(isFailed) @@ -1364,8 +1364,8 @@ func TestCloseInConnectionStateCallback(t *testing.T) { require.NoError(t, bAgent.Close()) }() - isClosed := make(chan interface{}) - isConnected := make(chan interface{}) + isClosed := make(chan any) + isConnected := make(chan any) err = aAgent.OnConnectionStateChange(func(c ConnectionState) { switch c { case ConnectionStateConnected: @@ -1414,7 +1414,7 @@ func TestRunTaskInConnectionStateCallback(t *testing.T) { require.NoError(t, bAgent.Close()) }() - isComplete := make(chan interface{}) + isComplete := make(chan any) err = aAgent.OnConnectionStateChange(func(c ConnectionState) { if c == ConnectionStateConnected { _, _, errCred := aAgent.GetLocalUserCredentials() @@ -1459,8 +1459,8 @@ func TestRunTaskInSelectedCandidatePairChangeCallback(t *testing.T) { require.NoError(t, bAgent.Close()) }() - isComplete := make(chan interface{}) - isTested := make(chan interface{}) + isComplete := make(chan any) + isTested := make(chan any) err = aAgent.OnSelectedCandidatePairChange(func(Candidate, Candidate) { go func() { _, _, errCred := aAgent.GetLocalUserCredentials() @@ -1528,9 +1528,9 @@ func TestLiteLifecycle(t *testing.T) { require.NoError(t, bAgent.Close()) }() - bConnected := make(chan interface{}) - bDisconnected := make(chan interface{}) - bFailed := make(chan interface{}) + bConnected := make(chan any) + bDisconnected := make(chan any) + bFailed := make(chan any) require.NoError(t, bAgent.OnConnectionStateChange(func(c ConnectionState) { switch c { diff --git a/candidate_base.go b/candidate_base.go index 66fb776..b36f7e4 100644 --- a/candidate_base.go +++ b/candidate_base.go @@ -69,7 +69,7 @@ func (c *candidateBase) Deadline() (deadline time.Time, ok bool) { } // Value implements context.Context. -func (c *candidateBase) Value(interface{}) interface{} { +func (c *candidateBase) Value(any) any { return nil } @@ -217,7 +217,7 @@ func (c *candidateBase) start(a *Agent, conn net.PacketConn, initializedCh <-cha } var bufferPool = sync.Pool{ // nolint:gochecknoglobals - New: func() interface{} { + New: func() any { return make([]byte, receiveMTU) }, } diff --git a/gather.go b/gather.go index a1e0247..ebf2999 100644 --- a/gather.go +++ b/gather.go @@ -22,7 +22,7 @@ import ( ) // Close a net.Conn and log if we have a failure. -func closeConnAndLog(c io.Closer, log logging.LeveledLogger, msg string, args ...interface{}) { +func closeConnAndLog(c io.Closer, log logging.LeveledLogger, msg string, args ...any) { if c == nil || (reflect.ValueOf(c).Kind() == reflect.Ptr && reflect.ValueOf(c).IsNil()) { log.Warnf("Connection is not allocated: "+msg, args...) diff --git a/internal/taskloop/taskloop.go b/internal/taskloop/taskloop.go index 15a2666..63e780f 100644 --- a/internal/taskloop/taskloop.go +++ b/internal/taskloop/taskloop.go @@ -116,6 +116,6 @@ func (l *Loop) Deadline() (deadline time.Time, ok bool) { } // Value is not supported for task loops. -func (l *Loop) Value(interface{}) interface{} { +func (l *Loop) Value(any) any { return nil } diff --git a/udp_mux.go b/udp_mux.go index 3732b26..48f65aa 100644 --- a/udp_mux.go +++ b/udp_mux.go @@ -116,7 +116,7 @@ func NewUDPMuxDefault(params UDPMuxParams) *UDPMuxDefault { //nolint:cyclop connsIPv6: make(map[string]*udpMuxedConn), closedChan: make(chan struct{}, 1), pool: &sync.Pool{ - New: func() interface{} { + New: func() any { // Big enough buffer to fit both packet and address return newBufferHolder(receiveMTU) },