Documentation
¶
Overview ¶
Package transport provides a transport abstraction layer supporting both gRPC and WebSocket fallback for Mandau core-agent communication.
Index ¶
- type Client
- type Config
- type Manager
- func (m *Manager) Active() Client
- func (m *Manager) ActiveType() Type
- func (m *Manager) Close() error
- func (m *Manager) Connect(ctx context.Context) error
- func (m *Manager) ConnectWithRetry(ctx context.Context, maxRetries int, baseDelay time.Duration) error
- func (m *Manager) Failover(ctx context.Context) error
- func (m *Manager) GRPCConn() *grpc.ClientConn
- func (m *Manager) IsConnected() bool
- func (m *Manager) Reconnect(ctx context.Context) error
- type TLSConfig
- type Type
- type WSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Connect establishes the connection
Connect(ctx context.Context) error
// Close closes the connection
Close() error
// GRPCConn returns the underlying gRPC connection (nil for WebSocket)
GRPCConn() *grpc.ClientConn
// IsConnected returns true if the connection is active
IsConnected() bool
// Type returns the transport type
Type() Type
}
Client is the transport-agnostic client interface
func NewGRPCClient ¶
NewGRPCClient creates a new gRPC client
func NewWSClient ¶
NewWSClient creates a new WebSocket client
type Config ¶
type Config struct {
// Type is the preferred transport type
Type Type
// ServerAddr is the address to connect to
ServerAddr string
// TLS holds TLS configuration
TLS TLSConfig
// WebSocket holds WebSocket-specific config
WebSocket WSConfig
}
Config holds transport configuration
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles transport with automatic fallback
func NewManager ¶
NewManager creates a new transport manager with fallback support
func (*Manager) ActiveType ¶
ActiveType returns the type of the active transport
func (*Manager) Connect ¶
Connect attempts to connect with primary, falls back to secondary on failure
func (*Manager) ConnectWithRetry ¶
func (m *Manager) ConnectWithRetry(ctx context.Context, maxRetries int, baseDelay time.Duration) error
ConnectWithRetry attempts to connect with exponential backoff
func (*Manager) GRPCConn ¶
func (m *Manager) GRPCConn() *grpc.ClientConn
GRPCConn returns the active gRPC connection (may be nil if using WebSocket)
func (*Manager) IsConnected ¶
IsConnected returns true if any transport is connected
type TLSConfig ¶
type TLSConfig struct {
CertPath string
KeyPath string
CAPath string
MinVersion string
ServerName string
}
TLSConfig holds TLS configuration