device.go 900 B

123456789101112131415161718192021222324252627
  1. package overlay
  2. import (
  3. "io"
  4. "net/netip"
  5. "github.com/slackhq/nebula/routing"
  6. )
  7. type Device interface {
  8. io.ReadWriteCloser
  9. Activate() error
  10. Networks() []netip.Prefix
  11. Name() string
  12. RoutesFor(netip.Addr) routing.Gateways
  13. SupportsMultiqueue() bool
  14. NewMultiQueueReader() (io.ReadWriteCloser, error)
  15. // SupportsPerPeerMTU reports whether SetPeerMTU is implemented for real on
  16. // this platform. PMTUD requires this; the manager will refuse to enable when
  17. // false even if the operator set tun.max_mtu, because a discovered MTU we
  18. // can't actually install does the operator no good.
  19. SupportsPerPeerMTU() bool
  20. // SetPeerMTU installs a per-peer MTU on the routing table so the kernel will
  21. // surface PTB / EMSGSIZE for inside packets to that peer that would exceed mtu.
  22. // Pass mtu=0 to remove the override and let the device default apply.
  23. SetPeerMTU(addr netip.Addr, mtu int) error
  24. }