tun.go 653 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package test
  2. import (
  3. "errors"
  4. "io"
  5. "net/netip"
  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) (int, error) {
  22. return 0, nil
  23. }
  24. func (NoopTun) Write([]byte) (int, error) {
  25. return 0, nil
  26. }
  27. func (NoopTun) NewMultiQueueReader() (io.ReadWriteCloser, error) {
  28. return nil, errors.New("unsupported")
  29. }
  30. func (NoopTun) Close() error {
  31. return nil
  32. }