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.
|
|
|
|
|
2020-04-30 20:20:09 +00:00
|
|
|
package router
|
2020-02-05 22:16:58 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"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-04-30 20:20:09 +00:00
|
|
|
// NewFakeRouter returns a Router that does nothing when called and
|
|
|
|
// always returns nil errors.
|
2021-03-27 02:22:35 +00:00
|
|
|
func NewFake(logf logger.Logf, _ 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-12-21 18:58:06 +00:00
|
|
|
r.logf("[v1] warning: fakeRouter.Up: not implemented.")
|
2020-02-05 22:16:58 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-05-12 07:08:52 +00:00
|
|
|
func (r fakeRouter) Set(cfg *Config) error {
|
2020-12-21 18:58:06 +00:00
|
|
|
r.logf("[v1] warning: fakeRouter.Set: 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-12-21 18:58:06 +00:00
|
|
|
r.logf("[v1] warning: fakeRouter.Close: not implemented.")
|
2020-02-11 23:21:24 +00:00
|
|
|
return nil
|
2020-02-05 22:16:58 +00:00
|
|
|
}
|