Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(ctx context.Context, forwarder PortForwarder, opts PortForwardOptions) chan error
Run leverages forwarder to create a TCP tunnel according to opts. This function runs asynchronously and returns a channel that may: - produce and error and then close immediately. This means the forwarder couldn't establish the tunnel; - close without errors. In this case the tunnel is in place and ready to accept connections.
A client is not supposed to close the channel but it must wait for it to either close or produce an error; this function will leak a goroutine otherwise.
Good:
if err := <-Run(ctx, PortForwardOptions{}); err != nil { // handle the error somehow }
Bad:
_ = Run(ctx, PortForwardOptions{}) // a goroutine will run forever, trying to push an error
func SPDYPortForwarder ¶
func SPDYPortForwarder(method string, url *url.URL, readyChannel chan struct{}, opts PortForwardOptions) error
Types ¶
type PortForwardOptions ¶
type PortForwarder ¶
type PortForwarder func(method string, url *url.URL, readyChannel chan struct{}, opts PortForwardOptions) error
PortForwarder knows how to establish a tunnel to a pod at url, according to opts. It's likely the implementors of this interface will run async, readyChannel is here to inform clients when the tunnel has been successfully established.