gitee.com/aurawing/surguard-go@v0.3.1-0.20240409071558-96509a61ecf3/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  }