mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-07-26 11:44:22 -04:00
add socksopt rxtxbuf for windows
This commit is contained in:
parent
eb0b52fdfa
commit
7dc8559f1c
@ -1,6 +1,9 @@
|
|||||||
package internet
|
package internet
|
||||||
|
|
||||||
import "syscall"
|
import (
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
TCP_FASTOPEN = 15 // nolint: revive,stylecheck
|
TCP_FASTOPEN = 15 // nolint: revive,stylecheck
|
||||||
@ -32,6 +35,18 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.SocketTxBufSize != 0 {
|
||||||
|
if err := windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_SNDBUF, int(config.SocketTxBufSize)); err != nil {
|
||||||
|
return newError("failed to set SO_SNDBUF").Base(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.SocketRxBufSize != 0 {
|
||||||
|
if err := windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_RCVBUF, int(config.SocketTxBufSize)); err != nil {
|
||||||
|
return newError("failed to set SO_RCVBUF").Base(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +62,18 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.SocketTxBufSize != 0 {
|
||||||
|
if err := windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_SNDBUF, int(config.SocketTxBufSize)); err != nil {
|
||||||
|
return newError("failed to set SO_SNDBUF").Base(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.SocketRxBufSize != 0 {
|
||||||
|
if err := windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_RCVBUF, int(config.SocketTxBufSize)); err != nil {
|
||||||
|
return newError("failed to set SO_RCVBUF").Base(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user