raw_others.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd
  2. package raw
  3. import (
  4. "net"
  5. "time"
  6. "golang.org/x/net/bpf"
  7. )
  8. var (
  9. // Must implement net.PacketConn at compile-time.
  10. _ net.PacketConn = &packetConn{}
  11. )
  12. // packetConn is the generic implementation of net.PacketConn for this package.
  13. type packetConn struct{}
  14. // listenPacket is not currently implemented on this platform.
  15. func listenPacket(ifi *net.Interface, proto uint16, cfg Config) (*packetConn, error) {
  16. return nil, ErrNotImplemented
  17. }
  18. // ReadFrom is not currently implemented on this platform.
  19. func (p *packetConn) ReadFrom(b []byte) (int, net.Addr, error) {
  20. return 0, nil, ErrNotImplemented
  21. }
  22. // WriteTo is not currently implemented on this platform.
  23. func (p *packetConn) WriteTo(b []byte, addr net.Addr) (int, error) {
  24. return 0, ErrNotImplemented
  25. }
  26. // Close is not currently implemented on this platform.
  27. func (p *packetConn) Close() error {
  28. return ErrNotImplemented
  29. }
  30. // LocalAddr is not currently implemented on this platform.
  31. func (p *packetConn) LocalAddr() net.Addr {
  32. return nil
  33. }
  34. // SetDeadline is not currently implemented on this platform.
  35. func (p *packetConn) SetDeadline(t time.Time) error {
  36. return ErrNotImplemented
  37. }
  38. // SetReadDeadline is not currently implemented on this platform.
  39. func (p *packetConn) SetReadDeadline(t time.Time) error {
  40. return ErrNotImplemented
  41. }
  42. // SetWriteDeadline is not currently implemented on this platform.
  43. func (p *packetConn) SetWriteDeadline(t time.Time) error {
  44. return ErrNotImplemented
  45. }
  46. // SetBPF is not currently implemented on this platform.
  47. func (p *packetConn) SetBPF(filter []bpf.RawInstruction) error {
  48. return ErrNotImplemented
  49. }
  50. // SetPromisc is not currently implemented on this platform.
  51. func (p *packetConn) SetPromiscuous(b bool) error {
  52. return ErrNotImplemented
  53. }
  54. // Stats is not currently implemented on this platform.
  55. func (p *packetConn) Stats() (*Stats, error) {
  56. return nil, ErrNotImplemented
  57. }