proxy

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package proxy implements kubeadm proxy functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialTimeout

func DialTimeout(duration time.Duration) func(*Dialer) error

DialTimeout sets the timeout.

Types

type Addr

type Addr struct {
	net.Addr
	// contains filtered or unexported fields
}

Addr defines a proxy net/addr format.

func NewAddrFromConn

func NewAddrFromConn(c *Conn) Addr

NewAddrFromConn creates an Addr from the given connection.

func (Addr) Network

func (a Addr) Network() string

Network returns a fake network.

func (Addr) String

func (a Addr) String() string

String returns encoded information about the connection.

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is a Kubernetes API server proxied type of net/conn.

func NewConn

func NewConn(connection httpstream.Connection, stream httpstream.Stream) *Conn

NewConn creates a new net/conn interface based on an underlying Kubernetes API server proxy connection.

func (*Conn) Close

func (c *Conn) Close() error

Close the underlying proxied connection.

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

LocalAddr returns a fake address representing the proxied connection.

func (*Conn) Read

func (c *Conn) Read(b []byte) (n int, err error)

Read from the connection.

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

RemoteAddr returns a fake address representing the proxied connection.

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines to the specified interval.

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline sets the read and write deadlines to the specified interval.

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the read and write deadlines to the specified interval.

func (*Conn) Write

func (c *Conn) Write(b []byte) (n int, err error)

Write to the connection.

type Dialer

type Dialer struct {
	// contains filtered or unexported fields
}

Dialer creates connections using Kubernetes API Server port-forwarding.

func NewDialer

func NewDialer(p Proxy, options ...func(*Dialer) error) (*Dialer, error)

NewDialer creates a new dialer for a given API server scope.

func (*Dialer) DialContext

func (d *Dialer) DialContext(_ context.Context, _ string, addr string) (net.Conn, error)

DialContext creates proxied port-forwarded connections. ctx is currently unused, but fulfils the type signature used by GRPC.

func (*Dialer) DialContextWithAddr

func (d *Dialer) DialContextWithAddr(ctx context.Context, addr string) (net.Conn, error)

DialContextWithAddr is a GO grpc compliant dialer construct.

type Proxy

type Proxy struct {

	// Kind is the kind of Kubernetes resource
	Kind string

	// Namespace is the namespace in which the Kubernetes resource exists
	Namespace string

	// ResourceName is the name of the Kubernetes resource
	ResourceName string

	// KubeConfig is the config to connect to the API server
	KubeConfig *rest.Config

	// KeepAlive specifies how often a keep alive message is sent to hold
	// the connection open
	KeepAlive *time.Duration

	// Port is the port to be forwarded from the relevant resource
	Port int
}

Proxy defines the API server port-forwarded proxy.

Jump to

Keyboard shortcuts

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