tun.go 602 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package test
  2. import (
  3. "errors"
  4. "io"
  5. "net/netip"
  6. )
  7. type NoopTun struct{}
  8. func (NoopTun) RouteFor(addr netip.Addr) netip.Addr {
  9. return netip.Addr{}
  10. }
  11. func (NoopTun) Activate() error {
  12. return nil
  13. }
  14. func (NoopTun) Networks() []netip.Prefix {
  15. return []netip.Prefix{}
  16. }
  17. func (NoopTun) Name() string {
  18. return "noop"
  19. }
  20. func (NoopTun) Read([]byte) (int, error) {
  21. return 0, nil
  22. }
  23. func (NoopTun) Write([]byte) (int, error) {
  24. return 0, nil
  25. }
  26. func (NoopTun) NewMultiQueueReader() (io.ReadWriteCloser, error) {
  27. return nil, errors.New("unsupported")
  28. }
  29. func (NoopTun) Close() error {
  30. return nil
  31. }