From f960a37453d5fc98493be2368cb42188b8d56bfc Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Wed, 9 Aug 2023 14:58:20 -0400 Subject: [PATCH] Wrap net.Conn in DTLS listener Wraps the net.Conn returned from the UDP listener in the DTLS listener. The underlying UDP listener will be adapted in the future to support returning net.PacketConn. Signed-off-by: Daniel Mangum --- listener.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/listener.go b/listener.go index 190d236c7..0d281fc4d 100644 --- a/listener.go +++ b/listener.go @@ -6,6 +6,7 @@ package dtls import ( "net" + "github.com/pion/dtls/v2/internal/util" "github.com/pion/dtls/v2/pkg/protocol" "github.com/pion/dtls/v2/pkg/protocol/recordlayer" "github.com/pion/transport/v2/udp" @@ -67,7 +68,7 @@ func (l *listener) Accept() (net.Conn, error) { if err != nil { return nil, err } - return Server(c, l.config) + return Server(util.FromConn(c), c.RemoteAddr(), l.config) } // Close closes the listener.