Documentation ¶
Overview ¶
Package portforward implements support for implementing a fake port forward service in the api.
The implementation is heavily inspired from https://github.com/kubernetes-sigs/kwok/blob/main/pkg/kwok/server/portforward/httpstream.go (kudos to the team there!)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPStreamReceived ¶
func HTTPStreamReceived(streamsCh chan httpstream.Stream) func(httpstream.Stream, <-chan struct{}) error
HTTPStreamReceived is the httpstream.NewStreamHandler for port forward streams. Each valid stream is sent to the streams channel.
func HTTPStreamTunnel ¶
func HTTPStreamTunnel(ctx context.Context, c1, c2 io.ReadWriter) error
HTTPStreamTunnel create tunnels for two streams.
Types ¶
type HTTPStreamHandler ¶
HTTPStreamHandler is capable of processing multiple port forward requests over a single httpstream.Connection.
func NewHTTPStreamHandler ¶
func NewHTTPStreamHandler(conn httpstream.Connection, streamsCh chan httpstream.Stream, podName, podNamespace string, forwarder PortForwarder) HTTPStreamHandler
NewHTTPStreamHandler returns a new httpStreamHandler capable of processing multiple port forward operations over a single httpstream.Connection.
type PortForwarder ¶
type PortForwarder func(ctx context.Context, podName, podNamespace, port string, stream io.ReadWriteCloser) error
PortForwarder knows how to forward content from a data stream to/from a target (usually a port in a pod).