Help us shape the future of Go! Take the 2026 Go Developer Survey

core

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WSUpgrader = websocket.Upgrader{
	ReadBufferSize:  4096,
	WriteBufferSize: 4096,
	CheckOrigin: func(r *http.Request) bool {

		origin := r.Header.Get("Origin")
		if origin == "" {
			return true
		}

		return strings.Contains(origin, "localhost") ||
			strings.Contains(origin, "127.0.0.1") ||
			origin == r.Host
	},
}

WSUpgrader upgrades HTTP connections to WebSocket

Functions

This section is empty.

Types

type AgentConnection

type AgentConnection struct {
	ID           string
	Hostname     string
	Address      string
	Labels       map[string]string
	Capabilities []string
	Client       *grpc.ClientConn // Changed from grpc.ClientConnInterface to *grpc.ClientConn
	LastSeen     time.Time
	Status       AgentStatus
	Stacks       []string // List of stack IDs/names on this agent
}

type AgentRegistry

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

type AgentStatus

type AgentStatus string
const (
	AgentStatusOnline  AgentStatus = "online"
	AgentStatusOffline AgentStatus = "offline"
	AgentStatusError   AgentStatus = "error"
)

type AuditLogger

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

func NewAuditLogger

func NewAuditLogger(plugins *plugin.Registry) *AuditLogger

func (*AuditLogger) LogAgentOffline

func (a *AuditLogger) LogAgentOffline(ctx context.Context, agentID string)

func (*AuditLogger) LogAgentRegistration

func (a *AuditLogger) LogAgentRegistration(ctx context.Context, agentID, hostname string)

type Authorizer

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

func NewAuthorizer

func NewAuthorizer(plugins *plugin.Registry) *Authorizer

type Core

type Core struct {
	agentv1.UnimplementedCoreServiceServer
	agentv1.UnimplementedStackServiceServer
	// contains filtered or unexported fields
}

Core is the central control plane that manages multiple agents

func NewCore

func NewCore(cfg *CoreConfig) (*Core, error)

func (*Core) ApplyStack

func (*Core) DiffStack

func (*Core) GetStack

func (*Core) GetStackLogs

func (*Core) HandleWebSocket

func (c *Core) HandleWebSocket(w http.ResponseWriter, r *http.Request)

HandleWebSocket handles incoming WebSocket connections from agents

func (*Core) Heartbeat

func (*Core) ListAgents

ListAgents returns all registered agents

func (*Core) ListAgentsJSON

func (c *Core) ListAgentsJSON() (interface{}, error)

ListAgentsJSON returns agents as JSON for the REST API

func (*Core) ListStacks

func (*Core) ProxyStackOperation

func (c *Core) ProxyStackOperation(ctx context.Context, agentID string, req *agentv1.ApplyStackRequest) (string, error)

ProxyStackOperation forwards stack operations to the target agent

func (*Core) RegisterAgent

func (c *Core) RegisterAgent(ctx context.Context, req *agentv1.RegisterRequest) (*agentv1.RegisterResponse, error)

RegisterAgent handles agent registration

func (*Core) RemoveStack

func (*Core) Serve

func (c *Core) Serve() error

type CoreConfig

type CoreConfig struct {
	ListenAddr string
	CertPath   string
	KeyPath    string
	CAPath     string
	PluginDir  string
	// Add a field to hold the full configuration
	FullConfig *config.CoreConfig
}

type WSConnection

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

WSConnection represents a WebSocket connection from an agent

type WSMessage

type WSMessage struct {
	Type      string          `json:"type"`
	ID        string          `json:"id,omitempty"`
	Payload   json.RawMessage `json:"payload,omitempty"`
	Timestamp time.Time       `json:"timestamp"`
	Error     string          `json:"error,omitempty"`
}

WSMessage represents a message exchanged over WebSocket

Jump to

Keyboard shortcuts

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