agent

package
v2.9.4-test.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppEnvironment

func AppEnvironment(ctx context.Context, ag *agentconfig.Container) (map[string]string, error)

AppEnvironment returns the environment visible to this agent together with environment variables explicitly declared for the app container and minus the environment variables provided by this config.

func GetAmbassadorCloudConnectionInfo added in v2.2.0

func GetAmbassadorCloudConnectionInfo(ctx context.Context, address string) (*rpc.AmbassadorCloudConnection, error)

func Main

func Main(ctx context.Context, args ...string) error

func OtelResources added in v2.7.0

func OtelResources(ctx context.Context, c Config) []attribute.KeyValue

func SftpServer added in v2.4.7

func SftpServer(ctx context.Context, sftpPortCh chan<- uint16) error

SftpServer creates a listener on the next available port, writes that port on the given channel, and then starts accepting connections on that port. Each connection starts a sftp-server that communicates with that connection using its stdin and stdout.

func TalkToManager

func TalkToManager(ctx context.Context, address string, info *rpc.AgentInfo, state State) error

Types

type Config

type Config interface {
	AgentConfig() *agentconfig.Sidecar
	HasMounts(ctx context.Context) bool
	PodIP() string
}

func LoadConfig added in v2.6.0

func LoadConfig(ctx context.Context) (Config, error)

type InterceptState added in v2.6.0

type InterceptState interface {
	State
	InterceptConfigs() []*agentconfig.Intercept
	InterceptInfo(ctx context.Context, callerID, path string, containerPort uint16, headers http.Header) (*restapi.InterceptInfo, error)
	HandleIntercepts(ctx context.Context, cepts []*manager.InterceptInfo) []*manager.ReviewInterceptRequest
}

An InterceptState implements what's needed to intercept one port.

func NewInterceptState added in v2.6.0

func NewInterceptState(s State, forwarder forwarder.Interceptor, intercepts []*agentconfig.Intercept, mountPoint string, env map[string]string) InterceptState

NewInterceptState creates a InterceptState that performs intercepts by using an Interceptor which indiscriminately intercepts all traffic to the port that it forwards.

type State

type State interface {
	Config
	AddInterceptState(is InterceptState)
	AgentState() restapi.AgentState
	InterceptStates() []InterceptState
	HandleIntercepts(ctx context.Context, cepts []*manager.InterceptInfo) []*manager.ReviewInterceptRequest
	ManagerClient() manager.ManagerClient
	ManagerVersion() semver.Version
	SessionInfo() *manager.SessionInfo
	SetManager(sessionInfo *manager.SessionInfo, manager manager.ManagerClient, version semver.Version)
	FtpPort() uint16
	SftpPort() uint16
	WaitForFtpPort(ctx context.Context, ch <-chan uint16) error
	WaitForSftpPort(ctx context.Context, ch <-chan uint16) error
}

State reflects the current state of the agent.

func NewSimpleState added in v2.6.0

func NewSimpleState(config Config) State

func NewState

func NewState(config Config) State

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳