chore: reduce udp buffer sizes to 4k & pipe buffer size to 32k

This commit is contained in:
Toby 2022-11-02 22:47:38 -07:00
parent 0119024392
commit a5985c5b6f
10 changed files with 10 additions and 10 deletions

View File

@ -17,7 +17,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
const udpBufferSize = 65535
const udpBufferSize = 4096
type serverClient struct {
CC quic.Connection

View File

@ -10,7 +10,7 @@ import (
"github.com/HyNetwork/hysteria/pkg/core"
)
const udpBufferSize = 65535
const udpBufferSize = 4096
var ErrTimeout = errors.New("inactivity timeout")

View File

@ -19,7 +19,7 @@ import (
"github.com/txthinking/socks5"
)
const udpBufferSize = 65535
const udpBufferSize = 4096
var (
ErrUnsupportedCmd = errors.New("unsupported command")

View File

@ -8,7 +8,7 @@ import (
"github.com/LiamHaworth/go-tproxy"
)
const udpBufferSize = 65535
const udpBufferSize = 4096
type UDPTProxy struct {
HyClient *core.Client

View File

@ -9,7 +9,7 @@ import (
"github.com/HyNetwork/hysteria/pkg/transport/pktconns/obfs"
)
const udpBufferSize = 65535
const udpBufferSize = 4096
type ObfsFakeTCPPacketConn struct {
orig *TCPConn

View File

@ -10,7 +10,7 @@ import (
"github.com/HyNetwork/hysteria/pkg/transport/pktconns/obfs"
)
const udpBufferSize = 65535
const udpBufferSize = 4096
type ObfsUDPPacketConn struct {
orig *net.UDPConn

View File

@ -8,7 +8,7 @@ import (
const (
packetQueueSize = 1024
udpBufferSize = 2048
udpBufferSize = 4096
)
// parseAddr parses the listen address and returns the host and ports.

View File

@ -12,7 +12,7 @@ import (
"github.com/HyNetwork/hysteria/pkg/transport/pktconns/obfs"
)
const udpBufferSize = 65535
const udpBufferSize = 4096
// ObfsWeChatUDPPacketConn is still a UDP packet conn, but it adds WeChat video call header to each packet.
// Obfs in this case can be nil

View File

@ -13,7 +13,7 @@ import (
"github.com/xjasonlyu/tun2socks/v2/core/adapter"
)
const udpBufferSize = 65535
const udpBufferSize = 4096
func (s *Server) HandleUDP(conn adapter.UDPConn) {
go s.handleUDPConn(conn)

View File

@ -6,7 +6,7 @@ import (
"time"
)
const PipeBufferSize = 65535
const PipeBufferSize = 32 * 1024
func Pipe(src, dst io.ReadWriter, count func(int)) error {
buf := make([]byte, PipeBufferSize)