mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
add socksopt rxtxbuf for freebsd
This commit is contained in:
parent
7dc8559f1c
commit
1a35c1dc69
@ -170,6 +170,19 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketTxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_SNDBUF, int(config.SocketTxBufSize)); err != nil {
|
||||
return newError("failed to set SO_SNDBUF/SO_SNDBUFFORCE").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketRxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF, int(config.SocketRxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF/SO_RCVBUFFORCE").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -215,6 +228,18 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketTxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_SNDBUF, int(config.SocketTxBufSize)); err != nil {
|
||||
return newError("failed to set SO_SNDBUF/SO_SNDBUFFORCE").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketRxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF, int(config.SocketRxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF/SO_RCVBUFFORCE").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user