move implementation to internal/ directory (#828)
This commit is contained in:
committed by
GitHub
parent
b9b9ad10cf
commit
908807bd59
@@ -0,0 +1,20 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package tcpsock
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func freeBind(network, address string, c syscall.RawConn) error {
|
||||
var err, sockerr error
|
||||
err = c.Control(func(fd uintptr) {
|
||||
// apparently, this works for both IPv4 and IPv6
|
||||
sockerr = syscall.SetsockoptInt(int(fd), syscall.SOL_IP, syscall.IP_FREEBIND, 1)
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return sockerr
|
||||
}
|
||||
Reference in New Issue
Block a user