tun.go 664 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package test
  2. import (
  3. "errors"
  4. "io"
  5. "net"
  6. "github.com/slackhq/nebula/iputil"
  7. )
  8. type NoopTun struct{}
  9. func (NoopTun) RouteFor(iputil.VpnIp) iputil.VpnIp {
  10. return 0
  11. }
  12. func (NoopTun) Activate() error {
  13. return nil
  14. }
  15. func (NoopTun) CidrNet() *net.IPNet {
  16. return nil
  17. }
  18. func (NoopTun) DeviceName() 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) WriteRaw([]byte) error {
  28. return nil
  29. }
  30. func (NoopTun) NewMultiQueueReader() (io.ReadWriteCloser, error) {
  31. return nil, errors.New("unsupported")
  32. }
  33. func (NoopTun) Close() error {
  34. return nil
  35. }