throttle https

master
bel 2022-08-12 23:35:00 -06:00
parent 567379a6f1
commit 3092e9f62f
1 changed files with 8 additions and 1 deletions

View File

@ -69,7 +69,14 @@ func (s *Server) Connect(w http.ResponseWriter, r *http.Request) {
xfer := func(dst io.WriteCloser, src io.ReadCloser) { xfer := func(dst io.WriteCloser, src io.ReadCloser) {
defer dst.Close() defer dst.Close()
defer src.Close() defer src.Close()
io.Copy(dst, src) io.Copy(
throttledWriter{
ctx: r.Context(),
w: dst,
limiter: s.limiter,
},
src,
)
} }
go xfer(dest, client) go xfer(dest, client)