net/tstun: rename NewFakeTUN to NewFake.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
588b70f468
commit
82ab7972f4
|
@ -333,7 +333,7 @@ func tryEngine(logf logger.Logf, linkMon *monitor.Mon, name string) (e wgengine.
|
||||||
}
|
}
|
||||||
isUserspace = name == "userspace-networking"
|
isUserspace = name == "userspace-networking"
|
||||||
if isUserspace {
|
if isUserspace {
|
||||||
conf.TUN = tstun.NewFakeTUN()
|
conf.TUN = tstun.NewFake()
|
||||||
conf.Router = router.NewFake(logf)
|
conf.Router = router.NewFake(logf)
|
||||||
} else {
|
} else {
|
||||||
dev, err := tstun.New(logf, name)
|
dev, err := tstun.New(logf, name)
|
||||||
|
|
|
@ -16,10 +16,8 @@ type fakeTUN struct {
|
||||||
closechan chan struct{}
|
closechan chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFakeTUN returns a fake TUN device that does not depend on the
|
// NewFake returns a tun.Device that does nothing.
|
||||||
// operating system or any special permissions.
|
func NewFake() tun.Device {
|
||||||
// It primarily exists for testing.
|
|
||||||
func NewFakeTUN() tun.Device {
|
|
||||||
return &fakeTUN{
|
return &fakeTUN{
|
||||||
evchan: make(chan tun.Event),
|
evchan: make(chan tun.Event),
|
||||||
closechan: make(chan struct{}),
|
closechan: make(chan struct{}),
|
||||||
|
|
|
@ -132,7 +132,7 @@ func newChannelTUN(logf logger.Logf, secure bool) (*tuntest.ChannelTUN, *TUN) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFakeTUN(logf logger.Logf, secure bool) (*fakeTUN, *TUN) {
|
func newFakeTUN(logf logger.Logf, secure bool) (*fakeTUN, *TUN) {
|
||||||
ftun := NewFakeTUN()
|
ftun := NewFake()
|
||||||
tun := WrapTUN(logf, ftun)
|
tun := WrapTUN(logf, ftun)
|
||||||
if secure {
|
if secure {
|
||||||
setfilter(logf, tun)
|
setfilter(logf, tun)
|
||||||
|
|
|
@ -156,7 +156,7 @@ type Config struct {
|
||||||
func NewFakeUserspaceEngine(logf logger.Logf, listenPort uint16) (Engine, error) {
|
func NewFakeUserspaceEngine(logf logger.Logf, listenPort uint16) (Engine, error) {
|
||||||
logf("Starting userspace wireguard engine (with fake TUN device)")
|
logf("Starting userspace wireguard engine (with fake TUN device)")
|
||||||
return NewUserspaceEngine(logf, Config{
|
return NewUserspaceEngine(logf, Config{
|
||||||
TUN: tstun.NewFakeTUN(),
|
TUN: tstun.NewFake(),
|
||||||
Router: router.NewFake(logf),
|
Router: router.NewFake(logf),
|
||||||
ListenPort: listenPort,
|
ListenPort: listenPort,
|
||||||
Fake: true,
|
Fake: true,
|
||||||
|
|
Loading…
Reference in New Issue