Repository: pion/ice
Pull request #471 (2022-09-01 18:08:55)

Use new pion/transport Net interface
See https://github.com/pion/transport/pull/204 for a detailed description

Also closes #509 

codecov[bot]: # [Codecov](https://codecov.io/gh/pion/ice/pull/471?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) Report
Base: **78.62**% // Head: **25.59**% // Decreases project coverage by **`-53.02%`** :warning:
> Coverage data is based on head [(`043f826`)](https://codecov.io/gh/pion/ice/pull/471?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) compared to base [(`be69d2c`)](https://codecov.io/gh/pion/ice/commit/be69d2c2aedc9b71f78205b176e9d2f11e213717?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion).
> Patch coverage: 0.00% of modified lines in pull request are covered.

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


```diff
@@             Coverage Diff             @@
##           master     #471       +/-   ##
===========================================
- Coverage   78.62%   25.59%   -53.03%     
===========================================
  Files          34       34               
  Lines        3958     3961        +3     
===========================================
- Hits         3112     1014     -2098     
- Misses        647     2909     +2262     
+ Partials      199       38      -161     
```

| Flag | Coverage Δ | |
|---|---|---|
| go | `?` | |
| wasm | `25.59% <0.00%> (-0.02%)` | :arrow_down: |

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.

| [Impacted Files](https://codecov.io/gh/pion/ice/pull/471?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | |
|---|---|---|
| [agent.go](https://codecov.io/gh/pion/ice/pull/471/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-YWdlbnQuZ28=) | `0.00% <0.00%> (-82.04%)` | :arrow_down: |
| [agent\_config.go](https://codecov.io/gh/pion/ice/pull/471/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-YWdlbnRfY29uZmlnLmdv) | `0.00% <ø> (-82.15%)` | :arrow_down: |
| [util.go](https://codecov.io/gh/pion/ice/pull/471/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-dXRpbC5nbw==) | `13.04% <0.00%> (-61.50%)` | :arrow_down: |
| [agent\_stats.go](https://codecov.io/gh/pion/ice/pull/471/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-YWdlbnRfc3RhdHMuZ28=) | `0.00% <0.00%> (-83.51%)` | :arrow_down: |
| [selection.go](https://codecov.io/gh/pion/ice/pull/471/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-c2VsZWN0aW9uLmdv) | `0.00% <0.00%> (-82.25%)` | :arrow_down: |
| [candidate\_peer\_reflexive.go](https://codecov.io/gh/pion/ice/pull/471/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-Y2FuZGlkYXRlX3BlZXJfcmVmbGV4aXZlLmdv) | `0.00% <0.00%> (-80.65%)` | :arrow_down: |
| [transport.go](https://codecov.io/gh/pion/ice/pull/471/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-dHJhbnNwb3J0Lmdv) | `0.00% <0.00%> (-79.73%)` | :arrow_down: |
| [udp\_mux.go](https://codecov.io/gh/pion/ice/pull/471/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-dWRwX211eC5nbw==) | `0.00% <0.00%> (-78.22%)` | :arrow_down: |
| ... and [15 more](https://codecov.io/gh/pion/ice/pull/471/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/pion/ice/pull/471?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).

stv0g: Thanks @enobufs and @at-wat for your reviews.

> I will review again when it comes out of the draft state

The PR is now ready for merging when you are happy with it :)
stv0g: Thanks @edaniels,

I committed your proposed changed 👍 

Patch:
diff --git a/agent.go b/agent.go
index 70d4908..66ae3f7 100644
--- a/agent.go
+++ b/agent.go
@@ -4,6 +4,7 @@ package ice
 
 import (
 	"context"
+	"fmt"
 	"net"
 	"strings"
 	"sync"
@@ -13,8 +14,10 @@ import (
 	"github.com/pion/logging"
 	"github.com/pion/mdns"
 	"github.com/pion/stun"
-	"github.com/pion/transport/packetio"
-	"github.com/pion/transport/vnet"
+	"github.com/pion/transport/v2"
+	"github.com/pion/transport/v2/packetio"
+	"github.com/pion/transport/v2/stdnet"
+	"github.com/pion/transport/v2/vnet"
 	"golang.org/x/net/proxy"
 )
 
@@ -123,7 +126,7 @@ type Agent struct {
 	loggerFactory logging.LoggerFactory
 	log           logging.LeveledLogger
 
-	net         *vnet.Net
+	net         transport.Net
 	tcpMux      TCPMux
 	udpMux      UDPMux
 	udpMuxSrflx UniversalUDPMux
@@ -262,21 +265,6 @@ func NewAgent(config *AgentConfig) (*Agent, error) { //nolint:gocognit
 	}
 	log := loggerFactory.NewLogger("ice")
 
-	var mDNSConn *mdns.Conn
-	mDNSConn, mDNSMode, err = createMulticastDNS(mDNSMode, mDNSName, log)
-	// Opportunistic mDNS: If we can't open the connection, that's ok: we
-	// can continue without it.
-	if err != nil {
-		log.Warnf("Failed to initialize mDNS %s: %v", mDNSName, err)
-	}
-	closeMDNSConn := func() {
-		if mDNSConn != nil {
-			if mdnsCloseErr := mDNSConn.Close(); mdnsCloseErr != nil {
-				log.Warnf("Failed to close mDNS: %v", mdnsCloseErr)
-			}
-		}
-	}
-
 	startedCtx, startedFn := context.WithCancel(context.Background())
 
 	a := &Agent{
@@ -307,7 +295,6 @@ func NewAgent(config *AgentConfig) (*Agent, error) { //nolint:gocognit
 
 		mDNSMode: mDNSMode,
 		mDNSName: mDNSName,
-		mDNSConn: mDNSConn,
 
 		gatherCandidateCancel: func() {},
 
@@ -330,11 +317,27 @@ func NewAgent(config *AgentConfig) (*Agent, error) { //nolint:gocognit
 	a.udpMuxSrflx = config.UDPMuxSrflx
 
 	if a.net == nil {
-		a.net = vnet.NewNet(nil)
-	} else if a.net.IsVirtual() {
-		a.log.Warn("vnet is enabled")
+		a.net, err = stdnet.NewNet()
+		if err != nil {
+			return nil, fmt.Errorf("failed to create network: %w", err)
+		}
+	} else if _, isVirtual := a.net.(*vnet.Net); isVirtual {
+		a.log.Warn("virtual network is enabled")
 		if a.mDNSMode != MulticastDNSModeDisabled {
-			a.log.Warn("vnet does not support mDNS yet")
+			a.log.Warn("virtual network does not support mDNS yet")
+		}
+	}
+
+	// Opportunistic mDNS: If we can't open the connection, that's ok: we
+	// can continue without it.
+	if a.mDNSConn, a.mDNSMode, err = createMulticastDNS(a.net, mDNSMode, mDNSName, log); err != nil {
+		log.Warnf("Failed to initialize mDNS %s: %v", mDNSName, err)
+	}
+	closeMDNSConn := func() {
+		if a.mDNSConn != nil {
+			if mdnsCloseErr := a.mDNSConn.Close(); mdnsCloseErr != nil {
+				log.Warnf("Failed to close mDNS: %v", mdnsCloseErr)
+			}
 		}
 	}
 
diff --git a/agent_config.go b/agent_config.go
index 54a61ba..c823887 100644
--- a/agent_config.go
+++ b/agent_config.go
@@ -5,7 +5,7 @@ import (
 	"time"
 
 	"github.com/pion/logging"
-	"github.com/pion/transport/vnet"
+	"github.com/pion/transport/v2"
 	"golang.org/x/net/proxy"
 )
 
@@ -130,8 +130,8 @@ type AgentConfig struct {
 	RelayAcceptanceMinWait *time.Duration
 
 	// Net is the our abstracted network interface for internal development purpose only
-	// (see github.com/pion/transport/vnet)
-	Net *vnet.Net
+	// (see https://github.com/pion/transport)
+	Net transport.Net
 
 	// InterfaceFilter is a function that you can use in order to whitelist or blacklist
 	// the interfaces which are used to gather ICE candidates.
diff --git a/candidate_peer_reflexive.go b/candidate_peer_reflexive.go
index 0b330d1..683abd0 100644
--- a/candidate_peer_reflexive.go
+++ b/candidate_peer_reflexive.go
@@ -1,4 +1,5 @@
 // Package ice ...
+//
 //nolint:dupl
 package ice
 
diff --git a/candidate_server_reflexive.go b/candidate_server_reflexive.go
index 125a537..66633ca 100644
--- a/candidate_server_reflexive.go
+++ b/candidate_server_reflexive.go
@@ -1,5 +1,3 @@
-// Package ice ...
-//nolint:dupl
 package ice
 
 import "net"
diff --git a/examples/ping-pong/main.go b/examples/ping-pong/main.go
index b08644f..439caa0 100644
--- a/examples/ping-pong/main.go
+++ b/examples/ping-pong/main.go
@@ -1,3 +1,4 @@
+// Package main implements a simple example demonstrating a Pion-to-Pion ICE connection
 package main
 
 import (
@@ -14,7 +15,7 @@ import (
 	"github.com/pion/randutil"
 )
 
-//nolint
+// nolint:gochecknoglobals
 var (
 	isControlling                 bool
 	iceAgent                      *ice.Agent
@@ -43,7 +44,7 @@ func remoteCandidate(w http.ResponseWriter, r *http.Request) {
 		panic(err)
 	}
 
-	if err := iceAgent.AddRemoteCandidate(c); err != nil {
+	if err := iceAgent.AddRemoteCandidate(c); err != nil { //nolint:contextcheck
 		panic(err)
 	}
 }
@@ -69,7 +70,7 @@ func main() { //nolint
 	http.HandleFunc("/remoteAuth", remoteAuth)
 	http.HandleFunc("/remoteCandidate", remoteCandidate)
 	go func() {
-		if err = http.ListenAndServe(fmt.Sprintf(":%d", localHTTPPort), nil); err != nil {
+		if err = http.ListenAndServe(fmt.Sprintf(":%d", localHTTPPort), nil); err != nil { //nolint:gosec
 			panic(err)
 		}
 	}()
diff --git a/gather.go b/gather.go
index c2f67a0..db90325 100644
--- a/gather.go
+++ b/gather.go
@@ -579,13 +579,13 @@ func (a *Agent) gatherCandidatesRelay(ctx context.Context, urls []*URL) { //noli
 				locConn = turn.NewSTUNConn(conn)
 
 			case url.Proto == ProtoTypeTCP && url.Scheme == SchemeTypeTURN:
-				tcpAddr, connectErr := net.ResolveTCPAddr(NetworkTypeTCP4.String(), TURNServerAddr)
+				tcpAddr, connectErr := a.net.ResolveTCPAddr(NetworkTypeTCP4.String(), TURNServerAddr)
 				if connectErr != nil {
 					a.log.Warnf("Failed to resolve TCP Addr %s: %v", TURNServerAddr, connectErr)
 					return
 				}
 
-				conn, connectErr := net.DialTCP(NetworkTypeTCP4.String(), nil, tcpAddr)
+				conn, connectErr := a.net.DialTCP(NetworkTypeTCP4.String(), nil, tcpAddr)
 				if connectErr != nil {
 					a.log.Warnf("Failed to Dial TCP Addr %s: %v", TURNServerAddr, connectErr)
 					return
@@ -596,18 +596,24 @@ func (a *Agent) gatherCandidatesRelay(ctx context.Context, urls []*URL) { //noli
 				relayProtocol = tcp
 				locConn = turn.NewSTUNConn(conn)
 			case url.Proto == ProtoTypeUDP && url.Scheme == SchemeTypeTURNS:
-				udpAddr, connectErr := net.ResolveUDPAddr(network, TURNServerAddr)
+				udpAddr, connectErr := a.net.ResolveUDPAddr(network, TURNServerAddr)
 				if connectErr != nil {
 					a.log.Warnf("Failed to resolve UDP Addr %s: %v", TURNServerAddr, connectErr)
 					return
 				}
 
-				conn, connectErr := dtls.Dial(network, udpAddr, &dtls.Config{ //nolint:contextcheck
+				udpConn, dialErr := a.net.DialUDP("udp", nil, udpAddr)
+				if dialErr != nil {
+					a.log.Warnf("Failed to dial DTLS Address %s: %v", TURNServerAddr, dialErr)
+					return
+				}
+
+				conn, connectErr := dtls.ClientWithContext(ctx, udpConn, &dtls.Config{
 					ServerName:         url.Host,
 					InsecureSkipVerify: a.insecureSkipVerify, //nolint:gosec
 				})
 				if connectErr != nil {
-					a.log.Warnf("Failed to Dial DTLS Addr %s: %v", TURNServerAddr, connectErr)
+					a.log.Warnf("Failed to create DTLS client: %v", TURNServerAddr, connectErr)
 					return
 				}
 
@@ -616,13 +622,30 @@ func (a *Agent) gatherCandidatesRelay(ctx context.Context, urls []*URL) { //noli
 				relayProtocol = "dtls"
 				locConn = &fakePacketConn{conn}
 			case url.Proto == ProtoTypeTCP && url.Scheme == SchemeTypeTURNS:
-				conn, connectErr := tls.Dial(NetworkTypeTCP4.String(), TURNServerAddr, &tls.Config{
+				tcpAddr, resolvErr := a.net.ResolveTCPAddr(NetworkTypeTCP4.String(), TURNServerAddr)
+				if resolvErr != nil {
+					a.log.Warnf("Failed to resolve relay address %s: %v", TURNServerAddr, resolvErr)
+					return
+				}
+
+				tcpConn, dialErr := a.net.DialTCP(NetworkTypeTCP4.String(), nil, tcpAddr)
+				if dialErr != nil {
+					a.log.Warnf("Failed to connect to relay: %v", dialErr)
+					return
+				}
+
+				conn := tls.Client(tcpConn, &tls.Config{
 					InsecureSkipVerify: a.insecureSkipVerify, //nolint:gosec
 				})
-				if connectErr != nil {
-					a.log.Warnf("Failed to Dial TLS Addr %s: %v", TURNServerAddr, connectErr)
+
+				if hsErr := conn.HandshakeContext(ctx); hsErr != nil {
+					if closeErr := tcpConn.Close(); closeErr != nil {
+						a.log.Errorf("Failed to close relay connection: %v", closeErr)
+					}
+					a.log.Warnf("Failed to connect to relay: %v", hsErr)
 					return
 				}
+
 				RelAddr = conn.LocalAddr().(*net.TCPAddr).IP.String() //nolint:forcetypeassert
 				RelPort = conn.LocalAddr().(*net.TCPAddr).Port        //nolint:forcetypeassert
 				relayProtocol = "tls"
diff --git a/go.mod b/go.mod
index 551477e..fc6ff83 100644
--- a/go.mod
+++ b/go.mod
@@ -10,8 +10,8 @@ require (
 	github.com/pion/mdns v0.0.7
 	github.com/pion/randutil v0.1.0
 	github.com/pion/stun v0.4.0
-	github.com/pion/transport v0.14.1
-	github.com/pion/turn/v2 v2.0.9
+	github.com/pion/transport/v2 v2.0.1
+	github.com/pion/turn/v2 v2.1.0
 	github.com/stretchr/testify v1.8.1
 	golang.org/x/net v0.5.0
 	gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
diff --git a/go.sum b/go.sum
index e8c7b79..1bd0218 100644
--- a/go.sum
+++ b/go.sum
@@ -16,16 +16,13 @@ github.com/pion/mdns v0.0.7 h1:P0UB4Sr6xDWEox0kTVxF0LmQihtCbSAdW0H2nEgkA3U=
 github.com/pion/mdns v0.0.7/go.mod h1:4iP2UbeFhLI/vWju/bw6ZfwjJzk0z8DNValjGxR/dD8=
 github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA=
 github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8=
-github.com/pion/stun v0.3.5/go.mod h1:gDMim+47EeEtfWogA37n6qXZS88L5V6LqFcf+DZA2UA=
 github.com/pion/stun v0.4.0 h1:vgRrbBE2htWHy7l3Zsxckk7rkjnjOsSM7PHZnBwo8rk=
 github.com/pion/stun v0.4.0/go.mod h1:QPsh1/SbXASntw3zkkrIk3ZJVKz4saBY2G7S10P3wCw=
-github.com/pion/transport v0.13.1/go.mod h1:EBxbqzyv+ZrmDb82XswEE0BjfQFtuw1Nu6sjnjWCsGg=
-github.com/pion/transport v0.14.1 h1:XSM6olwW+o8J4SCmOBb/BpwZypkHeyM0PGFCxNQBr40=
-github.com/pion/transport v0.14.1/go.mod h1:4tGmbk00NeYA3rUa9+n+dzCCoKkcy3YlYb99Jn2fNnI=
-github.com/pion/transport/v2 v2.0.0 h1:bsMYyqHCbkvHwj+eNCFBuxtlKndKfyGI2vaQmM3fIE4=
 github.com/pion/transport/v2 v2.0.0/go.mod h1:HS2MEBJTwD+1ZI2eSXSvHJx/HnzQqRy2/LXxt6eVMHc=
-github.com/pion/turn/v2 v2.0.9 h1:jcDPw0Vfd5I4iTc7s0Upfc2aMnyu2lgJ9vV0SUrNC1o=
-github.com/pion/turn/v2 v2.0.9/go.mod h1:DQlwUwx7hL8Xya6TTAabbd9DdKXTNR96Xf5g5Qqso/M=
+github.com/pion/transport/v2 v2.0.1 h1:cbSk3gzoSBEIKVGNYeghXQSp47s1H9ttoP5JyLCgxLE=
+github.com/pion/transport/v2 v2.0.1/go.mod h1:93OYg91+mrGxKW+Jrgzmqr80kgXqD7J0yybOrdr7w0Y=
+github.com/pion/turn/v2 v2.1.0 h1:5wGHSgGhJhP/RpabkUb/T9PdsAjkGLS6toYz5HNzoSI=
+github.com/pion/turn/v2 v2.1.0/go.mod h1:yrT5XbXSGX1VFSF31A3c1kCNB5bBZgk/uu5LET162qs=
 github.com/pion/udp v0.1.4 h1:OowsTmu1Od3sD6i3fQUJxJn2fEvJO6L1TidgadtbTI8=
 github.com/pion/udp v0.1.4/go.mod h1:G8LDo56HsFwC24LIcnT4YIDU5qcB6NepqqjP0keL2us=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -45,7 +42,6 @@ golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU
 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
 golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
 golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
 golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
@@ -56,7 +52,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
diff --git a/mdns.go b/mdns.go
index 5a431d1..c7229ed 100644
--- a/mdns.go
+++ b/mdns.go
@@ -1,11 +1,10 @@
 package ice
 
 import (
-	"net"
-
 	"github.com/google/uuid"
 	"github.com/pion/logging"
 	"github.com/pion/mdns"
+	"github.com/pion/transport/v2"
 	"golang.org/x/net/ipv4"
 )
 
@@ -31,17 +30,17 @@ func generateMulticastDNSName() (string, error) {
 	return u.String() + ".local", err
 }
 
-func createMulticastDNS(mDNSMode MulticastDNSMode, mDNSName string, log logging.LeveledLogger) (*mdns.Conn, MulticastDNSMode, error) {
+func createMulticastDNS(n transport.Net, mDNSMode MulticastDNSMode, mDNSName string, log logging.LeveledLogger) (*mdns.Conn, MulticastDNSMode, error) {
 	if mDNSMode == MulticastDNSModeDisabled {
 		return nil, mDNSMode, nil
 	}
 
-	addr, mdnsErr := net.ResolveUDPAddr("udp4", mdns.DefaultAddress)
+	addr, mdnsErr := n.ResolveUDPAddr("udp4", mdns.DefaultAddress)
 	if mdnsErr != nil {
 		return nil, mDNSMode, mdnsErr
 	}
 
-	l, mdnsErr := net.ListenUDP("udp4", addr)
+	l, mdnsErr := n.ListenUDP("udp4", addr)
 	if mdnsErr != nil {
 		// If ICE fails to start MulticastDNS server just warn the user and continue
 		log.Errorf("Failed to enable mDNS, continuing in mDNS disabled mode: (%s)", mdnsErr)
diff --git a/tcp_packet_conn.go b/tcp_packet_conn.go
index 30aed5b..aaaf0d9 100644
--- a/tcp_packet_conn.go
+++ b/tcp_packet_conn.go
@@ -10,7 +10,7 @@ import (
 	"time"
 
 	"github.com/pion/logging"
-	"github.com/pion/transport/packetio"
+	"github.com/pion/transport/v2/packetio"
 )
 
 type bufferedConn struct {
diff --git a/udp_mux.go b/udp_mux.go
index d589020..b4528bb 100644
--- a/udp_mux.go
+++ b/udp_mux.go
@@ -10,7 +10,8 @@ import (
 
 	"github.com/pion/logging"
 	"github.com/pion/stun"
-	"github.com/pion/transport/vnet"
+	"github.com/pion/transport/v2"
+	"github.com/pion/transport/v2/stdnet"
 )
 
 // UDPMux allows multiple connections to go over a single UDP port
@@ -49,6 +50,11 @@ const maxAddrSize = 512
 type UDPMuxParams struct {
 	Logger  logging.LeveledLogger
 	UDPConn net.PacketConn
+
+	// Required for gathering local addresses
+	// in case a un UDPConn is passed which does not
+	// bind to a specific local address.
+	Net transport.Net
 }
 
 // NewUDPMuxDefault creates an implementation of UDPMux
@@ -77,8 +83,14 @@ func NewUDPMuxDefault(params UDPMuxParams) *UDPMuxDefault {
 			params.Logger.Errorf("LocalAddr expected IPV4 or IPV6, got %T", params.UDPConn.LocalAddr())
 		}
 		if len(networks) > 0 {
-			muxNet := vnet.NewNet(nil)
-			ips, err := localInterfaces(muxNet, nil, nil, networks, true)
+			if params.Net == nil {
+				var err error
+				if params.Net, err = stdnet.NewNet(); err != nil {
+					params.Logger.Errorf("failed to get create network: %v", err)
+				}
+			}
+
+			ips, err := localInterfaces(params.Net, nil, nil, networks, true)
 			if err == nil {
 				for _, ip := range ips {
 					localAddrsForUnspecified = append(localAddrsForUnspecified, &net.UDPAddr{IP: ip, Port: addr.Port})
diff --git a/udp_mux_multi.go b/udp_mux_multi.go
index 0c9b15b..c161839 100644
--- a/udp_mux_multi.go
+++ b/udp_mux_multi.go
@@ -4,10 +4,12 @@
 package ice
 
 import (
+	"fmt"
 	"net"
 
 	"github.com/pion/logging"
-	"github.com/pion/transport/vnet"
+	"github.com/pion/transport/v2"
+	"github.com/pion/transport/v2/stdnet"
 )
 
 // MultiUDPMuxDefault implements both UDPMux and AllConnsGetter,
@@ -80,15 +82,22 @@ func NewMultiUDPMuxFromPort(port int, opts ...UDPMuxFromPortOption) (*MultiUDPMu
 	for _, opt := range opts {
 		opt.apply(&params)
 	}
-	muxNet := vnet.NewNet(nil)
-	ips, err := localInterfaces(muxNet, params.ifFilter, params.ipFilter, params.networks, params.includeLoopback)
+
+	if params.net == nil {
+		var err error
+		if params.net, err = stdnet.NewNet(); err != nil {
+			return nil, fmt.Errorf("failed to get create network: %w", err)
+		}
+	}
+
+	ips, err := localInterfaces(params.net, params.ifFilter, params.ipFilter, params.networks, params.includeLoopback)
 	if err != nil {
 		return nil, err
 	}
 
 	conns := make([]net.PacketConn, 0, len(ips))
 	for _, ip := range ips {
-		conn, listenErr := net.ListenUDP("udp", &net.UDPAddr{IP: ip, Port: port})
+		conn, listenErr := params.net.ListenUDP("udp", &net.UDPAddr{IP: ip, Port: port})
 		if listenErr != nil {
 			err = listenErr
 			break
@@ -111,7 +120,11 @@ func NewMultiUDPMuxFromPort(port int, opts ...UDPMuxFromPortOption) (*MultiUDPMu
 
 	muxes := make([]UDPMux, 0, len(conns))
 	for _, conn := range conns {
-		mux := NewUDPMuxDefault(UDPMuxParams{Logger: params.logger, UDPConn: conn})
+		mux := NewUDPMuxDefault(UDPMuxParams{
+			Logger:  params.logger,
+			UDPConn: conn,
+			Net:     params.net,
+		})
 		muxes = append(muxes, mux)
 	}
 
@@ -131,6 +144,7 @@ type multiUDPMuxFromPortParam struct {
 	writeBufferSize int
 	logger          logging.LeveledLogger
 	includeLoopback bool
+	net             transport.Net
 }
 
 type udpMuxFromPortOption struct {
@@ -203,3 +217,12 @@ func UDPMuxFromPortWithLoopback() UDPMuxFromPortOption {
 		},
 	}
 }
+
+// UDPMuxFromPortWithNet sets the network transport to use.
+func UDPMuxFromPortWithNet(n transport.Net) UDPMuxFromPortOption {
+	return &udpMuxFromPortOption{
+		f: func(p *multiUDPMuxFromPortParam) {
+			p.net = n
+		},
+	}
+}
diff --git a/udp_mux_universal.go b/udp_mux_universal.go
index f1e05ac..c2913d5 100644
--- a/udp_mux_universal.go
+++ b/udp_mux_universal.go
@@ -7,6 +7,7 @@ import (
 
 	"github.com/pion/logging"
 	"github.com/pion/stun"
+	"github.com/pion/transport/v2"
 )
 
 // UniversalUDPMux allows multiple connections to go over a single UDP port for
@@ -35,6 +36,7 @@ type UniversalUDPMuxParams struct {
 	Logger                logging.LeveledLogger
 	UDPConn               net.PacketConn
 	XORMappedAddrCacheTTL time.Duration
+	Net                   transport.Net
 }
 
 // NewUniversalUDPMuxDefault creates an implementation of UniversalUDPMux embedding UDPMux
@@ -63,6 +65,7 @@ func NewUniversalUDPMuxDefault(params UniversalUDPMuxParams) *UniversalUDPMuxDef
 	udpMuxParams := UDPMuxParams{
 		Logger:  params.Logger,
 		UDPConn: m.params.UDPConn,
+		Net:     m.params.Net,
 	}
 	m.UDPMuxDefault = NewUDPMuxDefault(udpMuxParams)
 
diff --git a/udp_muxed_conn.go b/udp_muxed_conn.go
index ac7b704..9079d9a 100644
--- a/udp_muxed_conn.go
+++ b/udp_muxed_conn.go
@@ -8,7 +8,7 @@ import (
 	"time"
 
 	"github.com/pion/logging"
-	"github.com/pion/transport/packetio"
+	"github.com/pion/transport/v2/packetio"
 )
 
 type udpMuxedConnParams struct {
diff --git a/util.go b/util.go
index 5abede7..a2ccb8b 100644
--- a/util.go
+++ b/util.go
@@ -8,7 +8,7 @@ import (
 
 	"github.com/pion/logging"
 	"github.com/pion/stun"
-	"github.com/pion/transport/vnet"
+	"github.com/pion/transport/v2"
 )
 
 type atomicError struct{ v atomic.Value }
@@ -144,9 +144,9 @@ func stunRequest(read func([]byte) (int, error), write func([]byte) (int, error)
 	return res, nil
 }
 
-func localInterfaces(vnet *vnet.Net, interfaceFilter func(string) bool, ipFilter func(net.IP) bool, networkTypes []NetworkType, includeLoopback bool) ([]net.IP, error) { //nolint:gocognit
+func localInterfaces(n transport.Net, interfaceFilter func(string) bool, ipFilter func(net.IP) bool, networkTypes []NetworkType, includeLoopback bool) ([]net.IP, error) { //nolint:gocognit
 	ips := []net.IP{}
-	ifaces, err := vnet.Interfaces()
+	ifaces, err := n.Interfaces()
 	if err != nil {
 		return ips, err
 	}
@@ -211,9 +211,9 @@ func localInterfaces(vnet *vnet.Net, interfaceFilter func(string) bool, ipFilter
 	return ips, nil
 }
 
-func listenUDPInPortRange(vnet *vnet.Net, log logging.LeveledLogger, portMax, portMin int, network string, lAddr *net.UDPAddr) (vnet.UDPPacketConn, error) {
+func listenUDPInPortRange(n transport.Net, log logging.LeveledLogger, portMax, portMin int, network string, lAddr *net.UDPAddr) (transport.UDPConn, error) {
 	if (lAddr.Port != 0) || ((portMin == 0) && (portMax == 0)) {
-		return vnet.ListenUDP(network, lAddr)
+		return n.ListenUDP(network, lAddr)
 	}
 	var i, j int
 	i = portMin
@@ -232,7 +232,7 @@ func listenUDPInPortRange(vnet *vnet.Net, log logging.LeveledLogger, portMax, po
 	portCurrent := portStart
 	for {
 		lAddr = &net.UDPAddr{IP: lAddr.IP, Port: portCurrent}
-		c, e := vnet.ListenUDP(network, lAddr)
+		c, e := n.ListenUDP(network, lAddr)
 		if e == nil {
 			return c, e //nolint:nilerr
 		}


Test patch:
diff --git a/agent_test.go b/agent_test.go
index 191c2f9..042ee3c 100644
--- a/agent_test.go
+++ b/agent_test.go
@@ -15,8 +15,8 @@ import (
 
 	"github.com/pion/logging"
 	"github.com/pion/stun"
-	"github.com/pion/transport/test"
-	"github.com/pion/transport/vnet"
+	"github.com/pion/transport/v2/test"
+	"github.com/pion/transport/v2/vnet"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
@@ -349,14 +349,16 @@ func TestConnectivityOnStartup(t *testing.T) {
 	})
 	assert.NoError(t, err)
 
-	net0 := vnet.NewNet(&vnet.NetConfig{
+	net0, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{"192.168.0.1"},
 	})
+	assert.NoError(t, err)
 	assert.NoError(t, wan.AddNet(net0))
 
-	net1 := vnet.NewNet(&vnet.NetConfig{
+	net1, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{"192.168.0.2"},
 	})
+	assert.NoError(t, err)
 	assert.NoError(t, wan.AddNet(net1))
 
 	assert.NoError(t, wan.Start())
@@ -366,10 +368,9 @@ func TestConnectivityOnStartup(t *testing.T) {
 
 	KeepaliveInterval := time.Hour
 	cfg0 := &AgentConfig{
-		NetworkTypes:     supportedNetworkTypes(),
-		MulticastDNSMode: MulticastDNSModeDisabled,
-		Net:              net0,
-
+		NetworkTypes:      supportedNetworkTypes(),
+		MulticastDNSMode:  MulticastDNSModeDisabled,
+		Net:               net0,
 		KeepaliveInterval: &KeepaliveInterval,
 		CheckInterval:     &KeepaliveInterval,
 	}
@@ -1707,9 +1708,10 @@ func TestGetSelectedCandidatePair(t *testing.T) {
 	})
 	assert.NoError(t, err)
 
-	net := vnet.NewNet(&vnet.NetConfig{
+	net, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{"192.168.0.1"},
 	})
+	assert.NoError(t, err)
 	assert.NoError(t, wan.AddNet(net))
 
 	assert.NoError(t, wan.Start())
@@ -1765,14 +1767,16 @@ func TestAcceptAggressiveNomination(t *testing.T) {
 	})
 	assert.NoError(t, err)
 
-	net0 := vnet.NewNet(&vnet.NetConfig{
+	net0, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{"192.168.0.1"},
 	})
+	assert.NoError(t, err)
 	assert.NoError(t, wan.AddNet(net0))
 
-	net1 := vnet.NewNet(&vnet.NetConfig{
+	net1, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{"192.168.0.2", "192.168.0.3", "192.168.0.4"},
 	})
+	assert.NoError(t, err)
 	assert.NoError(t, wan.AddNet(net1))
 
 	assert.NoError(t, wan.Start())
diff --git a/agent_udpmux_test.go b/agent_udpmux_test.go
index a1841ca..089cfe2 100644
--- a/agent_udpmux_test.go
+++ b/agent_udpmux_test.go
@@ -9,7 +9,7 @@ import (
 	"time"
 
 	"github.com/pion/logging"
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 	"github.com/stretchr/testify/require"
 )
 
diff --git a/candidate_relay_test.go b/candidate_relay_test.go
index d45b32b..e07f246 100644
--- a/candidate_relay_test.go
+++ b/candidate_relay_test.go
@@ -9,7 +9,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 	"github.com/pion/turn/v2"
 	"github.com/stretchr/testify/assert"
 )
diff --git a/candidate_server_reflexive_test.go b/candidate_server_reflexive_test.go
index 41306fa..3742bea 100644
--- a/candidate_server_reflexive_test.go
+++ b/candidate_server_reflexive_test.go
@@ -9,7 +9,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 	"github.com/pion/turn/v2"
 	"github.com/stretchr/testify/assert"
 )
diff --git a/connectivity_vnet_test.go b/connectivity_vnet_test.go
index 82272d3..0e6b206 100644
--- a/connectivity_vnet_test.go
+++ b/connectivity_vnet_test.go
@@ -13,8 +13,8 @@ import (
 
 	"github.com/pion/logging"
 	"github.com/pion/stun"
-	"github.com/pion/transport/test"
-	"github.com/pion/transport/vnet"
+	"github.com/pion/transport/v2/test"
+	"github.com/pion/transport/v2/vnet"
 	"github.com/pion/turn/v2"
 	"github.com/stretchr/testify/assert"
 )
@@ -54,9 +54,12 @@ func buildVNet(natType0, natType1 *vnet.NATType) (*virtualNet, error) {
 		return nil, err
 	}
 
-	wanNet := vnet.NewNet(&vnet.NetConfig{
+	wanNet, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIP: vnetSTUNServerIP, // will be assigned to eth0
 	})
+	if err != nil {
+		return nil, err
+	}
 
 	err = wan.AddNet(wanNet)
 	if err != nil {
@@ -83,9 +86,13 @@ func buildVNet(natType0, natType1 *vnet.NATType) (*virtualNet, error) {
 		return nil, err
 	}
 
-	net0 := vnet.NewNet(&vnet.NetConfig{
+	net0, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{vnetLocalIPA},
 	})
+	if err != nil {
+		return nil, err
+	}
+
 	err = lan0.AddNet(net0)
 	if err != nil {
 		return nil, err
@@ -116,9 +123,13 @@ func buildVNet(natType0, natType1 *vnet.NATType) (*virtualNet, error) {
 		return nil, err
 	}
 
-	net1 := vnet.NewNet(&vnet.NetConfig{
+	net1, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{vnetLocalIPB},
 	})
+	if err != nil {
+		return nil, err
+	}
+
 	err = lan1.AddNet(net1)
 	if err != nil {
 		return nil, err
@@ -475,14 +486,16 @@ func TestDisconnectedToConnected(t *testing.T) {
 		return atomic.LoadUint64(&dropAllData) != 1
 	})
 
-	net0 := vnet.NewNet(&vnet.NetConfig{
+	net0, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{"192.168.0.1"},
 	})
+	assert.NoError(t, err)
 	assert.NoError(t, wan.AddNet(net0))
 
-	net1 := vnet.NewNet(&vnet.NetConfig{
+	net1, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{"192.168.0.2"},
 	})
+	assert.NoError(t, err)
 	assert.NoError(t, wan.AddNet(net1))
 
 	assert.NoError(t, wan.Start())
@@ -581,14 +594,16 @@ func TestWriteUseValidPair(t *testing.T) {
 		return true
 	})
 
-	net0 := vnet.NewNet(&vnet.NetConfig{
+	net0, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{"192.168.0.1"},
 	})
+	assert.NoError(t, err)
 	assert.NoError(t, wan.AddNet(net0))
 
-	net1 := vnet.NewNet(&vnet.NetConfig{
+	net1, err := vnet.NewNet(&vnet.NetConfig{
 		StaticIPs: []string{"192.168.0.2"},
 	})
+	assert.NoError(t, err)
 	assert.NoError(t, wan.AddNet(net1))
 
 	assert.NoError(t, wan.Start())
diff --git a/gather_test.go b/gather_test.go
index 55fdbc2..01876c9 100644
--- a/gather_test.go
+++ b/gather_test.go
@@ -21,7 +21,7 @@ import (
 	"github.com/pion/dtls/v2/pkg/crypto/selfsign"
 	"github.com/pion/logging"
 	"github.com/pion/stun"
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 	"github.com/pion/turn/v2"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
diff --git a/gather_vnet_test.go b/gather_vnet_test.go
index 49ec850..0889eb7 100644
--- a/gather_vnet_test.go
+++ b/gather_vnet_test.go
@@ -11,8 +11,8 @@ import (
 	"testing"
 
 	"github.com/pion/logging"
-	"github.com/pion/transport/test"
-	"github.com/pion/transport/vnet"
+	"github.com/pion/transport/v2/test"
+	"github.com/pion/transport/v2/vnet"
 	"github.com/stretchr/testify/assert"
 )
 
@@ -24,8 +24,11 @@ func TestVNetGather(t *testing.T) {
 	// log := loggerFactory.NewLogger("test")
 
 	t.Run("No local IP address", func(t *testing.T) {
+		n, err := vnet.NewNet(&vnet.NetConfig{})
+		assert.NoError(t, err)
+
 		a, err := NewAgent(&AgentConfig{
-			Net: vnet.NewNet(&vnet.NetConfig{}),
+			Net: n,
 		})
 		assert.NoError(t, err)
 
@@ -54,8 +57,8 @@ func TestVNetGather(t *testing.T) {
 			t.Fatalf("Failed to create a router: %s", err)
 		}
 
-		nw := vnet.NewNet(&vnet.NetConfig{})
-		if nw == nil {
+		nw, err := vnet.NewNet(&vnet.NetConfig{})
+		if err != nil {
 			t.Fatalf("Failed to create a Net: %s", err)
 		}
 
@@ -97,8 +100,8 @@ func TestVNetGather(t *testing.T) {
 			t.Fatalf("Failed to create a router: %s", err)
 		}
 
-		nw := vnet.NewNet(&vnet.NetConfig{})
-		if nw == nil {
+		nw, err := vnet.NewNet(&vnet.NetConfig{})
+		if err != nil {
 			t.Fatalf("Failed to create a Net: %s", err)
 		}
 
@@ -190,10 +193,10 @@ func TestVNetGatherWithNAT1To1(t *testing.T) {
 		err = wan.AddRouter(lan)
 		assert.NoError(t, err, "should succeed")
 
-		nw := vnet.NewNet(&vnet.NetConfig{
+		nw, err := vnet.NewNet(&vnet.NetConfig{
 			StaticIPs: []string{localIP0, localIP1},
 		})
-		if nw == nil {
+		if err != nil {
 			t.Fatalf("Failed to create a Net: %s", err)
 		}
 
@@ -285,12 +288,12 @@ func TestVNetGatherWithNAT1To1(t *testing.T) {
 		err = wan.AddRouter(lan)
 		assert.NoError(t, err, "should succeed")
 
-		nw := vnet.NewNet(&vnet.NetConfig{
+		nw, err := vnet.NewNet(&vnet.NetConfig{
 			StaticIPs: []string{
 				"10.0.0.1",
 			},
 		})
-		if nw == nil {
+		if err != nil {
 			t.Fatalf("Failed to create a Net: %s", err)
 		}
 
@@ -366,8 +369,8 @@ func TestVNetGatherWithInterfaceFilter(t *testing.T) {
 		t.Fatalf("Failed to create a router: %s", err)
 	}
 
-	nw := vnet.NewNet(&vnet.NetConfig{})
-	if nw == nil {
+	nw, err := vnet.NewNet(&vnet.NetConfig{})
+	if err != nil {
 		t.Fatalf("Failed to create a Net: %s", err)
 	}
 
diff --git a/mdns_test.go b/mdns_test.go
index d56dcd7..4ee5b1b 100644
--- a/mdns_test.go
+++ b/mdns_test.go
@@ -9,7 +9,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 	"github.com/stretchr/testify/assert"
 )
 
diff --git a/tcp_mux_multi_test.go b/tcp_mux_multi_test.go
index 9a770e2..f5ac7a9 100644
--- a/tcp_mux_multi_test.go
+++ b/tcp_mux_multi_test.go
@@ -10,7 +10,7 @@ import (
 
 	"github.com/pion/logging"
 	"github.com/pion/stun"
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
diff --git a/tcp_mux_test.go b/tcp_mux_test.go
index ec97306..9c99d54 100644
--- a/tcp_mux_test.go
+++ b/tcp_mux_test.go
@@ -7,7 +7,7 @@ import (
 
 	"github.com/pion/logging"
 	"github.com/pion/stun"
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
diff --git a/transport_test.go b/transport_test.go
index 199f88f..5584af6 100644
--- a/transport_test.go
+++ b/transport_test.go
@@ -10,7 +10,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 )
 
 func TestStressDuplex(t *testing.T) {
diff --git a/transport_vnet_test.go b/transport_vnet_test.go
index b2345c4..e47c3e7 100644
--- a/transport_vnet_test.go
+++ b/transport_vnet_test.go
@@ -9,8 +9,8 @@ import (
 	"testing"
 	"time"
 
-	"github.com/pion/transport/test"
-	"github.com/pion/transport/vnet"
+	"github.com/pion/transport/v2/test"
+	"github.com/pion/transport/v2/vnet"
 	"github.com/stretchr/testify/assert"
 )
 
diff --git a/udp_mux_multi_test.go b/udp_mux_multi_test.go
index 631da49..d764450 100644
--- a/udp_mux_multi_test.go
+++ b/udp_mux_multi_test.go
@@ -10,7 +10,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 	"github.com/stretchr/testify/require"
 )
 
diff --git a/udp_mux_test.go b/udp_mux_test.go
index fb6adcf..63da936 100644
--- a/udp_mux_test.go
+++ b/udp_mux_test.go
@@ -14,7 +14,7 @@ import (
 	"time"
 
 	"github.com/pion/stun"
-	"github.com/pion/transport/test"
+	"github.com/pion/transport/v2/test"
 	"github.com/stretchr/testify/require"
 )