mirror of
https://github.com/pion/webrtc.git
synced 2025-10-05 15:16:52 +08:00
Use new pion/transport Net interface
This change adapts pion/ice to use a new interface for most network related operations. The interface was formerly a simple struct vnet.Net which was originally intended to facilicate testing. By replacing it with an interface we have greater flexibility and allow users to hook into the networking stack by providing their own implementation of the interface.
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/pion/logging"
|
||||
"github.com/pion/transport/vnet"
|
||||
"github.com/pion/transport/v2/vnet"
|
||||
"github.com/pion/webrtc/v3"
|
||||
)
|
||||
|
||||
@@ -83,9 +83,11 @@ func main() {
|
||||
}()
|
||||
|
||||
// Create a network interface for offerer
|
||||
offerVNet := vnet.NewNet(&vnet.NetConfig{
|
||||
offerVNet, err := vnet.NewNet(&vnet.NetConfig{
|
||||
StaticIPs: []string{"1.2.3.4"},
|
||||
})
|
||||
panicIfError(err)
|
||||
|
||||
// Add the network interface to the router
|
||||
panicIfError(wan.AddNet(offerVNet))
|
||||
|
||||
@@ -94,9 +96,11 @@ func main() {
|
||||
offerAPI := webrtc.NewAPI(webrtc.WithSettingEngine(offerSettingEngine))
|
||||
|
||||
// Create a network interface for answerer
|
||||
answerVNet := vnet.NewNet(&vnet.NetConfig{
|
||||
answerVNet, err := vnet.NewNet(&vnet.NetConfig{
|
||||
StaticIPs: []string{"1.2.3.5"},
|
||||
})
|
||||
panicIfError(err)
|
||||
|
||||
// Add the network interface to the router
|
||||
panicIfError(wan.AddNet(answerVNet))
|
||||
|
||||
|
Reference in New Issue
Block a user