This looks good, and while I appreciate the refactor of CopyLoop into a common library, I fear that we will be undoing this with the changes in #29206 (moved) (see the most recent candidate). Not only are we encapsulating the web socket connection on the side inside a SnowflakeConn, we also handle the data received differently on the server side than the proxy side by using something similar to the ConnMap of Turbo Tunnel.
So for now I'd suggest keeping the shared library but hold off on moving the proxy function to it.