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
@@ -1,9 +1,12 @@
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{},
}
@@ -13,7 +16,7 @@ func NewWGIFace(ifaceName string, address string, mtu int, tunAdapter TunAdapter
return wgIface, err
}
tun := newTunDevice(wgAddress, mtu, tunAdapter)
tun := newTunDevice(wgAddress, mtu, tunAdapter, transportNet)
wgIface.tun = tun
wgIface.configurer = newWGConfigurer(tun)