agent

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NonSessionBackoffInitialInterval     = 500 * time.Millisecond
	NonSessionBackoffMultiplier          = 1.2
	NonSessionBackoffRandomizationFactor = 0.05
	NonSessionBackoffMaxInterval         = 10 * time.Second
	NonSessionBackoffMaxElapsedTime      = 0
)

Variables

This section is empty.

Functions

func Base64EncodeStr

func Base64EncodeStr(info string) (str string)

func MetaMessenger

func MetaMessenger(ctx context.Context, logger *logrus.Logger, metaConn net.Conn) error

Types

type KubernetesClientManager

type KubernetesClientManager struct {
	base.Component
	// contains filtered or unexported fields
}

KubernetesClientManager manages http clients with connection to kubernetes api server.

func NewKubernetesClientManager

func NewKubernetesClientManager(ctx context.Context, logger *logrus.Logger, config *rest.Config, target *url.URL) KubernetesClientManager

func (*KubernetesClientManager) Do

func (kcm *KubernetesClientManager) Do(sessionID uint16, r *http.Request) (net.Conn, *http.Response, error)

Do function will automatically create new http client and do http request. The connection is hijacked and hold when response is successfully returned. If any error exists, no connection or response returned. The close of hijacked connection should be processed by function return value receiver.

type StubConnector

type StubConnector struct {
	base.Component
	// contains filtered or unexported fields
}

StubConnector construct new connection to stub server

func NewStubConnector

func NewStubConnector(ctx context.Context, logger *logrus.Logger, urlStr string, tlsConfig *tls.Config) StubConnector

func (*StubConnector) Connect

func (sc *StubConnector) Connect(isSession byte, sessionID uint16) (conn net.Conn, err error)

isSession = 0 means this is the connection of request channel (first registration channel) isSession = 1 means this is a new connection for some http request sessionID should be 0 is isSession = 0, otherwise it represents the current session id received from request channel

type TLSRoundTripper

type TLSRoundTripper struct {
	Conn net.Conn
}

TLSRoundTripper is a roundtripper used for http client connection hijack Usually, http client will automatically close connection after handling response but SPDY needs to hold that connection and expose it to outer scope for later use. This roundtripper is designed to do it.

func NewTLSRoundTripper

func NewTLSRoundTripper(config *tls.Config, address string) (*TLSRoundTripper, error)

func (*TLSRoundTripper) RoundTrip

func (tlsRoundTripper *TLSRoundTripper) RoundTrip(r *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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