//go:build windows

package wol

import (
	"net"

	"golang.org/x/sys/windows"
)

func enableBroadcast(conn *net.UDPConn, debug bool) error {
	raw, err := conn.SyscallConn()
	if err != nil {
		return err
	}
	var setErr error
	raw.Control(func(fd uintptr) {
		setErr = windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_BROADCAST, 1)
	})
	return setErr
}
