Update module github.com/pion/dtls/v2 to v3

Generated by renovateBot
This commit is contained in:
Sean DuBois
2024-07-25 11:24:45 -04:00
parent 6a4a57a682
commit f388de6581
8 changed files with 35 additions and 12 deletions

View File

@@ -20,7 +20,7 @@ import (
"strings"
"time"
"github.com/pion/dtls/v2/pkg/crypto/fingerprint"
"github.com/pion/dtls/v3/pkg/crypto/fingerprint"
"github.com/pion/webrtc/v4/pkg/rtcerr"
)

View File

@@ -3,7 +3,7 @@
package webrtc
import "github.com/pion/dtls/v2"
import "github.com/pion/dtls/v3"
const (
// Equal to UDP MTU

View File

@@ -19,8 +19,8 @@ import (
"sync/atomic"
"time"
"github.com/pion/dtls/v2"
"github.com/pion/dtls/v2/pkg/crypto/fingerprint"
"github.com/pion/dtls/v3"
"github.com/pion/dtls/v3/pkg/crypto/fingerprint"
"github.com/pion/interceptor"
"github.com/pion/logging"
"github.com/pion/rtcp"
@@ -284,7 +284,7 @@ func (t *DTLSTransport) role() DTLSRole {
}
// Start DTLS transport negotiation with the parameters of the remote DTLS transport
func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error {
func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error { //nolint: gocognit
// Take lock and prepare connection, we must not hold the lock
// when connecting
prepareTransport := func() (DTLSRole, *dtls.Config, error) {
@@ -346,7 +346,6 @@ 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
dtlsConfig.ExtendedMasterSecret = t.api.settingEngine.dtls.extendedMasterSecret
dtlsConfig.ClientCAs = t.api.settingEngine.dtls.clientCAs
dtlsConfig.RootCAs = t.api.settingEngine.dtls.rootCAs
@@ -355,9 +354,18 @@ func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error {
// Connect as DTLS Client/Server, function is blocking and we
// must not hold the DTLSTransport lock
if role == DTLSRoleClient {
dtlsConn, err = dtls.Client(dtlsEndpoint, dtlsConfig)
dtlsConn, err = dtls.Client(dtlsEndpoint, dtlsEndpoint.RemoteAddr(), dtlsConfig)
} else {
dtlsConn, err = dtls.Server(dtlsEndpoint, dtlsConfig)
dtlsConn, err = dtls.Server(dtlsEndpoint, dtlsEndpoint.RemoteAddr(), dtlsConfig)
}
if err == nil {
if t.api.settingEngine.dtls.connectContextMaker != nil {
handshakeCtx, _ := t.api.settingEngine.dtls.connectContextMaker()
err = dtlsConn.HandshakeContext(handshakeCtx)
} else {
err = dtlsConn.Handshake()
}
}
// Re-take the lock, nothing beyond here is blocking

3
go.mod
View File

@@ -4,7 +4,7 @@ go 1.19
require (
github.com/pion/datachannel v1.5.8
github.com/pion/dtls/v2 v2.2.12
github.com/pion/dtls/v3 v3.0.0
github.com/pion/ice/v3 v3.0.13
github.com/pion/interceptor v0.1.29
github.com/pion/logging v0.2.2
@@ -26,6 +26,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.17.0 // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/mdns/v2 v2.0.7 // indirect
github.com/pion/transport/v2 v2.2.8 // indirect
github.com/pion/turn/v3 v3.0.3 // indirect

2
go.sum
View File

@@ -40,6 +40,8 @@ github.com/pion/datachannel v1.5.8/go.mod h1:PgmdpoaNBLX9HNzNClmdki4DYW5JtI7Yibu
github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
github.com/pion/dtls/v2 v2.2.12 h1:KP7H5/c1EiVAAKUmXyCzPiQe5+bCJrpOeKg/L05dunk=
github.com/pion/dtls/v2 v2.2.12/go.mod h1:d9SYc9fch0CqK90mRk1dC7AkzzpwJj6u2GU3u+9pqFE=
github.com/pion/dtls/v3 v3.0.0 h1:m2hzwPkzqoBjVKXm5ymNuX01OAjht82TdFL6LoTzgi4=
github.com/pion/dtls/v3 v3.0.0/go.mod h1:tiX7NaneB0wNoRaUpaMVP7igAlkMCTQkbpiY+OfeIi0=
github.com/pion/ice/v3 v3.0.13 h1:tPi5fh2xbWhS0DBcs7LTEG0SOUTHLVDjTlFwBy3hXfw=
github.com/pion/ice/v3 v3.0.13/go.mod h1:q2M/RnfpgGhC4HcluxPpD1wImaqFqU0Z1PE2eeOPrIs=
github.com/pion/interceptor v0.1.29 h1:39fsnlP1U8gw2JzOFWdfCU82vHvhW9o0rZnZF56wF+M=

View File

@@ -44,6 +44,13 @@ func (e *Endpoint) Read(p []byte) (int, error) {
return e.buffer.Read(p)
}
// ReadFrom reads a packet of len(p) bytes from the underlying conn
// that are matched by the associated MuxFunc
func (e *Endpoint) ReadFrom(p []byte) (int, net.Addr, error) {
i, err := e.Read(p)
return i, nil, err
}
// Write writes len(p) bytes to the underlying conn
func (e *Endpoint) Write(p []byte) (int, error) {
n, err := e.mux.nextConn.Write(p)
@@ -56,6 +63,11 @@ func (e *Endpoint) Write(p []byte) (int, error) {
return n, err
}
// WriteTo writes len(p) bytes to the underlying conn
func (e *Endpoint) WriteTo(p []byte, _ net.Addr) (int, error) {
return e.Write(p)
}
// LocalAddr is a stub
func (e *Endpoint) LocalAddr() net.Addr {
return e.mux.nextConn.LocalAddr()

View File

@@ -13,8 +13,8 @@ import (
"net"
"time"
"github.com/pion/dtls/v2"
dtlsElliptic "github.com/pion/dtls/v2/pkg/crypto/elliptic"
"github.com/pion/dtls/v3"
dtlsElliptic "github.com/pion/dtls/v3/pkg/crypto/elliptic"
"github.com/pion/ice/v3"
"github.com/pion/logging"
"github.com/pion/stun/v2"

View File

@@ -12,7 +12,7 @@ import (
"testing"
"time"
"github.com/pion/dtls/v2/pkg/crypto/elliptic"
"github.com/pion/dtls/v3/pkg/crypto/elliptic"
"github.com/pion/ice/v3"
"github.com/pion/stun/v2"
"github.com/pion/transport/v3/test"