sys_windows.go 710 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 = 0x4
  13. sysSockoptMulticastHopLimit = 0xa
  14. sysSockoptMulticastInterface = 0x9
  15. sysSockoptMulticastLoopback = 0xb
  16. sysSockoptJoinGroup = 0xc
  17. sysSockoptLeaveGroup = 0xd
  18. )
  19. // RFC 3542 options
  20. const (
  21. // See ws2tcpip.h.
  22. sysSockoptPacketInfo = 0x13
  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. }