Initial proxy tunnelling.

This commit is contained in:
Brendan Burns
2015-05-27 21:38:21 -07:00
committed by CJ Cullen
parent 631cf34d40
commit 30a89968a4
6 changed files with 244 additions and 37 deletions

View File

@@ -49,6 +49,8 @@ type ProxyHandler struct {
codec runtime.Codec
context api.RequestContextMapper
apiRequestInfoResolver *APIRequestInfoResolver
dial func(network, addr string) (net.Conn, error)
}
func (r *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
@@ -119,9 +121,9 @@ func (r *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
httpCode = http.StatusNotFound
return
}
// TODO: make this dynamic
location.Host = "localhost"
location.Scheme = "http"
if r.dial != nil {
transport = &http.Transport{Dial: r.dial}
}
// Default to http
if location.Scheme == "" {