mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-10 22:39:54 +00:00
chore: reduce udp buffer sizes to 4k & pipe buffer size to 32k
This commit is contained in:
parent
0119024392
commit
a5985c5b6f
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const udpBufferSize = 65535
|
const udpBufferSize = 4096
|
||||||
|
|
||||||
type serverClient struct {
|
type serverClient struct {
|
||||||
CC quic.Connection
|
CC quic.Connection
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/HyNetwork/hysteria/pkg/core"
|
"github.com/HyNetwork/hysteria/pkg/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
const udpBufferSize = 65535
|
const udpBufferSize = 4096
|
||||||
|
|
||||||
var ErrTimeout = errors.New("inactivity timeout")
|
var ErrTimeout = errors.New("inactivity timeout")
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/txthinking/socks5"
|
"github.com/txthinking/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
const udpBufferSize = 65535
|
const udpBufferSize = 4096
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrUnsupportedCmd = errors.New("unsupported command")
|
ErrUnsupportedCmd = errors.New("unsupported command")
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/LiamHaworth/go-tproxy"
|
"github.com/LiamHaworth/go-tproxy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const udpBufferSize = 65535
|
const udpBufferSize = 4096
|
||||||
|
|
||||||
type UDPTProxy struct {
|
type UDPTProxy struct {
|
||||||
HyClient *core.Client
|
HyClient *core.Client
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/HyNetwork/hysteria/pkg/transport/pktconns/obfs"
|
"github.com/HyNetwork/hysteria/pkg/transport/pktconns/obfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const udpBufferSize = 65535
|
const udpBufferSize = 4096
|
||||||
|
|
||||||
type ObfsFakeTCPPacketConn struct {
|
type ObfsFakeTCPPacketConn struct {
|
||||||
orig *TCPConn
|
orig *TCPConn
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/HyNetwork/hysteria/pkg/transport/pktconns/obfs"
|
"github.com/HyNetwork/hysteria/pkg/transport/pktconns/obfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const udpBufferSize = 65535
|
const udpBufferSize = 4096
|
||||||
|
|
||||||
type ObfsUDPPacketConn struct {
|
type ObfsUDPPacketConn struct {
|
||||||
orig *net.UDPConn
|
orig *net.UDPConn
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
packetQueueSize = 1024
|
packetQueueSize = 1024
|
||||||
udpBufferSize = 2048
|
udpBufferSize = 4096
|
||||||
)
|
)
|
||||||
|
|
||||||
// parseAddr parses the listen address and returns the host and ports.
|
// parseAddr parses the listen address and returns the host and ports.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/HyNetwork/hysteria/pkg/transport/pktconns/obfs"
|
"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.
|
// ObfsWeChatUDPPacketConn is still a UDP packet conn, but it adds WeChat video call header to each packet.
|
||||||
// Obfs in this case can be nil
|
// Obfs in this case can be nil
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/xjasonlyu/tun2socks/v2/core/adapter"
|
"github.com/xjasonlyu/tun2socks/v2/core/adapter"
|
||||||
)
|
)
|
||||||
|
|
||||||
const udpBufferSize = 65535
|
const udpBufferSize = 4096
|
||||||
|
|
||||||
func (s *Server) HandleUDP(conn adapter.UDPConn) {
|
func (s *Server) HandleUDP(conn adapter.UDPConn) {
|
||||||
go s.handleUDPConn(conn)
|
go s.handleUDPConn(conn)
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const PipeBufferSize = 65535
|
const PipeBufferSize = 32 * 1024
|
||||||
|
|
||||||
func Pipe(src, dst io.ReadWriter, count func(int)) error {
|
func Pipe(src, dst io.ReadWriter, count func(int)) error {
|
||||||
buf := make([]byte, PipeBufferSize)
|
buf := make([]byte, PipeBufferSize)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user