Documentation
¶
Index ¶
- func HealthHandler(registry AgentRegistry) http.Handler
- func MetricsHandler(registry AgentRegistry) http.Handler
- type AgentAuthenticator
- type AgentConnection
- type AgentRegistry
- type FileAuthenticator
- type InMemoryRegistry
- func (r *InMemoryRegistry) ObserveQuery(tenantID, agentID string, latency time.Duration)
- func (r *InMemoryRegistry) Pick(ctx context.Context, tenantID string) (AgentConnection, error)
- func (r *InMemoryRegistry) Register(ctx context.Context, tenantID string, agentID string, conn AgentConnection) error
- func (r *InMemoryRegistry) Stats() RegistryStats
- func (r *InMemoryRegistry) Unregister(ctx context.Context, tenantID string, agentID string)
- type LatencyAgg
- type MutableAuthenticator
- type RegistryKey
- type RegistryStats
- type ReloadableAuthenticator
- type Server
- type ServerOption
- type StaticAgentSecret
- type StaticAuthenticator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HealthHandler ¶
func HealthHandler(registry AgentRegistry) http.Handler
HealthHandler returns a simple JSON health/readiness report. Ready = agents connected; Live = process serving.
func MetricsHandler ¶
func MetricsHandler(registry AgentRegistry) http.Handler
MetricsHandler exposes minimal Prometheus-style gauges for agent counts.
Types ¶
type AgentAuthenticator ¶
type AgentAuthenticator = types.AgentAuthenticator
AgentAuthenticator validates an incoming agent hello and returns tenant and agent IDs. Implementations may look up secrets in a datastore or config map.
type AgentConnection ¶
type AgentConnection = types.AgentConnection
Exported via types for external consumers.
type AgentRegistry ¶
type AgentRegistry = types.AgentRegistry
type FileAuthenticator ¶
type FileAuthenticator struct {
// contains filtered or unexported fields
}
FileAuthenticator reads agent credentials from a YAML/JSON file. Schema: list of {clientID, clientSecret, tenantID, agentID}
func NewFileAuthenticator ¶
func NewFileAuthenticator(path string) (*FileAuthenticator, error)
func (*FileAuthenticator) Authenticate ¶
func (*FileAuthenticator) Reload ¶
func (f *FileAuthenticator) Reload() error
func (*FileAuthenticator) Upsert ¶
func (f *FileAuthenticator) Upsert(clientID string, secret StaticAgentSecret)
Upsert updates the in-memory secret map (not persisted to disk). Useful for live rotations coordinated by the bridge controller.
type InMemoryRegistry ¶
type InMemoryRegistry struct {
// contains filtered or unexported fields
}
InMemoryRegistry is a simple in-process registry suitable for single-instance deployments.
func NewInMemoryRegistry ¶
func NewInMemoryRegistry() *InMemoryRegistry
func (*InMemoryRegistry) ObserveQuery ¶
func (r *InMemoryRegistry) ObserveQuery(tenantID, agentID string, latency time.Duration)
func (*InMemoryRegistry) Pick ¶
func (r *InMemoryRegistry) Pick(ctx context.Context, tenantID string) (AgentConnection, error)
func (*InMemoryRegistry) Register ¶
func (r *InMemoryRegistry) Register(ctx context.Context, tenantID string, agentID string, conn AgentConnection) error
func (*InMemoryRegistry) Stats ¶
func (r *InMemoryRegistry) Stats() RegistryStats
func (*InMemoryRegistry) Unregister ¶
func (r *InMemoryRegistry) Unregister(ctx context.Context, tenantID string, agentID string)
type LatencyAgg ¶
type LatencyAgg = types.LatencyAgg
type MutableAuthenticator ¶
type MutableAuthenticator interface {
AgentAuthenticator
Upsert(clientID string, secret StaticAgentSecret)
}
MutableAuthenticator allows in-memory secret updates (e.g., secret rotation without restart).
type RegistryKey ¶
type RegistryKey = types.RegistryKey
type RegistryStats ¶
type RegistryStats = types.RegistryStats
type ReloadableAuthenticator ¶
type ReloadableAuthenticator interface {
AgentAuthenticator
Reload() error
}
ReloadableAuthenticator optionally supports live reload of credentials.
type Server ¶
type Server struct {
proto.UnimplementedAgentServiceServer
// contains filtered or unexported fields
}
Server implements the AgentService gRPC handlers.
func NewServer ¶
func NewServer(auth AgentAuthenticator, registry AgentRegistry, logger *slog.Logger, opts ...ServerOption) *Server
func (*Server) Connect ¶
func (s *Server) Connect(stream proto.AgentService_ConnectServer) error
Connect is the bi-directional stream entrypoint for agents.
func (*Server) SetAgentConfig ¶
func (s *Server) SetAgentConfig(cfg *proto.AgentConfig, broadcast bool, tenant string, clientID string) int
SetAgentConfig updates the server-side AgentConfig and optionally broadcasts it to currently connected agents. Caller supplies full config payload.
type ServerOption ¶
type ServerOption func(*Server)
func WithAgentConfig ¶
func WithAgentConfig(cfg *proto.AgentConfig) ServerOption
WithAgentConfig sends the provided config to agents immediately after they register.
func WithAutoConnectOnRegister ¶
func WithAutoConnectOnRegister(enabled bool) ServerOption
type StaticAgentSecret ¶
type StaticAuthenticator ¶
type StaticAuthenticator struct {
Secrets map[string]StaticAgentSecret
// contains filtered or unexported fields
}
StaticAuthenticator is a simple map-based authenticator for bootstrapping and tests.
func (*StaticAuthenticator) Authenticate ¶
func (*StaticAuthenticator) Upsert ¶
func (a *StaticAuthenticator) Upsert(clientID string, secret StaticAgentSecret)
Upsert adds or replaces a credential in-memory; callers must persist if desired.