golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/ipv6/sys_asmreq.go (about) 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 5 //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows 6 7 package ipv6 8 9 import ( 10 "net" 11 "unsafe" 12 13 "golang.org/x/net/internal/socket" 14 ) 15 16 func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 17 var mreq ipv6Mreq 18 copy(mreq.Multiaddr[:], grp) 19 if ifi != nil { 20 mreq.setIfindex(ifi.Index) 21 } 22 b := (*[sizeofIPv6Mreq]byte)(unsafe.Pointer(&mreq))[:sizeofIPv6Mreq] 23 return so.Set(c, b) 24 }