tun.go 600 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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) Cidr() *net.IPNet {
  16. return nil
  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. }