mocked_discovery_test.go 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (C) 2016 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at https://mozilla.org/MPL/2.0/.
  6. package api
  7. import (
  8. "context"
  9. "github.com/syncthing/syncthing/lib/discover"
  10. "github.com/syncthing/syncthing/lib/protocol"
  11. )
  12. type mockedCachingMux struct{}
  13. // from suture.Service
  14. func (m *mockedCachingMux) Serve() {
  15. select {}
  16. }
  17. func (m *mockedCachingMux) Stop() {
  18. }
  19. // from events.Finder
  20. func (m *mockedCachingMux) Lookup(ctx context.Context, deviceID protocol.DeviceID) (direct []string, err error) {
  21. return nil, nil
  22. }
  23. func (m *mockedCachingMux) Error() error {
  24. return nil
  25. }
  26. func (m *mockedCachingMux) String() string {
  27. return "mockedCachingMux"
  28. }
  29. func (m *mockedCachingMux) Cache() map[protocol.DeviceID]discover.CacheEntry {
  30. return nil
  31. }
  32. // from events.Manager
  33. func (m *mockedCachingMux) ChildErrors() map[string]error {
  34. return nil
  35. }