client-go: Index | Files

package portforward

import ""

Package portforward adds support for SSH-like port forwarding from the client's local host to remote containers.


Package Files

doc.go portforward.go


const PortForwardProtocolV1Name = ""

TODO move to API machinery and re-unify with kubelet/server/portfoward The subprotocol "" is used for port forwarding.

type ForwardedPort Uses

type ForwardedPort struct {
    Local  uint16
    Remote uint16

ForwardedPort contains a Local:Remote port pairing.

type PortForwarder Uses

type PortForwarder struct {
    Ready chan struct{}
    // contains filtered or unexported fields

PortForwarder knows how to listen for local connections and forward them to a remote pod via an upgraded HTTP request.

func New Uses

func New(dialer httpstream.Dialer, ports []string, stopChan <-chan struct{}, readyChan chan struct{}, out, errOut io.Writer) (*PortForwarder, error)

New creates a new PortForwarder with localhost listen addresses.

func NewOnAddresses Uses

func NewOnAddresses(dialer httpstream.Dialer, addresses []string, ports []string, stopChan <-chan struct{}, readyChan chan struct{}, out, errOut io.Writer) (*PortForwarder, error)

NewOnAddresses creates a new PortForwarder with custom listen addresses.

func (*PortForwarder) Close Uses

func (pf *PortForwarder) Close()

func (*PortForwarder) ForwardPorts Uses

func (pf *PortForwarder) ForwardPorts() error

ForwardPorts formats and executes a port forwarding request. The connection will remain open until stopChan is closed.

func (*PortForwarder) GetPorts Uses

func (pf *PortForwarder) GetPorts() ([]ForwardedPort, error)

GetPorts will return the ports that were forwarded; this can be used to retrieve the locally-bound port in cases where the input was port 0. This function will signal an error if the Ready channel is nil or if the listeners are not ready yet; this function will succeed after the Ready channel has been closed.

Package portforward imports 12 packages (graph) and is imported by 34 packages. Updated 2018-10-09. Refresh now. Tools for package owners.