agentgateway

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package agentgateway pkg/agentgateway/gateway_client.go

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrGatewayNotConnected indicates the gateway client is not connected.
	ErrGatewayNotConnected = errors.New("gateway client not connected")
	// ErrGatewayAddrRequired indicates gateway_addr is required in configuration.
	ErrGatewayAddrRequired = errors.New("gateway_addr is required for push mode")
	// ErrEnrollmentRejected indicates the gateway rejected agent enrollment.
	ErrEnrollmentRejected = errors.New("agent enrollment rejected by gateway")
	// ErrSecurityRequired indicates security configuration is required for production.
	ErrSecurityRequired = errors.New("security configuration required: set SR_ALLOW_INSECURE=true for development")
	// ErrNoChunksToSend indicates no valid status chunks were provided for streaming.
	ErrNoChunksToSend = errors.New("no status chunks to send")
	// ErrConnectionShutdown indicates the gRPC connection entered shutdown state.
	ErrConnectionShutdown = errors.New("connection shutdown")
)

Functions

This section is empty.

Types

type GatewayClient

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

GatewayClient manages the connection to the agent-gateway and pushes status updates.

func NewGatewayClient

func NewGatewayClient(addr string, security *models.SecurityConfig, log logger.Logger) *GatewayClient

NewGatewayClient creates a new gateway client.

func (*GatewayClient) Connect

func (g *GatewayClient) Connect(ctx context.Context) error

Connect establishes a connection to the gateway.

func (*GatewayClient) ControlStream added in v1.0.91

ControlStream opens the bidirectional control stream for commands and push-config.

func (*GatewayClient) Disconnect

func (g *GatewayClient) Disconnect() error

Disconnect closes the connection to the gateway.

func (*GatewayClient) GetConfig

GetConfig fetches the agent's configuration from the gateway. Supports versioning - returns not_modified if config hasn't changed.

func (*GatewayClient) GetGatewayID added in v1.0.90

func (g *GatewayClient) GetGatewayID() string

GetGatewayID returns the gateway ID assigned during enrollment.

func (*GatewayClient) GetReconnectDelay

func (g *GatewayClient) GetReconnectDelay() time.Duration

GetReconnectDelay returns the current reconnect delay.

func (*GatewayClient) Hello

Hello sends an enrollment request to the gateway. This should be called on agent startup to announce the agent and register with the gateway.

func (*GatewayClient) IsConnected

func (g *GatewayClient) IsConnected() bool

IsConnected returns whether the client is currently connected.

func (*GatewayClient) PushStatus

PushStatus sends a batch of service statuses to the gateway.

func (*GatewayClient) ReconnectWithBackoff

func (g *GatewayClient) ReconnectWithBackoff(ctx context.Context) error

ReconnectWithBackoff attempts to reconnect with exponential backoff.

func (*GatewayClient) StreamStatus

StreamStatus streams service status chunks to the gateway.

Jump to

Keyboard shortcuts

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