Skip to content

Commit

Permalink
random buffer tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Pashmfouroush <[email protected]>
  • Loading branch information
markpash committed Apr 16, 2024
1 parent d8088b3 commit 6eb445d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion proxy/pkg/mixed/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type SwitchConn struct {
func NewSwitchConn(conn net.Conn) *SwitchConn {
return &SwitchConn{
Conn: conn,
Reader: bufio.NewReaderSize(conn, 1500),
Reader: bufio.NewReaderSize(conn, 2048),
}
}

Expand Down
4 changes: 2 additions & 2 deletions proxy/pkg/socks5/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ func (s *Server) embedHandleConnect(req *request) error {
s.BytesPool.Put(buf2)
}()
} else {
buf1 = make([]byte, 2*1024)
buf2 = make([]byte, 2*1024)
buf1 = make([]byte, 4*1024)
buf2 = make([]byte, 4*1024)
}
return statute.Tunnel(s.Context, target, req.Conn, buf1, buf2)
}
Expand Down
8 changes: 3 additions & 5 deletions wiresocks/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"github.com/bepass-org/warp-plus/proxy/pkg/statute"
"github.com/bepass-org/warp-plus/wireguard/device"
"github.com/bepass-org/warp-plus/wireguard/tun/netstack"

"github.com/things-go/go-socks5/bufferpool"
)

// VirtualTun stores a reference to netstack network and DNS configuration
Expand All @@ -37,7 +35,7 @@ func (vt *VirtualTun) StartProxy(bindAddress netip.AddrPort) (netip.AddrPort, er
mixed.WithUserHandler(func(request *statute.ProxyRequest) error {
return vt.generalHandler(request)
}),
mixed.WithBytesPool(bufferpool.NewPool(256*1024)),
// mixed.WithBytesPool(bufferpool.NewPool(256*1024)),
)
go func() {
_ = proxy.ListenAndServe()
Expand All @@ -62,8 +60,8 @@ func (vt *VirtualTun) generalHandler(req *statute.ProxyRequest) error {
// Channel to notify when copy operation is done
done := make(chan error, 1)
// Copy data from req.Conn to conn
buf1 := make([]byte, 2*1024)
buf2 := make([]byte, 2*1024)
buf1 := make([]byte, 4*1024)
buf2 := make([]byte, 4*1024)
go func() {
_, err := io.CopyBuffer(conn, req.Conn, buf1)
done <- err
Expand Down

0 comments on commit 6eb445d

Please sign in to comment.