feat(18-02): REST API handlers for /api/v1/* endpoints
- Stats, keys, providers, scan, recon, dorks, config endpoints - JSON response wrappers with proper tags for all entities - Filtering, pagination, 404/204/202 status codes - SSE hub stub (full impl in task 2) - Resolved merge conflict in schema.sql - 16 passing tests covering all endpoints
This commit is contained in:
34
pkg/web/server.go
Normal file
34
pkg/web/server.go
Normal file
@@ -0,0 +1,34 @@
|
||||
// Package web implements the KeyHunter embedded web dashboard and REST API.
|
||||
package web
|
||||
|
||||
import (
|
||||
"github.com/salvacybersec/keyhunter/pkg/dorks"
|
||||
"github.com/salvacybersec/keyhunter/pkg/engine"
|
||||
"github.com/salvacybersec/keyhunter/pkg/providers"
|
||||
"github.com/salvacybersec/keyhunter/pkg/recon"
|
||||
"github.com/salvacybersec/keyhunter/pkg/storage"
|
||||
)
|
||||
|
||||
// ServerConfig holds all dependencies injected into the web Server.
|
||||
type ServerConfig struct {
|
||||
DB *storage.DB
|
||||
EncKey []byte
|
||||
Providers *providers.Registry
|
||||
Dorks *dorks.Registry
|
||||
ScanEngine *engine.Engine
|
||||
ReconEngine *recon.Engine
|
||||
}
|
||||
|
||||
// Server is the central HTTP server holding all handler dependencies.
|
||||
type Server struct {
|
||||
cfg ServerConfig
|
||||
sse *SSEHub
|
||||
}
|
||||
|
||||
// NewServer creates a Server with the given configuration.
|
||||
func NewServer(cfg ServerConfig) *Server {
|
||||
return &Server{
|
||||
cfg: cfg,
|
||||
sse: NewSSEHub(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user