build/revdial/v2
Michael Pratt d5abf980d5 all: handle revdial redirects on connect
In dev mode, the coordinator uses hostPathHandler, which redirects
/reverse and /revdial to /farmer.golang.org/reverse, etc.

Establishing a revdial connection chokes on this redirect, as there it
expects to complete the protocol switch in a single request.

Add rudimentary redirect support via a helper so this works in dev mode.

Note that linkRewriter must implement http.Hijacker as
revdial.ConnHandler type-asserts the http.ResponseWriter to a Hijacker.

For golang/go#48803

Change-Id: I191fa6ff17bbd334203430f3c1f2c5e03db407ff
Reviewed-on: https://go-review.googlesource.com/c/build/+/354630
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-10-15 19:50:46 +00:00
..
README.md all: add or change GoDoc badge to pkg.go.dev with update-readmes.go 2020-12-15 04:52:31 +00:00
revdial.go all: handle revdial redirects on connect 2021-10-15 19:50:46 +00:00

README.md

Go Reference

golang.org/x/build/revdial/v2

Package revdial implements a Dialer and Listener which work together to turn an accepted connection (for instance, a Hijacked HTTP request) into a Dialer which can then create net.Conns connecting back to the original dialer, which then gets a net.Listener accepting those conns.