Repository: pion/webrtc
Pull request #2481 (2023-05-19 00:26:23)

Update module github.com/stretchr/testify to v1.8.3
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/stretchr/testify](https://togithub.com/stretchr/testify) | require | patch | `v1.8.2` -> `v1.8.3` |

---

### Release Notes

<details>
<summary>stretchr/testify</summary>

### [`v1.8.3`](https://togithub.com/stretchr/testify/compare/v1.8.2...v1.8.3)

[Compare Source](https://togithub.com/stretchr/testify/compare/v1.8.2...v1.8.3)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/pion/webrtc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS45NS4xIiwidXBkYXRlZEluVmVyIjoiMzUuOTUuMSIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/pion/webrtc/pull/2481?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) Report
Patch coverage has no change and project coverage change: **`-7.63`** :warning:
> Comparison is base [(`c1bec49`)](https://app.codecov.io/gh/pion/webrtc/commit/c1bec495a3e43dafde9d301c8e20516fed844a99?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) 77.78% compared to head [(`d285cae`)](https://app.codecov.io/gh/pion/webrtc/pull/2481?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) 70.15%.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #2481      +/-   ##
==========================================
- Coverage   77.78%   70.15%   -7.63%     
==========================================
  Files          87       64      -23     
  Lines        9321     3354    -5967     
==========================================
- Hits         7250     2353    -4897     
+ Misses       1643      873     -770     
+ Partials      428      128     -300     
```

| Flag | Coverage Δ | |
|---|---|---|
| go | `?` | |
| wasm | `70.15% <ø> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#carryforward-flags-in-the-pull-request-comment) to find out more.

[see 47 files with indirect coverage changes](https://app.codecov.io/gh/pion/webrtc/pull/2481/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion)


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/pion/webrtc/pull/2481?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion).


Patch:
diff --git a/dtlstransport.go b/dtlstransport.go
index 68983e9f..a5426d56 100644
--- a/dtlstransport.go
+++ b/dtlstransport.go
@@ -334,6 +334,7 @@ func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error {
 	dtlsConfig.FlightInterval = t.api.settingEngine.dtls.retransmissionInterval
 	dtlsConfig.InsecureSkipVerifyHello = t.api.settingEngine.dtls.insecureSkipHelloVerify
 	dtlsConfig.EllipticCurves = t.api.settingEngine.dtls.ellipticCurves
+	dtlsConfig.ConnectContextMaker = t.api.settingEngine.dtls.connectContextMaker
 
 	// Connect as DTLS Client/Server, function is blocking and we
 	// must not hold the DTLSTransport lock
diff --git a/go.mod b/go.mod
index ede93f7c..ec883331 100644
--- a/go.mod
+++ b/go.mod
@@ -19,6 +19,6 @@ require (
 	github.com/pion/stun v0.5.2
 	github.com/pion/transport/v2 v2.2.0
 	github.com/sclevine/agouti v3.0.0+incompatible
-	github.com/stretchr/testify v1.8.2
+	github.com/stretchr/testify v1.8.3
 	golang.org/x/net v0.10.0
 )
diff --git a/go.sum b/go.sum
index 414b719b..abe5e039 100644
--- a/go.sum
+++ b/go.sum
@@ -90,8 +90,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
 github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
 github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
-github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
 github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
+github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
 github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
diff --git a/settingengine.go b/settingengine.go
index 914412aa..1c7824d8 100644
--- a/settingengine.go
+++ b/settingengine.go
@@ -7,6 +7,7 @@
 package webrtc
 
 import (
+	"context"
 	"io"
 	"net"
 	"time"
@@ -63,6 +64,7 @@ type SettingEngine struct {
 		insecureSkipHelloVerify bool
 		retransmissionInterval  time.Duration
 		ellipticCurves          []dtlsElliptic.Curve
+		connectContextMaker     func() (context.Context, func())
 	}
 	sctp struct {
 		maxReceiveBufferSize uint32
@@ -368,6 +370,17 @@ func (e *SettingEngine) SetDTLSEllipticCurves(ellipticCurves ...dtlsElliptic.Cur
 	e.dtls.ellipticCurves = ellipticCurves
 }
 
+// SetDTLSConnectContextMaker sets the context used during the DTLS Handshake.
+// It can be used to extend or reduce the timeout on the DTLS Handshake.
+// If nil, the default dtls.ConnectContextMaker is used. It can be implemented as following.
+//
+//	func ConnectContextMaker() (context.Context, func()) {
+//		return context.WithTimeout(context.Background(), 30*time.Second)
+//	}
+func (e *SettingEngine) SetDTLSConnectContextMaker(connectContextMaker func() (context.Context, func())) {
+	e.dtls.connectContextMaker = connectContextMaker
+}
+
 // SetSCTPMaxReceiveBufferSize sets the maximum receive buffer size.
 // Leave this 0 for the default maxReceiveBufferSize.
 func (e *SettingEngine) SetSCTPMaxReceiveBufferSize(maxReceiveBufferSize uint32) {


Test patch:
diff --git a/settingengine_test.go b/settingengine_test.go
index 6001ad81..3834db83 100644
--- a/settingengine_test.go
+++ b/settingengine_test.go
@@ -7,6 +7,7 @@
 package webrtc
 
 import (
+	"context"
 	"net"
 	"testing"
 	"time"
@@ -252,6 +253,14 @@ func TestSetDTLSEllipticCurves(t *testing.T) {
 	}
 }
 
+func TestSetDTLSHandShakeTimeout(*testing.T) {
+	s := SettingEngine{}
+
+	s.SetDTLSConnectContextMaker(func() (context.Context, func()) {
+		return context.WithTimeout(context.Background(), 60*time.Second)
+	})
+}
+
 func TestSetSCTPMaxReceiverBufferSize(t *testing.T) {
 	s := SettingEngine{}
 	assert.Equal(t, uint32(0), s.sctp.maxReceiveBufferSize)