sys_bsd.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build darwin dragonfly freebsd netbsd openbsd
  5. package ipv4
  6. import "syscall"
  7. const (
  8. // See /usr/include/netinet/in.h.
  9. sysSockoptHeaderPrepend = syscall.IP_HDRINCL
  10. sysSockoptTOS = syscall.IP_TOS
  11. sysSockoptTTL = syscall.IP_TTL
  12. sysSockoptMulticastTTL = syscall.IP_MULTICAST_TTL
  13. sysSockoptMulticastInterface = syscall.IP_MULTICAST_IF
  14. sysSockoptMulticastLoopback = syscall.IP_MULTICAST_LOOP
  15. sysSockoptJoinGroup = syscall.IP_ADD_MEMBERSHIP
  16. sysSockoptLeaveGroup = syscall.IP_DROP_MEMBERSHIP
  17. )
  18. const (
  19. // See /usr/include/netinet/in.h.
  20. sysSockoptReceiveTTL = syscall.IP_RECVTTL
  21. sysSockoptReceiveDst = syscall.IP_RECVDSTADDR
  22. sysSockoptReceiveInterface = syscall.IP_RECVIF
  23. sysSockoptPacketInfo = 0x1a // only darwin supports this option for now
  24. )
  25. const sysSizeofPacketInfo = 0xc
  26. type sysPacketInfo struct {
  27. IfIndex int32
  28. RoutedIP [4]byte
  29. IP [4]byte
  30. }