2020-02-05 22:16:58 +00:00
|
|
|
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package wgengine
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/tailscale/wireguard-go/device"
|
|
|
|
"github.com/tailscale/wireguard-go/tun"
|
2020-02-15 03:23:16 +00:00
|
|
|
"tailscale.com/types/logger"
|
2020-02-05 22:16:58 +00:00
|
|
|
)
|
|
|
|
|
2020-02-14 23:03:25 +00:00
|
|
|
// NewFakeRouter returns a new fake Router implementation whose
|
|
|
|
// implementation does nothing and always returns nil errors.
|
2020-02-17 17:00:38 +00:00
|
|
|
func NewFakeRouter(logf logger.Logf, _ *device.Device, _ tun.Device) (Router, error) {
|
2020-02-14 23:03:25 +00:00
|
|
|
return fakeRouter{logf: logf}, nil
|
2020-02-05 22:16:58 +00:00
|
|
|
}
|
|
|
|
|
2020-02-14 23:03:25 +00:00
|
|
|
type fakeRouter struct {
|
|
|
|
logf logger.Logf
|
2020-02-05 22:16:58 +00:00
|
|
|
}
|
|
|
|
|
2020-02-14 23:03:25 +00:00
|
|
|
func (r fakeRouter) Up() error {
|
2020-04-11 15:35:34 +00:00
|
|
|
r.logf("Warning: fakeRouter.Up: not implemented.")
|
2020-02-05 22:16:58 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-14 23:03:25 +00:00
|
|
|
func (r fakeRouter) SetRoutes(rs RouteSettings) error {
|
2020-04-11 15:35:34 +00:00
|
|
|
r.logf("Warning: fakeRouter.SetRoutes: not implemented.")
|
2020-02-05 22:16:58 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-14 23:03:25 +00:00
|
|
|
func (r fakeRouter) Close() error {
|
2020-04-11 15:35:34 +00:00
|
|
|
r.logf("Warning: fakeRouter.Close: not implemented.")
|
2020-02-11 23:21:24 +00:00
|
|
|
return nil
|
2020-02-05 22:16:58 +00:00
|
|
|
}
|