agent

package
v2.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisplayName = "OSS Traffic Agent" //nolint:gochecknoglobals // extension point
View Source
var NewExtendedManagerClient func(conn *grpc.ClientConn, ossManager rpc.ManagerClient) rpc.ManagerClient //nolint:gochecknoglobals // extension point

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 Main

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

func OtelResources added in v2.7.0

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

func StartServices added in v2.17.0

func StartServices(ctx context.Context, g *dgroup.Group, config Config, srv State) (*rpc.AgentInfo, error)

func TalkToManager

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

func TalkToManagerLoop added in v2.17.0

func TalkToManagerLoop(ctx context.Context, s State, info *rpc.AgentInfo)

Types

type Config

type Config interface {
	Ext() agentconfig.SidecarExt
	AgentConfig() *agentconfig.Sidecar
	HasMounts(ctx context.Context) bool
	PodName() string
	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
	Target() InterceptTarget
	InterceptInfo(ctx context.Context, callerID, path string, containerPort uint16, headers http.Header) (*restapi.InterceptInfo, error)
}

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

type InterceptTarget added in v2.18.0

type InterceptTarget []*agentconfig.Intercept

InterceptTarget describes the mapping between service ports and one container port. All entries must be guaranteed to all have the same Protocol, ContainerPort, and AgentPort. The slice must be considered immutable once created using NewInterceptTarget.

func NewInterceptTarget added in v2.18.0

func NewInterceptTarget(ics []*agentconfig.Intercept) InterceptTarget

func (InterceptTarget) AgentPort added in v2.18.0

func (cp InterceptTarget) AgentPort() uint16

func (InterceptTarget) AppProtocol added in v2.18.0

func (cp InterceptTarget) AppProtocol(ctx context.Context) (proto string)

func (InterceptTarget) ContainerPort added in v2.18.0

func (cp InterceptTarget) ContainerPort() uint16

func (InterceptTarget) ContainerPortName added in v2.18.0

func (cp InterceptTarget) ContainerPortName() string

func (InterceptTarget) HasServicePort added in v2.18.0

func (cp InterceptTarget) HasServicePort(port uint16) bool

func (InterceptTarget) HasServicePortName added in v2.18.0

func (cp InterceptTarget) HasServicePortName(name string) bool

func (InterceptTarget) MatchForSpec added in v2.18.0

func (cp InterceptTarget) MatchForSpec(spec *manager.InterceptSpec) bool

func (InterceptTarget) Protocol added in v2.18.0

func (cp InterceptTarget) Protocol() v1.Protocol

func (InterceptTarget) String added in v2.18.0

func (cp InterceptTarget) String() string

type ProviderMux added in v2.17.0

type ProviderMux struct {
	AgentProvider   tunnel.ClientStreamProvider
	ManagerProvider tunnel.StreamProvider
}

func (*ProviderMux) CreateClientStream added in v2.17.0

func (pm *ProviderMux) CreateClientStream(ctx context.Context, sessionID string, id tunnel.ConnID, roundTripLatency, dialTimeout time.Duration) (tunnel.Stream, error)

func (*ProviderMux) ReportMetrics added in v2.17.0

func (pm *ProviderMux) ReportMetrics(ctx context.Context, metrics *manager.TunnelMetrics)

type SimpleState added in v2.17.0

type SimpleState interface {
	State
	NewInterceptState(forwarder forwarder.Interceptor, target InterceptTarget, mountPoint string, env map[string]string) InterceptState
}

func NewSimpleState added in v2.6.0

func NewSimpleState(config Config) SimpleState

type State

type State interface {
	Config
	agent.AgentServer
	tunnel.ClientStreamProvider
	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
	SetFileSharingPorts(ftp uint16, sftp uint16)
	SetManager(ctx context.Context, sessionInfo *manager.SessionInfo, manager manager.ManagerClient, version semver.Version)
	FtpPort() uint16
	SftpPort() uint16
}

State reflects the current state of the agent.

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