mocked_discovery_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. "time"
  10. "github.com/syncthing/syncthing/lib/discover"
  11. "github.com/syncthing/syncthing/lib/protocol"
  12. )
  13. type mockedCachingMux struct{}
  14. // from suture.Service
  15. func (m *mockedCachingMux) Serve() {
  16. select {}
  17. }
  18. func (m *mockedCachingMux) Stop() {
  19. }
  20. // from events.Finder
  21. func (m *mockedCachingMux) Lookup(ctx context.Context, deviceID protocol.DeviceID) (direct []string, err error) {
  22. return nil, nil
  23. }
  24. func (m *mockedCachingMux) Error() error {
  25. return nil
  26. }
  27. func (m *mockedCachingMux) String() string {
  28. return "mockedCachingMux"
  29. }
  30. func (m *mockedCachingMux) Cache() map[protocol.DeviceID]discover.CacheEntry {
  31. return nil
  32. }
  33. // from events.CachingMux
  34. func (m *mockedCachingMux) Add(finder discover.Finder, cacheTime, negCacheTime time.Duration) {
  35. }
  36. func (m *mockedCachingMux) ChildErrors() map[string]error {
  37. return nil
  38. }