Use custom stdnet

This commit is contained in:
braginini
2023-04-03 17:37:05 +02:00
parent 79a8109d5e
commit 5d191a8b9d
14 changed files with 103 additions and 40 deletions
+6 -3
View File
@@ -2,10 +2,13 @@
package iface
import "sync"
import (
"github.com/pion/transport/v2"
"sync"
)
// NewWGIFace Creates a new Wireguard interface instance
func NewWGIFace(ifaceName string, address string, mtu int, tunAdapter TunAdapter) (*WGIface, error) {
func NewWGIFace(ifaceName string, address string, mtu int, tunAdapter TunAdapter, transportNet transport.Net) (*WGIface, error) {
wgIface := &WGIface{
mu: sync.Mutex{},
}
@@ -15,7 +18,7 @@ func NewWGIFace(ifaceName string, address string, mtu int, tunAdapter TunAdapter
return wgIface, err
}
wgIface.tun = newTunDevice(ifaceName, wgAddress, mtu)
wgIface.tun = newTunDevice(ifaceName, wgAddress, mtu, transportNet)
wgIface.configurer = newWGConfigurer(ifaceName)
return wgIface, nil