saucelabs / forwarder

Forwarder is a production-ready, fast MITM proxy with PAC support. It's suitable for debugging, intercepting and manipulating HTTP traffic. It's used as a core component of Sauce Labs Sauce Connect Proxy.
https://forwarder-proxy.io
Mozilla Public License 2.0
200 stars 13 forks source link

TrackedConn: optionally implement WriteTo() and ReadFrom() if the underlying connections supports it #842

Open mmatczuk opened 3 weeks ago

mmatczuk commented 3 weeks ago

The io.Copy has a built in optimization that can issue splice syscall to copy between file descriptors. On a high level it boils down to checking if WriteTo() and ReadFrom() are implemented, see here.

We could use the same technique we use in delegator to provide type with implementations. This should be also applied to CloseWrite().