Skip to content

Commit

Permalink
Update CI configs to v0.10.6
Browse files Browse the repository at this point in the history
Update lint scripts and CI configs.
  • Loading branch information
pionbot authored and Sean-Der committed Apr 8, 2023
1 parent d1b7bdb commit 308f861
Show file tree
Hide file tree
Showing 43 changed files with 100 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -30,12 +30,12 @@ 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 }}

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
2 changes: 1 addition & 1 deletion .github/workflows/tidy-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 4 additions & 0 deletions dtlstransport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 2 additions & 0 deletions examples/bandwidth-estimation-from-disk/main.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down Expand Up @@ -32,6 +33,7 @@ const (
ivfHeaderSize = 32
)

// nolint: gocognit
func main() {
qualityLevels := []struct {
fileName string
Expand Down
1 change: 1 addition & 0 deletions examples/broadcast/main.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
5 changes: 3 additions & 2 deletions examples/custom-logger/main.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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{}) {
Expand Down
1 change: 1 addition & 0 deletions examples/data-channels-detach/main.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
1 change: 1 addition & 0 deletions examples/data-channels-flow-control/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// data-channels-flow-control demonstrates how to use the DataChannel congestion control APIs
package main

import (
Expand Down
1 change: 1 addition & 0 deletions examples/data-channels/main.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
26 changes: 9 additions & 17 deletions examples/examples.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// HTTP server that demonstrates Pion WebRTC examples
package main

import (
"encoding/json"
"errors"
"flag"
"fmt"
"go/build"
"html/template"
"log"
Expand All @@ -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"`
Expand All @@ -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"))
Expand Down Expand Up @@ -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)
}
Expand All @@ -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()
Expand All @@ -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 {
Expand All @@ -147,5 +139,5 @@ func getExamples() (*Examples, error) {
}
}

return &examples, nil
return &examples
}
2 changes: 2 additions & 0 deletions examples/ice-restart/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ice-restart demonstrates Pion WebRTC's ICE Restart abilities.
package main

import (
Expand Down Expand Up @@ -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))
}
2 changes: 2 additions & 0 deletions examples/ice-single-port/main.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down Expand Up @@ -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))
}
2 changes: 2 additions & 0 deletions examples/ice-tcp/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//go:build !js
// +build !js

// ice-tcp demonstrates Pion WebRTC's ICE TCP abilities.
package main

import (
Expand Down Expand Up @@ -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))
}
2 changes: 2 additions & 0 deletions examples/insertable-streams/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//go:build !js
// +build !js

// insertable-streams demonstrates how to use insertable streams with Pion
package main

import (
Expand All @@ -19,6 +20,7 @@ import (

const cipherKey = 0xAA

// nolint:gocognit
func main() {
peerConnection, err := webrtc.NewPeerConnection(webrtc.Configuration{
ICEServers: []webrtc.ICEServer{
Expand Down
1 change: 1 addition & 0 deletions examples/internal/signal/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func HTTPSDPServer() chan string {
})

go func() {
// nolint: gosec
err := http.ListenAndServe(":"+strconv.Itoa(*port), nil)
if err != nil {
panic(err)
Expand Down
1 change: 1 addition & 0 deletions examples/ortc/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//go:build !js
// +build !js

// ortc demonstrates Pion WebRTC's ORTC capabilities.
package main

import (
Expand Down
8 changes: 3 additions & 5 deletions examples/pion-to-pion/answer/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// pion-to-pion is an example of two pion instances communicating directly!
package main

import (
Expand All @@ -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
Expand Down Expand Up @@ -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))
}
8 changes: 3 additions & 5 deletions examples/pion-to-pion/offer/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// pion-to-pion is an example of two pion instances communicating directly!
package main

import (
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions examples/play-from-disk-renegotation/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//go:build !js
// +build !js

// play-from-disk-renegotation demonstrates Pion WebRTC's renegotiation abilities.
package main

import (
Expand Down Expand Up @@ -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))
}()

Expand Down
2 changes: 2 additions & 0 deletions examples/play-from-disk/main.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions examples/reflect/main.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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 ❤️.

Expand Down
Loading

0 comments on commit 308f861

Please sign in to comment.