Documentation
¶
Index ¶
- func ServeSSE(w http.ResponseWriter, r *http.Request, hub *Hub, id string)
- func ValidateMode(mode string) (string, error)
- func ValidateTarget(raw string) (string, error)
- type AgentInfo
- type AgentPool
- func (p *AgentPool) CancelPTY(agentID, terminalID string)
- func (p *AgentPool) CancelTask(agentID, taskID string)
- func (p *AgentPool) CloseTerminal(agentID, terminalID string)
- func (p *AgentPool) Count() int
- func (p *AgentPool) DispatchCommand(agentID, taskID, command string) (<-chan taskResult, error)
- func (p *AgentPool) HandleTerminalWS(agentID string, w http.ResponseWriter, r *http.Request)
- func (p *AgentPool) HandleWS(w http.ResponseWriter, r *http.Request)
- func (p *AgentPool) List() []AgentInfo
- func (p *AgentPool) Pick() *remoteAgent
- func (p *AgentPool) SendAgentMessage(agentID string, msg WSMessage) error
- type BroadcastCallback
- type Handler
- type Hub
- type HubEvent
- type LLMConfig
- type LLMConfigStore
- type SQLiteStore
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) Create(ctx context.Context, job *ScanJob) error
- func (s *SQLiteStore) Delete(ctx context.Context, id string) error
- func (s *SQLiteStore) Get(ctx context.Context, id string) (*ScanJob, error)
- func (s *SQLiteStore) List(ctx context.Context, limit int) ([]*ScanJob, error)
- func (s *SQLiteStore) Update(ctx context.Context, job *ScanJob) error
- type ScanJob
- type ScanRequest
- type ScanStatus
- type Service
- func (s *Service) CancelScan(id string) error
- func (s *Service) Close()
- func (s *Service) GetLLMConfig(ctx context.Context) (LLMConfig, error)
- func (s *Service) GetReport(ctx context.Context, id string) (string, error)
- func (s *Service) GetScan(ctx context.Context, id string) (*ScanJob, error)
- func (s *Service) Hub() *Hub
- func (s *Service) ListScans(ctx context.Context) ([]*ScanJob, error)
- func (s *Service) SaveLLMConfig(ctx context.Context, cfg LLMConfig) (LLMConfig, error)
- func (s *Service) SetAgentPool(pool *AgentPool)
- func (s *Service) Status() ServiceStatus
- func (s *Service) SubmitScan(ctx context.Context, target, mode string, verify, sniper, deep bool) (*ScanJob, error)
- type ServiceConfig
- type ServiceStatus
- type Store
- type WSMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateMode ¶
func ValidateTarget ¶
Types ¶
type AgentInfo ¶
type AgentInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Commands []string `json:"commands,omitempty"`
Busy bool `json:"busy"`
ConnectAt time.Time `json:"connected_at"`
Identity webproto.AgentIdentity `json:"identity,omitempty"`
Stats webproto.AgentStats `json:"stats,omitempty"`
}
AgentInfo is the public view of a connected agent.
type AgentPool ¶
type AgentPool struct {
// contains filtered or unexported fields
}
AgentPool manages connected remote aiscan agents via WebSocket.
func NewAgentPool ¶
func (*AgentPool) CancelTask ¶
func (*AgentPool) CloseTerminal ¶
func (*AgentPool) DispatchCommand ¶
DispatchCommand sends a command to an agent and returns a channel for the result.
func (*AgentPool) HandleTerminalWS ¶
HandleTerminalWS bridges one browser terminal WebSocket to one remote agent. The browser sends pty.* messages; the pool assigns a stream_id and relays matching agent responses back.
func (*AgentPool) HandleWS ¶
func (p *AgentPool) HandleWS(w http.ResponseWriter, r *http.Request)
HandleWS upgrades to WebSocket and manages the agent lifecycle. This single endpoint replaces register + stream + output + complete.
type BroadcastCallback ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) OnBroadcast ¶
func (h *Hub) OnBroadcast(cb BroadcastCallback)
type HubEvent ¶
type HubEvent struct {
Type string
Data json.RawMessage
}
HubEvent is the unit broadcast through the SSE hub. Type is the SSE event name, Data is pre-serialized JSON written directly to the stream.
type LLMConfig ¶
type LLMConfig struct {
ConfigPath string `json:"config_path,omitempty"`
ConfigLoaded bool `json:"config_loaded"`
Provider string `json:"provider"`
BaseURL string `json:"base_url"`
APIKey string `json:"api_key,omitempty"`
APIKeyConfigured bool `json:"api_key_configured"`
Model string `json:"model"`
Proxy string `json:"proxy"`
}
type LLMConfigStore ¶
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
func NewSQLiteStore ¶
func NewSQLiteStore(dbPath string) (*SQLiteStore, error)
func (*SQLiteStore) Close ¶
func (s *SQLiteStore) Close() error
type ScanJob ¶
type ScanJob struct {
ID string `json:"id"`
Target string `json:"target"`
Mode string `json:"mode"`
Verify bool `json:"verify,omitempty"`
Sniper bool `json:"sniper,omitempty"`
AI bool `json:"ai,omitempty"`
Deep bool `json:"deep,omitempty"`
Status ScanStatus `json:"status"`
Progress string `json:"progress,omitempty"`
Report string `json:"report,omitempty"`
Result *output.Result `json:"result,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ScanRequest ¶
type ScanRequest struct {
Target string `json:"target"`
Mode string `json:"mode"`
Verify bool `json:"verify,omitempty"`
Sniper bool `json:"sniper,omitempty"`
AI bool `json:"ai,omitempty"`
Deep bool `json:"deep,omitempty"`
}
func (ScanRequest) AnalysisOptions ¶
func (r ScanRequest) AnalysisOptions() (verify, sniper, deep bool)
type ScanStatus ¶
type ScanStatus string
const ( StatusQueued ScanStatus = "queued" StatusRunning ScanStatus = "running" StatusCompleted ScanStatus = "completed" StatusFailed ScanStatus = "failed" StatusCanceled ScanStatus = "canceled" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(cfg ServiceConfig) *Service
func (*Service) CancelScan ¶
func (*Service) GetLLMConfig ¶
func (*Service) SaveLLMConfig ¶
func (*Service) SetAgentPool ¶
func (*Service) Status ¶
func (s *Service) Status() ServiceStatus
type ServiceConfig ¶
type ServiceStatus ¶
type ServiceStatus struct {
LLMAvailable bool `json:"llm_available"`
LLMProvider string `json:"llm_provider,omitempty"`
LLMModel string `json:"llm_model,omitempty"`
LLMAPIKeyConfigured bool `json:"llm_api_key_configured,omitempty"`
ConfigPath string `json:"config_path,omitempty"`
ConfigLoaded bool `json:"config_loaded"`
Agents int `json:"agents"`
}