The reconcile package is used for DOM reconcilation in Isomorphic Go web applications.

sys_windows.go 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. "golang.org/x/net/internal/iana"
  9. "golang.org/x/net/internal/socket"
  10. )
  11. const (
  12. // See ws2tcpip.h.
  13. sysIPV6_UNICAST_HOPS = 0x4
  14. sysIPV6_MULTICAST_IF = 0x9
  15. sysIPV6_MULTICAST_HOPS = 0xa
  16. sysIPV6_MULTICAST_LOOP = 0xb
  17. sysIPV6_JOIN_GROUP = 0xc
  18. sysIPV6_LEAVE_GROUP = 0xd
  19. sysIPV6_PKTINFO = 0x13
  20. sizeofSockaddrInet6 = 0x1c
  21. sizeofIPv6Mreq = 0x14
  22. sizeofIPv6Mtuinfo = 0x20
  23. sizeofICMPv6Filter = 0
  24. )
  25. type sockaddrInet6 struct {
  26. Family uint16
  27. Port uint16
  28. Flowinfo uint32
  29. Addr [16]byte /* in6_addr */
  30. Scope_id uint32
  31. }
  32. type ipv6Mreq struct {
  33. Multiaddr [16]byte /* in6_addr */
  34. Interface uint32
  35. }
  36. type ipv6Mtuinfo struct {
  37. Addr sockaddrInet6
  38. Mtu uint32
  39. }
  40. type icmpv6Filter struct {
  41. // TODO(mikio): implement this
  42. }
  43. var (
  44. ctlOpts = [ctlMax]ctlOpt{}
  45. sockOpts = map[int]*sockOpt{
  46. ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}},
  47. ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}},
  48. ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}},
  49. ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}},
  50. ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_JOIN_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq},
  51. ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_LEAVE_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq},
  52. }
  53. )
  54. func (sa *sockaddrInet6) setSockaddr(ip net.IP, i int) {
  55. sa.Family = syscall.AF_INET6
  56. copy(sa.Addr[:], ip)
  57. sa.Scope_id = uint32(i)
  58. }
  59. func (mreq *ipv6Mreq) setIfindex(i int) {
  60. mreq.Interface = uint32(i)
  61. }