// Connect returns a handler for the node proxy func (r *ProxyREST) Connect(ctx api.Context, id string, opts runtime.Object, responder rest.Responder) (http.Handler, error) { proxyOpts, ok := opts.(*api.NodeProxyOptions) if !ok { return nil, fmt.Errorf("Invalid options object: %#v", opts) } location, transport, err := node.ResourceLocation(r.Store, r.Connection, r.ProxyTransport, ctx, id) if err != nil { return nil, err } location.Path = path.Join(location.Path, proxyOpts.Path) // Return a proxy handler that uses the desired transport, wrapped with additional proxy handling (to get URL rewriting, X-Forwarded-* headers, etc) return newThrottledUpgradeAwareProxyHandler(location, transport, true, false, responder), nil }
// ResourceLocation returns a URL to which one can send traffic for the specified node. func (r *REST) ResourceLocation(ctx api.Context, id string) (*url.URL, http.RoundTripper, error) { return node.ResourceLocation(r, r, r.proxyTransport, ctx, id) }
// ResourceLocation returns a URL to which one can send traffic for the specified node. func (r *REST) ResourceLocation(ctx genericapirequest.Context, id string) (*url.URL, http.RoundTripper, error) { return node.ResourceLocation(r, r.connection, r.proxyTransport, ctx, id) }