Skip to content

Commit 6eb445d

Browse files
committed
random buffer tweaks
Signed-off-by: Mark Pashmfouroush <mark@markpash.me>
1 parent d8088b3 commit 6eb445d

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

proxy/pkg/mixed/proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ type SwitchConn struct {
7070
func NewSwitchConn(conn net.Conn) *SwitchConn {
7171
return &SwitchConn{
7272
Conn: conn,
73-
Reader: bufio.NewReaderSize(conn, 1500),
73+
Reader: bufio.NewReaderSize(conn, 2048),
7474
}
7575
}
7676

proxy/pkg/socks5/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ func (s *Server) embedHandleConnect(req *request) error {
296296
s.BytesPool.Put(buf2)
297297
}()
298298
} else {
299-
buf1 = make([]byte, 2*1024)
300-
buf2 = make([]byte, 2*1024)
299+
buf1 = make([]byte, 4*1024)
300+
buf2 = make([]byte, 4*1024)
301301
}
302302
return statute.Tunnel(s.Context, target, req.Conn, buf1, buf2)
303303
}

wiresocks/proxy.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"github.com/bepass-org/warp-plus/proxy/pkg/statute"
1212
"github.com/bepass-org/warp-plus/wireguard/device"
1313
"github.com/bepass-org/warp-plus/wireguard/tun/netstack"
14-
15-
"github.com/things-go/go-socks5/bufferpool"
1614
)
1715

1816
// VirtualTun stores a reference to netstack network and DNS configuration
@@ -37,7 +35,7 @@ func (vt *VirtualTun) StartProxy(bindAddress netip.AddrPort) (netip.AddrPort, er
3735
mixed.WithUserHandler(func(request *statute.ProxyRequest) error {
3836
return vt.generalHandler(request)
3937
}),
40-
mixed.WithBytesPool(bufferpool.NewPool(256*1024)),
38+
// mixed.WithBytesPool(bufferpool.NewPool(256*1024)),
4139
)
4240
go func() {
4341
_ = proxy.ListenAndServe()
@@ -62,8 +60,8 @@ func (vt *VirtualTun) generalHandler(req *statute.ProxyRequest) error {
6260
// Channel to notify when copy operation is done
6361
done := make(chan error, 1)
6462
// Copy data from req.Conn to conn
65-
buf1 := make([]byte, 2*1024)
66-
buf2 := make([]byte, 2*1024)
63+
buf1 := make([]byte, 4*1024)
64+
buf2 := make([]byte, 4*1024)
6765
go func() {
6866
_, err := io.CopyBuffer(conn, req.Conn, buf1)
6967
done <- err

0 commit comments

Comments
 (0)