mirror of https://github.com/cbeuw/Cloak
Restore windows compatibility.
This commit is contained in:
parent
298d74b0ed
commit
0d788b728c
|
|
@ -105,15 +105,16 @@ func RouteTCP(listener net.Listener, streamTimeout time.Duration, singleplex boo
|
|||
continue
|
||||
}
|
||||
|
||||
file, err := localConn.(*net.TCPConn).File()
|
||||
syscallConn, err := localConn.(*net.TCPConn).SyscallConn()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
continue
|
||||
}
|
||||
|
||||
err = syscallConn.Control(func(fd uintptr) {
|
||||
if sendBufferSize > 0 {
|
||||
log.Debugf("Setting loopback connection tcp send buffer: %d", sendBufferSize)
|
||||
err := syscall.SetsockoptInt(common.Platformfd(file.Fd()), syscall.SOL_SOCKET, syscall.SO_SNDBUF, sendBufferSize)
|
||||
err := syscall.SetsockoptInt(common.Platformfd(fd), syscall.SOL_SOCKET, syscall.SO_SNDBUF, sendBufferSize)
|
||||
if err != nil {
|
||||
log.Errorf("setsocketopt SO_SNDBUF: %s\n", err)
|
||||
}
|
||||
|
|
@ -121,11 +122,16 @@ func RouteTCP(listener net.Listener, streamTimeout time.Duration, singleplex boo
|
|||
|
||||
if receiveBufferSize > 0 {
|
||||
log.Debugf("Setting loopback connection tcp receive buffer: %d", receiveBufferSize)
|
||||
err = syscall.SetsockoptInt(common.Platformfd(file.Fd()), syscall.SOL_SOCKET, syscall.SO_RCVBUF, receiveBufferSize)
|
||||
err = syscall.SetsockoptInt(common.Platformfd(fd), syscall.SOL_SOCKET, syscall.SO_RCVBUF, receiveBufferSize)
|
||||
if err != nil {
|
||||
log.Errorf("setsocketopt SO_RCVBUF: %s\n", err)
|
||||
}
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
continue
|
||||
}
|
||||
|
||||
if !singleplex && (sesh == nil || sesh.IsClosed()) {
|
||||
sesh = newSeshFunc()
|
||||
|
|
|
|||
Loading…
Reference in New Issue