portforward

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

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

type HTTPStreamHandler interface {
	Run(ctx context.Context)
}

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL