github.com/sagernet/wireguard-go@v0.0.0-20231215174105-89dec3b2f3e8/conn/controlfns_windows.go (about)

     1  /* SPDX-License-Identifier: MIT
     2   *
     3   * Copyright (C) 2017-2023 WireGuard LLC. All Rights Reserved.
     4   */
     5  
     6  package conn
     7  
     8  import (
     9  	"syscall"
    10  
    11  	"golang.org/x/sys/windows"
    12  )
    13  
    14  func init() {
    15  	ControlFns = append(ControlFns,
    16  		func(network, address string, c syscall.RawConn) error {
    17  			return c.Control(func(fd uintptr) {
    18  				_ = windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_RCVBUF, socketBufferSize)
    19  				_ = windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_SNDBUF, socketBufferSize)
    20  			})
    21  		},
    22  	)
    23  }