I'm making a script in golang and in this part of the code I get an error in this line:
syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_NODELAY, 1)
Specifically:
int(fd)
var globalTr = &http.Transport{
MaxIdleConnsPerHost: 4096,
MaxIdleConns: 4096,
MaxConnsPerHost: 4096,
TLSHandshakeTimeout: 0 * time.Second,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
DialContext: (&net.Dialer{
Control: func(network, address string, c syscall.RawConn) error {
return c.Control(func(fd uintptr) {
syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_NODELAY, 1)
})
},
}).DialContext,
}
The error is:
cannot use int(fd) (value of type int) as syscall.Handle value in argument to syscall.SetsockoptInt