mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
apply sockopt rename
This commit is contained in:
parent
190a8e7ed7
commit
4357719480
@ -42,14 +42,14 @@ 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 {
|
||||
if config.TxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_SNDBUF, int(config.TxBufSize)); err != nil {
|
||||
return newError("failed to set SO_SNDBUF").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketRxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF, int(config.SocketRxBufSize)); err != nil {
|
||||
if config.RxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF, int(config.RxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF").Base(err)
|
||||
}
|
||||
}
|
||||
@ -86,14 +86,14 @@ 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 {
|
||||
if config.TxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_SNDBUF, int(config.TxBufSize)); 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 {
|
||||
if config.RxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF, int(config.RxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF/SO_RCVBUFFORCE").Base(err)
|
||||
}
|
||||
}
|
||||
|
@ -172,14 +172,14 @@ 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 {
|
||||
if config.TxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_SNDBUF, int(config.TxBufSize)); err != nil {
|
||||
return newError("failed to set SO_SNDBUF").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketRxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF, int(config.SocketRxBufSize)); err != nil {
|
||||
if config.RxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF, int(config.RxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF").Base(err)
|
||||
}
|
||||
}
|
||||
@ -229,14 +229,14 @@ 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 {
|
||||
if config.TxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_SNDBUF, int(config.TxBufSize)); err != nil {
|
||||
return newError("failed to set SO_SNDBUF").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketRxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF, int(config.SocketRxBufSize)); err != nil {
|
||||
if config.RxBufSize != 0 {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF, int(config.RxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF").Base(err)
|
||||
}
|
||||
}
|
||||
|
@ -88,22 +88,22 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketTxBufSize != 0 {
|
||||
if config.TxBufSize != 0 {
|
||||
syscallTarget := unix.SO_SNDBUF
|
||||
if config.SocketForceBufSize {
|
||||
if config.ForceBufSize {
|
||||
syscallTarget = unix.SO_SNDBUFFORCE
|
||||
}
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, syscallTarget, int(config.SocketTxBufSize)); err != nil {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, syscallTarget, int(config.TxBufSize)); err != nil {
|
||||
return newError("failed to set SO_SNDBUF/SO_SNDBUFFORCE").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketRxBufSize != 0 {
|
||||
if config.RxBufSize != 0 {
|
||||
syscallTarget := unix.SO_RCVBUF
|
||||
if config.SocketForceBufSize {
|
||||
if config.ForceBufSize {
|
||||
syscallTarget = unix.SO_RCVBUFFORCE
|
||||
}
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, syscallTarget, int(config.SocketRxBufSize)); err != nil {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, syscallTarget, int(config.RxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF/SO_RCVBUFFORCE").Base(err)
|
||||
}
|
||||
}
|
||||
@ -166,22 +166,22 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketTxBufSize != 0 {
|
||||
if config.TxBufSize != 0 {
|
||||
syscallTarget := unix.SO_SNDBUF
|
||||
if config.SocketForceBufSize {
|
||||
if config.ForceBufSize {
|
||||
syscallTarget = unix.SO_SNDBUFFORCE
|
||||
}
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, syscallTarget, int(config.SocketTxBufSize)); err != nil {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, syscallTarget, int(config.TxBufSize)); err != nil {
|
||||
return newError("failed to set SO_SNDBUF/SO_SNDBUFFORCE").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
if config.SocketRxBufSize != 0 {
|
||||
if config.RxBufSize != 0 {
|
||||
syscallTarget := unix.SO_RCVBUF
|
||||
if config.SocketForceBufSize {
|
||||
if config.ForceBufSize {
|
||||
syscallTarget = unix.SO_RCVBUFFORCE
|
||||
}
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, syscallTarget, int(config.SocketRxBufSize)); err != nil {
|
||||
if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, syscallTarget, int(config.RxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF/SO_RCVBUFFORCE").Base(err)
|
||||
}
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ 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 {
|
||||
if config.TxBufSize != 0 {
|
||||
if err := windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_SNDBUF, int(config.TxBufSize)); 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 {
|
||||
if config.RxBufSize != 0 {
|
||||
if err := windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_RCVBUF, int(config.TxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF").Base(err)
|
||||
}
|
||||
}
|
||||
@ -62,14 +62,14 @@ 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 {
|
||||
if config.TxBufSize != 0 {
|
||||
if err := windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_SNDBUF, int(config.TxBufSize)); 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 {
|
||||
if config.RxBufSize != 0 {
|
||||
if err := windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_RCVBUF, int(config.TxBufSize)); err != nil {
|
||||
return newError("failed to set SO_RCVBUF").Base(err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user