Update CI configs to v0.10.6

Update lint scripts and CI configs.
This commit is contained in:
Pion
2023-04-07 20:08:34 +00:00
committed by Sean DuBois
parent d1b7bdbe73
commit 308f8616a3
43 changed files with 100 additions and 75 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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{

View File

@@ -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)
}

View File

@@ -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

View File

@@ -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 (

View File

@@ -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{}) {

View File

@@ -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 (

View File

@@ -1,3 +1,4 @@
// data-channels-flow-control demonstrates how to use the DataChannel congestion control APIs
package main
import (

View File

@@ -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 (

View File

@@ -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
}

View File

@@ -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))
}

View File

@@ -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))
}

View File

@@ -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))
}

View File

@@ -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{

View File

@@ -21,6 +21,7 @@ func HTTPSDPServer() chan string {
})
go func() {
// nolint: gosec
err := http.ListenAndServe(":"+strconv.Itoa(*port), nil)
if err != nil {
panic(err)

View File

@@ -1,6 +1,7 @@
//go:build !js
// +build !js
// ortc demonstrates Pion WebRTC's ORTC capabilities.
package main
import (

View File

@@ -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))
}

View File

@@ -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'

View File

@@ -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))
}()

View File

@@ -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)

View File

@@ -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 ❤️.

View File

@@ -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 (

View File

@@ -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 ❤️.

View File

@@ -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 (

View File

@@ -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 (

View File

@@ -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 ❤️.

View File

@@ -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 ❤️.

View File

@@ -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 (

View File

@@ -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))
}

View File

@@ -1,6 +1,7 @@
//go:build !js
// +build !js
// show-network-usage shows the amount of packets flowing through the vnet
package main
import (

View File

@@ -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

View File

@@ -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 {

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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()
}

View File

@@ -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
}

View File

@@ -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}
}

View File

@@ -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) {
}
}

View File

@@ -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
}

View File

@@ -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.

View File

@@ -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
}