diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a07c2928084..d07dfdf3565 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,4 +19,4 @@ jobs: release: uses: pion/.goassets/.github/workflows/release.reusable.yml@master with: - go-version: '1.19' # auto-update/latest-go-version + go-version: '1.20' # auto-update/latest-go-version diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 834a158d010..7fcb1f51408 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,7 +21,7 @@ jobs: uses: pion/.goassets/.github/workflows/test.reusable.yml@master strategy: matrix: - go: ['1.19', '1.18'] # auto-update/supported-go-version-list + go: ['1.20', '1.19'] # auto-update/supported-go-version-list fail-fast: false with: go-version: ${{ matrix.go }} @@ -30,7 +30,7 @@ jobs: uses: pion/.goassets/.github/workflows/test-i386.reusable.yml@master strategy: matrix: - go: ['1.19', '1.18'] # auto-update/supported-go-version-list + go: ['1.20', '1.19'] # auto-update/supported-go-version-list fail-fast: false with: go-version: ${{ matrix.go }} @@ -38,4 +38,4 @@ jobs: test-wasm: uses: pion/.goassets/.github/workflows/test-wasm.reusable.yml@master with: - go-version: '1.19' # auto-update/latest-go-version + go-version: '1.20' # auto-update/latest-go-version diff --git a/.github/workflows/tidy-check.yaml b/.github/workflows/tidy-check.yaml index 29c5cb86219..b94cc19b6c5 100644 --- a/.github/workflows/tidy-check.yaml +++ b/.github/workflows/tidy-check.yaml @@ -20,4 +20,4 @@ jobs: tidy: uses: pion/.goassets/.github/workflows/tidy-check.reusable.yml@master with: - go-version: '1.19' # auto-update/latest-go-version + go-version: '1.20' # auto-update/latest-go-version diff --git a/certificate.go b/certificate.go index 99e359741b5..d034942f975 100644 --- a/certificate.go +++ b/certificate.go @@ -105,10 +105,12 @@ func (c Certificate) GetFingerprints() ([]DTLSFingerprint, error) { for _, algo := range fingerprintAlgorithms { name, err := fingerprint.StringFromHash(algo) if err != nil { + // nolint return nil, fmt.Errorf("%w: %v", ErrFailedToGenerateCertificateFingerprint, err) } value, err := fingerprint.Fingerprint(c.x509Cert, algo) if err != nil { + // nolint return nil, fmt.Errorf("%w: %v", ErrFailedToGenerateCertificateFingerprint, err) } res[i] = DTLSFingerprint{ diff --git a/dtlstransport.go b/dtlstransport.go index 2f6a7d1bb35..f92f72f1420 100644 --- a/dtlstransport.go +++ b/dtlstransport.go @@ -139,6 +139,7 @@ func (t *DTLSTransport) WriteRTCP(pkts []rtcp.Packet) (int, error) { writeStream, err := srtcpSession.OpenWriteStream() if err != nil { + // nolint return 0, fmt.Errorf("%w: %v", errPeerConnWriteRTCPOpenWriteStream, err) } @@ -209,16 +210,19 @@ func (t *DTLSTransport) startSRTP() error { connState := t.conn.ConnectionState() err := srtpConfig.ExtractSessionKeysFromDTLS(&connState, t.role() == DTLSRoleClient) if err != nil { + // nolint return fmt.Errorf("%w: %v", errDtlsKeyExtractionFailed, err) } srtpSession, err := srtp.NewSessionSRTP(t.srtpEndpoint, srtpConfig) if err != nil { + // nolint return fmt.Errorf("%w: %v", errFailedToStartSRTP, err) } srtcpSession, err := srtp.NewSessionSRTCP(t.srtcpEndpoint, srtpConfig) if err != nil { + // nolint return fmt.Errorf("%w: %v", errFailedToStartSRTCP, err) } diff --git a/examples/bandwidth-estimation-from-disk/main.go b/examples/bandwidth-estimation-from-disk/main.go index 9f6d44365bd..2dbd8db0683 100644 --- a/examples/bandwidth-estimation-from-disk/main.go +++ b/examples/bandwidth-estimation-from-disk/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// bandwidth-estimation-from-disk demonstrates how to use Pion's Bandwidth Estimation APIs. package main import ( @@ -32,6 +33,7 @@ const ( ivfHeaderSize = 32 ) +// nolint: gocognit func main() { qualityLevels := []struct { fileName string diff --git a/examples/broadcast/main.go b/examples/broadcast/main.go index 8f15776b7f7..2ca9c00d987 100644 --- a/examples/broadcast/main.go +++ b/examples/broadcast/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// broadcast demonstrates how to broadcast a video to many peers, while only requiring the broadcaster to upload once. package main import ( diff --git a/examples/custom-logger/main.go b/examples/custom-logger/main.go index c09cd2717fd..894c053571d 100644 --- a/examples/custom-logger/main.go +++ b/examples/custom-logger/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// custom-logger is an example of how the Pion API provides an customizable logging API package main import ( @@ -19,8 +20,8 @@ import ( type customLogger struct{} // Print all messages except trace -func (c customLogger) Trace(msg string) {} -func (c customLogger) Tracef(format string, args ...interface{}) {} +func (c customLogger) Trace(string) {} +func (c customLogger) Tracef(string, ...interface{}) {} func (c customLogger) Debug(msg string) { fmt.Printf("customLogger Debug: %s\n", msg) } func (c customLogger) Debugf(format string, args ...interface{}) { diff --git a/examples/data-channels-detach/main.go b/examples/data-channels-detach/main.go index f1a724f124f..c1c485404df 100644 --- a/examples/data-channels-detach/main.go +++ b/examples/data-channels-detach/main.go @@ -1,3 +1,4 @@ +// data-channels-detach is an example that shows how you can detach a data channel. This allows direct access the the underlying [pion/datachannel](https://github.com/pion/datachannel). This allows you to interact with the data channel using a more idiomatic API based on the `io.ReadWriteCloser` interface. package main import ( diff --git a/examples/data-channels-flow-control/main.go b/examples/data-channels-flow-control/main.go index b71668da2d7..db4993a31cf 100644 --- a/examples/data-channels-flow-control/main.go +++ b/examples/data-channels-flow-control/main.go @@ -1,3 +1,4 @@ +// data-channels-flow-control demonstrates how to use the DataChannel congestion control APIs package main import ( diff --git a/examples/data-channels/main.go b/examples/data-channels/main.go index 902222eac22..923654dbf2a 100644 --- a/examples/data-channels/main.go +++ b/examples/data-channels/main.go @@ -1,3 +1,4 @@ +// data-channels is a Pion WebRTC application that shows how you can send/recv DataChannel messages from a web browser package main import ( diff --git a/examples/examples.go b/examples/examples.go index 8dadeee90dd..f587af6ba5e 100644 --- a/examples/examples.go +++ b/examples/examples.go @@ -1,10 +1,9 @@ +// HTTP server that demonstrates Pion WebRTC examples package main import ( "encoding/json" - "errors" "flag" - "fmt" "go/build" "html/template" "log" @@ -17,11 +16,6 @@ import ( // Examples represents the examples loaded from examples.json. type Examples []*Example -var ( - errListExamples = errors.New("failed to list examples (please run in the examples folder)") - errParseExamples = errors.New("failed to parse examples") -) - // Example represents an example loaded from examples.json. type Example struct { Title string `json:"title"` @@ -45,10 +39,7 @@ func main() { func serve(addr string) error { // Load the examples - examples, err := getExamples() - if err != nil { - return err - } + examples := getExamples() // Load the templates homeTemplate := template.Must(template.ParseFiles("index.html")) @@ -84,7 +75,7 @@ func serve(addr string) error { } temp := template.Must(template.ParseFiles("example.html")) - _, err = temp.ParseFiles(filepath.Join(fiddle, "demo.html")) + _, err := temp.ParseFiles(filepath.Join(fiddle, "demo.html")) if err != nil { panic(err) } @@ -106,21 +97,22 @@ func serve(addr string) error { } // Serve the main page - err = homeTemplate.Execute(w, examples) + err := homeTemplate.Execute(w, examples) if err != nil { panic(err) } }) // Start the server + // nolint: gosec return http.ListenAndServe(addr, nil) } // getExamples loads the examples from the examples.json file. -func getExamples() (*Examples, error) { +func getExamples() *Examples { file, err := os.Open("./examples.json") if err != nil { - return nil, fmt.Errorf("%w: %v", errListExamples, err) + panic(err) } defer func() { closeErr := file.Close() @@ -132,7 +124,7 @@ func getExamples() (*Examples, error) { var examples Examples err = json.NewDecoder(file).Decode(&examples) if err != nil { - return nil, fmt.Errorf("%w: %v", errParseExamples, err) + panic(err) } for _, example := range examples { @@ -147,5 +139,5 @@ func getExamples() (*Examples, error) { } } - return &examples, nil + return &examples } diff --git a/examples/ice-restart/main.go b/examples/ice-restart/main.go index 30762fa556c..ada35de0470 100644 --- a/examples/ice-restart/main.go +++ b/examples/ice-restart/main.go @@ -1,3 +1,4 @@ +// ice-restart demonstrates Pion WebRTC's ICE Restart abilities. package main import ( @@ -77,5 +78,6 @@ func main() { http.HandleFunc("/doSignaling", doSignaling) fmt.Println("Open http://localhost:8080 to access this demo") + // nolint: gosec panic(http.ListenAndServe(":8080", nil)) } diff --git a/examples/ice-single-port/main.go b/examples/ice-single-port/main.go index 4de48c6900e..aad0c36813c 100644 --- a/examples/ice-single-port/main.go +++ b/examples/ice-single-port/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// ice-single-port demonstrates Pion WebRTC's ability to serve many PeerConnections on a single port. package main import ( @@ -96,5 +97,6 @@ func main() { http.HandleFunc("/doSignaling", doSignaling) fmt.Println("Open http://localhost:8080 to access this demo") + // nolint: gosec panic(http.ListenAndServe(":8080", nil)) } diff --git a/examples/ice-tcp/main.go b/examples/ice-tcp/main.go index d9738c04a2a..b9e7a87a7e1 100644 --- a/examples/ice-tcp/main.go +++ b/examples/ice-tcp/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// ice-tcp demonstrates Pion WebRTC's ICE TCP abilities. package main import ( @@ -106,5 +107,6 @@ func main() { http.HandleFunc("/doSignaling", doSignaling) fmt.Println("Open http://localhost:8080 to access this demo") + // nolint: gosec panic(http.ListenAndServe(":8080", nil)) } diff --git a/examples/insertable-streams/main.go b/examples/insertable-streams/main.go index e49fbe4af7b..4358f7fe922 100644 --- a/examples/insertable-streams/main.go +++ b/examples/insertable-streams/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// insertable-streams demonstrates how to use insertable streams with Pion package main import ( @@ -19,6 +20,7 @@ import ( const cipherKey = 0xAA +// nolint:gocognit func main() { peerConnection, err := webrtc.NewPeerConnection(webrtc.Configuration{ ICEServers: []webrtc.ICEServer{ diff --git a/examples/internal/signal/http.go b/examples/internal/signal/http.go index dbc2bee3159..682b370e319 100644 --- a/examples/internal/signal/http.go +++ b/examples/internal/signal/http.go @@ -21,6 +21,7 @@ func HTTPSDPServer() chan string { }) go func() { + // nolint: gosec err := http.ListenAndServe(":"+strconv.Itoa(*port), nil) if err != nil { panic(err) diff --git a/examples/ortc/main.go b/examples/ortc/main.go index 0f61e0698ba..8f7e33efa32 100644 --- a/examples/ortc/main.go +++ b/examples/ortc/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// ortc demonstrates Pion WebRTC's ORTC capabilities. package main import ( diff --git a/examples/pion-to-pion/answer/main.go b/examples/pion-to-pion/answer/main.go index 84cd39d77ff..b54588b6933 100644 --- a/examples/pion-to-pion/answer/main.go +++ b/examples/pion-to-pion/answer/main.go @@ -1,3 +1,4 @@ +// pion-to-pion is an example of two pion instances communicating directly! package main import ( @@ -23,11 +24,7 @@ func signalCandidate(addr string, c *webrtc.ICECandidate) error { return err } - if closeErr := resp.Body.Close(); closeErr != nil { - return closeErr - } - - return nil + return resp.Body.Close() } func main() { // nolint:gocognit @@ -176,5 +173,6 @@ func main() { // nolint:gocognit }) // Start HTTP server that accepts requests from the offer process to exchange SDP and Candidates + // nolint: gosec panic(http.ListenAndServe(*answerAddr, nil)) } diff --git a/examples/pion-to-pion/offer/main.go b/examples/pion-to-pion/offer/main.go index ef845c9f763..564b267fe16 100644 --- a/examples/pion-to-pion/offer/main.go +++ b/examples/pion-to-pion/offer/main.go @@ -1,3 +1,4 @@ +// pion-to-pion is an example of two pion instances communicating directly! package main import ( @@ -22,11 +23,7 @@ func signalCandidate(addr string, c *webrtc.ICECandidate) error { return err } - if closeErr := resp.Body.Close(); closeErr != nil { - return closeErr - } - - return nil + return resp.Body.Close() } func main() { //nolint:gocognit @@ -111,6 +108,7 @@ func main() { //nolint:gocognit } }) // Start HTTP server that accepts requests from the answer process + // nolint: gosec go func() { panic(http.ListenAndServe(*offerAddr, nil)) }() // Create a datachannel with label 'data' diff --git a/examples/play-from-disk-renegotation/main.go b/examples/play-from-disk-renegotation/main.go index 04df604748b..e68044507d9 100644 --- a/examples/play-from-disk-renegotation/main.go +++ b/examples/play-from-disk-renegotation/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// play-from-disk-renegotation demonstrates Pion WebRTC's renegotiation abilities. package main import ( @@ -145,6 +146,7 @@ func main() { go func() { fmt.Println("Open http://localhost:8080 to access this demo") + // nolint: gosec panic(http.ListenAndServe(":8080", nil)) }() diff --git a/examples/play-from-disk/main.go b/examples/play-from-disk/main.go index 5b6b7c51f95..82418d484c2 100644 --- a/examples/play-from-disk/main.go +++ b/examples/play-from-disk/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// play-from-disk demonstrates how to send video and/or audio to your browser from files saved to disk. package main import ( @@ -24,6 +25,7 @@ const ( oggPageDuration = time.Millisecond * 20 ) +// nolint:gocognit func main() { // Assert that we have an audio or video file _, err := os.Stat(videoFileName) diff --git a/examples/reflect/main.go b/examples/reflect/main.go index 466fb80b1c9..6fd5ddcd74f 100644 --- a/examples/reflect/main.go +++ b/examples/reflect/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// reflect demonstrates how with one PeerConnection you can send video to Pion and have the packets sent back package main import ( @@ -14,6 +15,7 @@ import ( "github.com/pion/webrtc/v3/examples/internal/signal" ) +// nolint:gocognit func main() { // Everything below is the Pion WebRTC API! Thanks for using it ❤️. diff --git a/examples/rtcp-processing/main.go b/examples/rtcp-processing/main.go index 1bd5ab3e273..114dadd8bdc 100644 --- a/examples/rtcp-processing/main.go +++ b/examples/rtcp-processing/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// rtcp-processing demonstrates the Public API for processing RTCP packets in Pion WebRTC. package main import ( diff --git a/examples/rtp-forwarder/main.go b/examples/rtp-forwarder/main.go index 5f6a1143a3c..992e28aeb71 100644 --- a/examples/rtp-forwarder/main.go +++ b/examples/rtp-forwarder/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// rtp-forwarder shows how to forward your webcam/microphone via RTP using Pion WebRTC. package main import ( @@ -23,6 +24,7 @@ type udpConn struct { payloadType uint8 } +// nolint:gocognit func main() { // Everything below is the Pion WebRTC API! Thanks for using it ❤️. diff --git a/examples/rtp-to-webrtc/main.go b/examples/rtp-to-webrtc/main.go index 46cafebd475..a2dbed6831d 100644 --- a/examples/rtp-to-webrtc/main.go +++ b/examples/rtp-to-webrtc/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// rtp-to-webrtc demonstrates how to consume a RTP stream video UDP, and then send to a WebRTC client. package main import ( diff --git a/examples/save-to-disk-av1/main.go b/examples/save-to-disk-av1/main.go index 969438fb490..73b450764ef 100644 --- a/examples/save-to-disk-av1/main.go +++ b/examples/save-to-disk-av1/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// save-to-disk-av1 is a simple application that shows how to save a video to disk using AV1. package main import ( diff --git a/examples/save-to-disk/main.go b/examples/save-to-disk/main.go index dfab19b4f92..5075ac9be8f 100644 --- a/examples/save-to-disk/main.go +++ b/examples/save-to-disk/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// save-to-disk is a simple application that shows how to record your webcam/microphone using Pion WebRTC and save VP8/Opus to disk. package main import ( @@ -36,6 +37,7 @@ func saveToDisk(i media.Writer, track *webrtc.TrackRemote) { } } +// nolint:gocognit func main() { // Everything below is the Pion WebRTC API! Thanks for using it ❤️. diff --git a/examples/simulcast/main.go b/examples/simulcast/main.go index 807ce135782..a75303ee0da 100644 --- a/examples/simulcast/main.go +++ b/examples/simulcast/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// simulcast demonstrates of how to handle incoming track with multiple simulcast rtp streams and show all them back. package main import ( @@ -16,6 +17,7 @@ import ( "github.com/pion/webrtc/v3/examples/internal/signal" ) +// nolint:gocognit func main() { // Everything below is the Pion WebRTC API! Thanks for using it ❤️. diff --git a/examples/swap-tracks/main.go b/examples/swap-tracks/main.go index 635ca3f1f30..424348d38d5 100644 --- a/examples/swap-tracks/main.go +++ b/examples/swap-tracks/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// swap-tracks demonstrates how to swap multiple incoming tracks on a single outgoing track. package main import ( diff --git a/examples/trickle-ice/main.go b/examples/trickle-ice/main.go index 98a540f3e68..49d8b43c73f 100644 --- a/examples/trickle-ice/main.go +++ b/examples/trickle-ice/main.go @@ -1,3 +1,4 @@ +// trickle-ice demonstrates Pion WebRTC's Trickle ICE APIs. ICE is the subsystem WebRTC uses to establish connectivity. package main import ( @@ -110,5 +111,6 @@ func main() { http.Handle("/websocket", websocket.Handler(websocketServer)) fmt.Println("Open http://localhost:8080 to access this demo") + // nolint: gosec panic(http.ListenAndServe(":8080", nil)) } diff --git a/examples/vnet/show-network-usage/main.go b/examples/vnet/show-network-usage/main.go index 4a132ab8a72..d9cd0338fb3 100644 --- a/examples/vnet/show-network-usage/main.go +++ b/examples/vnet/show-network-usage/main.go @@ -1,6 +1,7 @@ //go:build !js // +build !js +// show-network-usage shows the amount of packets flowing through the vnet package main import ( diff --git a/interceptor.go b/interceptor.go index e93fc7666ae..48acb4df54e 100644 --- a/interceptor.go +++ b/interceptor.go @@ -26,11 +26,7 @@ func RegisterDefaultInterceptors(mediaEngine *MediaEngine, interceptorRegistry * return err } - if err := ConfigureTWCCSender(mediaEngine, interceptorRegistry); err != nil { - return err - } - - return nil + return ConfigureTWCCSender(mediaEngine, interceptorRegistry) } // ConfigureRTCPReports will setup everything necessary for generating Sender and Receiver Reports diff --git a/internal/fmtp/h264.go b/internal/fmtp/h264.go index 5a79b9e64a4..94f919f8ebd 100644 --- a/internal/fmtp/h264.go +++ b/internal/fmtp/h264.go @@ -26,16 +26,17 @@ func (h *h264FMTP) MimeType() string { // Match returns true if h and b are compatible fmtp descriptions // Based on RFC6184 Section 8.2.2: -// The parameters identifying a media format configuration for H.264 -// are profile-level-id and packetization-mode. These media format -// configuration parameters (except for the level part of profile- -// level-id) MUST be used symmetrically; that is, the answerer MUST -// either maintain all configuration parameters or remove the media -// format (payload type) completely if one or more of the parameter -// values are not supported. -// Informative note: The requirement for symmetric use does not -// apply for the level part of profile-level-id and does not apply -// for the other stream properties and capability parameters. +// +// The parameters identifying a media format configuration for H.264 +// are profile-level-id and packetization-mode. These media format +// configuration parameters (except for the level part of profile- +// level-id) MUST be used symmetrically; that is, the answerer MUST +// either maintain all configuration parameters or remove the media +// format (payload type) completely if one or more of the parameter +// values are not supported. +// Informative note: The requirement for symmetric use does not +// apply for the level part of profile-level-id and does not apply +// for the other stream properties and capability parameters. func (h *h264FMTP) Match(b FMTP) bool { c, ok := b.(*h264FMTP) if !ok { diff --git a/internal/mux/endpoint.go b/internal/mux/endpoint.go index 939a2294cd9..76e842d2895 100644 --- a/internal/mux/endpoint.go +++ b/internal/mux/endpoint.go @@ -60,16 +60,16 @@ func (e *Endpoint) RemoteAddr() net.Addr { } // SetDeadline is a stub -func (e *Endpoint) SetDeadline(t time.Time) error { +func (e *Endpoint) SetDeadline(time.Time) error { return nil } // SetReadDeadline is a stub -func (e *Endpoint) SetReadDeadline(t time.Time) error { +func (e *Endpoint) SetReadDeadline(time.Time) error { return nil } // SetWriteDeadline is a stub -func (e *Endpoint) SetWriteDeadline(t time.Time) error { +func (e *Endpoint) SetWriteDeadline(time.Time) error { return nil } diff --git a/internal/mux/muxfunc.go b/internal/mux/muxfunc.go index fc8efc948f9..331e46ca3b4 100644 --- a/internal/mux/muxfunc.go +++ b/internal/mux/muxfunc.go @@ -4,7 +4,7 @@ package mux type MatchFunc func([]byte) bool // MatchAll always returns true -func MatchAll(b []byte) bool { +func MatchAll([]byte) bool { return true } diff --git a/operations_test.go b/operations_test.go index 201c80a2681..de1b1d8a997 100644 --- a/operations_test.go +++ b/operations_test.go @@ -25,7 +25,7 @@ func TestOperations_Enqueue(t *testing.T) { } } -func TestOperations_Done(t *testing.T) { +func TestOperations_Done(*testing.T) { ops := newOperations() ops.Done() } diff --git a/peerconnection.go b/peerconnection.go index 5cfaf85bae5..89dc5b94c51 100644 --- a/peerconnection.go +++ b/peerconnection.go @@ -805,7 +805,7 @@ func (pc *PeerConnection) createICETransport() *ICETransport { } // CreateAnswer starts the PeerConnection and generates the localDescription -func (pc *PeerConnection) CreateAnswer(options *AnswerOptions) (SessionDescription, error) { +func (pc *PeerConnection) CreateAnswer(*AnswerOptions) (SessionDescription, error) { useIdentity := pc.idpLoginURL != nil remoteDesc := pc.RemoteDescription() switch { @@ -1514,6 +1514,7 @@ func (pc *PeerConnection) handleUndeclaredSSRC(ssrc SSRC, remoteDescription *Ses Direction: RTPTransceiverDirectionSendrecv, }) if err != nil { + // nolint return false, fmt.Errorf("%w: %d: %s", errPeerConnRemoteSSRCAddTransceiver, ssrc, err) } @@ -2011,7 +2012,7 @@ func (pc *PeerConnection) CreateDataChannel(label string, options *DataChannelIn } // SetIdentityProvider is used to configure an identity provider to generate identity assertions -func (pc *PeerConnection) SetIdentityProvider(provider string) error { +func (pc *PeerConnection) SetIdentityProvider(string) error { return errPeerConnSetIdentityProviderNotImplemented } diff --git a/peerconnection_media_test.go b/peerconnection_media_test.go index 71963e738ca..e8eaf2dbdd8 100644 --- a/peerconnection_media_test.go +++ b/peerconnection_media_test.go @@ -385,16 +385,16 @@ func TestPeerConnection_Media_Disconnected(t *testing.T) { type undeclaredSsrcLogger struct{ unhandledSimulcastError chan struct{} } -func (u *undeclaredSsrcLogger) Trace(msg string) {} -func (u *undeclaredSsrcLogger) Tracef(format string, args ...interface{}) {} -func (u *undeclaredSsrcLogger) Debug(msg string) {} -func (u *undeclaredSsrcLogger) Debugf(format string, args ...interface{}) {} -func (u *undeclaredSsrcLogger) Info(msg string) {} -func (u *undeclaredSsrcLogger) Infof(format string, args ...interface{}) {} -func (u *undeclaredSsrcLogger) Warn(msg string) {} -func (u *undeclaredSsrcLogger) Warnf(format string, args ...interface{}) {} -func (u *undeclaredSsrcLogger) Error(msg string) {} -func (u *undeclaredSsrcLogger) Errorf(format string, args ...interface{}) { +func (u *undeclaredSsrcLogger) Trace(string) {} +func (u *undeclaredSsrcLogger) Tracef(string, ...interface{}) {} +func (u *undeclaredSsrcLogger) Debug(string) {} +func (u *undeclaredSsrcLogger) Debugf(string, ...interface{}) {} +func (u *undeclaredSsrcLogger) Info(string) {} +func (u *undeclaredSsrcLogger) Infof(string, ...interface{}) {} +func (u *undeclaredSsrcLogger) Warn(string) {} +func (u *undeclaredSsrcLogger) Warnf(string, ...interface{}) {} +func (u *undeclaredSsrcLogger) Error(string) {} +func (u *undeclaredSsrcLogger) Errorf(format string, _ ...interface{}) { if format == incomingUnhandledRTPSsrc { close(u.unhandledSimulcastError) } @@ -402,7 +402,7 @@ func (u *undeclaredSsrcLogger) Errorf(format string, args ...interface{}) { type undeclaredSsrcLoggerFactory struct{ unhandledSimulcastError chan struct{} } -func (u *undeclaredSsrcLoggerFactory) NewLogger(subsystem string) logging.LeveledLogger { +func (u *undeclaredSsrcLoggerFactory) NewLogger(string) logging.LeveledLogger { return &undeclaredSsrcLogger{u.unhandledSimulcastError} } diff --git a/pkg/media/samplebuilder/samplebuilder.go b/pkg/media/samplebuilder/samplebuilder.go index e928f14314d..51b0c905ca5 100644 --- a/pkg/media/samplebuilder/samplebuilder.go +++ b/pkg/media/samplebuilder/samplebuilder.go @@ -325,7 +325,7 @@ func timestampDistance(x, y uint32) uint32 { type Option func(o *SampleBuilder) // WithPartitionHeadChecker is obsolete, it does nothing. -func WithPartitionHeadChecker(checker interface{}) Option { +func WithPartitionHeadChecker(interface{}) Option { return func(o *SampleBuilder) { } } diff --git a/pkg/media/samplebuilder/samplebuilder_test.go b/pkg/media/samplebuilder/samplebuilder_test.go index be4dfbd8689..dfe9aac392b 100644 --- a/pkg/media/samplebuilder/samplebuilder_test.go +++ b/pkg/media/samplebuilder/samplebuilder_test.go @@ -43,7 +43,7 @@ func (f *fakeDepacketizer) IsPartitionHead(payload []byte) bool { return false } -func (f *fakeDepacketizer) IsPartitionTail(marker bool, payload []byte) bool { +func (f *fakeDepacketizer) IsPartitionTail(marker bool, _ []byte) bool { return marker } @@ -397,7 +397,7 @@ func TestPopWithTimestamp(t *testing.T) { type truePartitionHeadChecker struct{} -func (f *truePartitionHeadChecker) IsPartitionHead(payload []byte) bool { +func (f *truePartitionHeadChecker) IsPartitionHead([]byte) bool { return true } diff --git a/rtpreceiver.go b/rtpreceiver.go index a836b2ff81c..2bea6e7870a 100644 --- a/rtpreceiver.go +++ b/rtpreceiver.go @@ -407,10 +407,7 @@ func (r *RTPReceiver) SetReadDeadline(t time.Time) error { r.mu.RLock() defer r.mu.RUnlock() - if err := r.tracks[0].rtcpReadStream.SetReadDeadline(t); err != nil { - return err - } - return nil + return r.tracks[0].rtcpReadStream.SetReadDeadline(t) } // SetReadDeadlineSimulcast sets the max amount of time the RTCP stream for a given rid will block before returning. 0 is forever. diff --git a/sctptransport.go b/sctptransport.go index db7b25256cb..db29c3d78e4 100644 --- a/sctptransport.go +++ b/sctptransport.go @@ -92,7 +92,7 @@ func (r *SCTPTransport) GetCapabilities() SCTPCapabilities { // Start the SCTPTransport. Since both local and remote parties must mutually // create an SCTPTransport, SCTP SO (Simultaneous Open) is used to establish // a connection over SCTP. -func (r *SCTPTransport) Start(remoteCaps SCTPCapabilities) error { +func (r *SCTPTransport) Start(SCTPCapabilities) error { if r.isStarted { return nil }