2020-02-06 06:16:58 +08: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 11:23:16 +08:00
|
|
|
"tailscale.com/types/logger"
|
2020-02-06 06:16:58 +08:00
|
|
|
)
|
|
|
|
|
2020-02-15 07:03:25 +08:00
|
|
|
// NewFakeRouter returns a new fake Router implementation whose
|
|
|
|
// implementation does nothing and always returns nil errors.
|
2020-02-18 01:00:38 +08:00
|
|
|
func NewFakeRouter(logf logger.Logf, _ *device.Device, _ tun.Device) (Router, error) {
|
2020-02-15 07:03:25 +08:00
|
|
|
return fakeRouter{logf: logf}, nil
|
2020-02-06 06:16:58 +08:00
|
|
|
}
|
|
|
|
|
2020-02-15 07:03:25 +08:00
|
|
|
type fakeRouter struct {
|
|
|
|
logf logger.Logf
|
2020-02-06 06:16:58 +08:00
|
|
|
}
|
|
|
|
|
2020-02-15 07:03:25 +08:00
|
|
|
func (r fakeRouter) Up() error {
|
2020-02-06 06:16:58 +08:00
|
|
|
r.logf("Warning: fakeRouter.Up: not implemented.\n")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-15 07:03:25 +08:00
|
|
|
func (r fakeRouter) SetRoutes(rs RouteSettings) error {
|
2020-02-06 06:16:58 +08:00
|
|
|
r.logf("Warning: fakeRouter.SetRoutes: not implemented.\n")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-15 07:03:25 +08:00
|
|
|
func (r fakeRouter) Close() error {
|
2020-02-06 06:16:58 +08:00
|
|
|
r.logf("Warning: fakeRouter.Close: not implemented.\n")
|
2020-02-12 07:21:24 +08:00
|
|
|
return nil
|
2020-02-06 06:16:58 +08:00
|
|
|
}
|