sys_windows.go 859 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2013 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. package ipv6
  5. import (
  6. "net"
  7. "syscall"
  8. )
  9. // RFC 3493 options
  10. const (
  11. // See ws2tcpip.h.
  12. sysSockoptUnicastHopLimit = syscall.IPV6_UNICAST_HOPS
  13. sysSockoptMulticastHopLimit = syscall.IPV6_MULTICAST_HOPS
  14. sysSockoptMulticastInterface = syscall.IPV6_MULTICAST_IF
  15. sysSockoptMulticastLoopback = syscall.IPV6_MULTICAST_LOOP
  16. sysSockoptJoinGroup = syscall.IPV6_JOIN_GROUP
  17. sysSockoptLeaveGroup = syscall.IPV6_LEAVE_GROUP
  18. )
  19. // RFC 3542 options
  20. const (
  21. // See ws2tcpip.h.
  22. sysSockoptPacketInfo = 0x13 // IPV6_PKTINFO
  23. )
  24. func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) {
  25. sa.Family = syscall.AF_INET6
  26. copy(sa.Addr[:], ip)
  27. sa.Scope_id = uint32(ifindex)
  28. }