noop.go 868 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package overlay
  2. import (
  3. "errors"
  4. "net/netip"
  5. "github.com/slackhq/nebula/overlay/tio"
  6. "github.com/slackhq/nebula/routing"
  7. )
  8. type NoopTun struct{}
  9. func (NoopTun) RoutesFor(addr netip.Addr) routing.Gateways {
  10. return routing.Gateways{}
  11. }
  12. func (NoopTun) Activate() error {
  13. return nil
  14. }
  15. func (NoopTun) Networks() []netip.Prefix {
  16. return []netip.Prefix{}
  17. }
  18. func (NoopTun) Name() string {
  19. return "noop"
  20. }
  21. func (NoopTun) Read() ([][]byte, error) {
  22. return nil, nil
  23. }
  24. func (NoopTun) Write([]byte) (int, error) {
  25. return 0, nil
  26. }
  27. func (NoopTun) WriteReject(p []byte) (int, error) {
  28. return 0, nil
  29. }
  30. func (NoopTun) SupportsMultiqueue() bool {
  31. return false
  32. }
  33. func (NoopTun) NewMultiQueueReader() error {
  34. return errors.New("unsupported")
  35. }
  36. func (NoopTun) Readers() []tio.Queue {
  37. return []tio.Queue{NoopTun{}}
  38. }
  39. func (NoopTun) Close() error {
  40. return nil
  41. }