Documentation
¶
Index ¶
- type AgentConnection
- type Config
- type ConnectionManager
- func (cm *ConnectionManager) Count() int
- func (cm *ConnectionManager) Get(planeIdentifier string) (*AgentConnection, error)
- func (cm *ConnectionManager) GetAll() []*AgentConnection
- func (cm *ConnectionManager) Register(planeIdentifier string, conn *websocket.Conn) (string, error)
- func (cm *ConnectionManager) SendHTTPTunnelRequest(planeIdentifier string, req *messaging.HTTPTunnelRequest) error
- func (cm *ConnectionManager) Unregister(planeIdentifier, connID string)
- func (cm *ConnectionManager) UpdateConnectionLastSeen(planeIdentifier, connID string)
- type RemoteServerClientConfig
- type RequestValidator
- type Server
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentConnection ¶
type AgentConnection struct {
ID string // Unique connection identifier
Conn *websocket.Conn
PlaneIdentifier string // Composite identifier: {planeType}/{planeName}
ConnectedAt time.Time
LastSeen time.Time
// contains filtered or unexported fields
}
AgentConnection represents an active agent connection Multiple agent replicas for the same plane can share the same PlaneIdentifier for HA
func (*AgentConnection) Close ¶
func (ac *AgentConnection) Close() error
Close closes the agent connection
func (*AgentConnection) SendHTTPTunnelRequest ¶ added in v0.7.0
func (ac *AgentConnection) SendHTTPTunnelRequest(req *messaging.HTTPTunnelRequest) error
SendHTTPTunnelRequest sends an HTTPTunnelRequest through this connection
type Config ¶
type Config struct {
Port int
ServerCertPath string
ServerKeyPath string
ReadTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
ShutdownTimeout time.Duration
HeartbeatInterval time.Duration
HeartbeatTimeout time.Duration
}
Config holds configuration for the agent server
type ConnectionManager ¶
type ConnectionManager struct {
// contains filtered or unexported fields
}
ConnectionManager manages active agent connections Supports multiple concurrent connections per plane identifier for HA
func NewConnectionManager ¶
func NewConnectionManager(logger *slog.Logger) *ConnectionManager
NewConnectionManager creates a new ConnectionManager
func (*ConnectionManager) Count ¶
func (cm *ConnectionManager) Count() int
Count returns the total number of active connections across all planes
func (*ConnectionManager) Get ¶
func (cm *ConnectionManager) Get(planeIdentifier string) (*AgentConnection, error)
Get retrieves an agent connection by plane identifier using round-robin selection If multiple connections exist for the plane, it rotates between them
func (*ConnectionManager) GetAll ¶
func (cm *ConnectionManager) GetAll() []*AgentConnection
func (*ConnectionManager) Register ¶
Register registers a new agent connection Multiple agent replicas (for HA) for the same plane share the same planeIdentifier Returns the connection ID which should be used for unregistration
func (*ConnectionManager) SendHTTPTunnelRequest ¶ added in v0.7.0
func (cm *ConnectionManager) SendHTTPTunnelRequest(planeIdentifier string, req *messaging.HTTPTunnelRequest) error
func (*ConnectionManager) Unregister ¶
func (cm *ConnectionManager) Unregister(planeIdentifier, connID string)
func (*ConnectionManager) UpdateConnectionLastSeen ¶
func (cm *ConnectionManager) UpdateConnectionLastSeen(planeIdentifier, connID string)
UpdateConnectionLastSeen updates the last seen time for a specific connection
type RemoteServerClientConfig ¶
type RemoteServerClientConfig struct {
// ServerURL is the URL of the agent server (e.g., https://cluster-agent-server:8443)
ServerURL string
// InsecureSkipVerify disables TLS certificate verification (development only)
InsecureSkipVerify bool
// ServerCAPath is the path to the CA certificate for verifying the server's certificate
// If empty and InsecureSkipVerify is false, system CA pool will be used
ServerCAPath string
// ClientCertPath is the path to the client certificate for mTLS (optional)
ClientCertPath string
// ClientKeyPath is the path to the client private key for mTLS (optional)
ClientKeyPath string
// Timeout is the HTTP client timeout
Timeout time.Duration
}
RemoteServerClientConfig holds configuration for RemoteServerClient
type RequestValidator ¶ added in v0.7.0
type RequestValidator struct {
// contains filtered or unexported fields
}
func NewRequestValidator ¶ added in v0.7.0
func NewRequestValidator() *RequestValidator
func (*RequestValidator) AllowTarget ¶ added in v0.7.0
func (v *RequestValidator) AllowTarget(target string)
func (*RequestValidator) BlockPath ¶ added in v0.7.0
func (v *RequestValidator) BlockPath(path string)
func (*RequestValidator) SetMaxRequestBodySize ¶ added in v0.7.0
func (v *RequestValidator) SetMaxRequestBodySize(size int64)
func (*RequestValidator) ValidateRequest ¶ added in v0.7.0
func (v *RequestValidator) ValidateRequest(r *http.Request, target, path string) error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GetConnectionManager ¶
func (s *Server) GetConnectionManager() *ConnectionManager
func (*Server) SendHTTPTunnelRequest ¶ added in v0.7.0
func (s *Server) SendHTTPTunnelRequest(planeName string, req *messaging.HTTPTunnelRequest, timeout time.Duration) (*messaging.HTTPTunnelResponse, error)
SendHTTPTunnelRequest sends an HTTP tunnel request to an agent and waits for the response
type ValidationError ¶ added in v0.7.0
func (*ValidationError) Error ¶ added in v0.7.0
func (e *ValidationError) Error() string