mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-03 15:55:20 -05:00
rename buf.Copy
This commit is contained in:
@@ -90,11 +90,11 @@ func (c *Client) Process(ctx context.Context, ray ray.OutboundRay, dialer proxy.
|
||||
var responseFunc func() error
|
||||
if request.Command == protocol.RequestCommandTCP {
|
||||
requestFunc = func() error {
|
||||
return buf.PipeUntilEOF(timer, ray.OutboundInput(), buf.NewWriter(conn))
|
||||
return buf.Copy(timer, ray.OutboundInput(), buf.NewWriter(conn))
|
||||
}
|
||||
responseFunc = func() error {
|
||||
defer ray.OutboundOutput().Close()
|
||||
return buf.PipeUntilEOF(timer, buf.NewReader(conn), ray.OutboundOutput())
|
||||
return buf.Copy(timer, buf.NewReader(conn), ray.OutboundOutput())
|
||||
}
|
||||
} else if request.Command == protocol.RequestCommandUDP {
|
||||
udpConn, err := dialer.Dial(ctx, udpRequest.Destination())
|
||||
@@ -103,12 +103,12 @@ func (c *Client) Process(ctx context.Context, ray ray.OutboundRay, dialer proxy.
|
||||
}
|
||||
defer udpConn.Close()
|
||||
requestFunc = func() error {
|
||||
return buf.PipeUntilEOF(timer, ray.OutboundInput(), &UDPWriter{request: request, writer: udpConn})
|
||||
return buf.Copy(timer, ray.OutboundInput(), &UDPWriter{request: request, writer: udpConn})
|
||||
}
|
||||
responseFunc = func() error {
|
||||
defer ray.OutboundOutput().Close()
|
||||
reader := &UDPReader{reader: udpConn}
|
||||
return buf.PipeUntilEOF(timer, reader, ray.OutboundOutput())
|
||||
return buf.Copy(timer, reader, ray.OutboundOutput())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ func (v *Server) transport(ctx context.Context, reader io.Reader, writer io.Writ
|
||||
defer input.Close()
|
||||
|
||||
v2reader := buf.NewReader(reader)
|
||||
if err := buf.PipeUntilEOF(timer, v2reader, input); err != nil {
|
||||
if err := buf.Copy(timer, v2reader, input); err != nil {
|
||||
return newError("failed to transport all TCP request").Base(err)
|
||||
}
|
||||
return nil
|
||||
@@ -133,7 +133,7 @@ func (v *Server) transport(ctx context.Context, reader io.Reader, writer io.Writ
|
||||
|
||||
responseDone := signal.ExecuteAsync(func() error {
|
||||
v2writer := buf.NewWriter(writer)
|
||||
if err := buf.PipeUntilEOF(timer, output, v2writer); err != nil {
|
||||
if err := buf.Copy(timer, output, v2writer); err != nil {
|
||||
return newError("failed to transport all TCP response").Base(err)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user