apiv1

package
v0.0.0-...-284c1ef Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API represents the main API v1 instance

func NewAPI

func NewAPI(config *Config, services Services, logger logrus.FieldLogger) (*API, error)

NewAPI creates a new API instance with all components initialized

func (*API) GetAdapters

func (a *API) GetAdapters() *adapters.CompositeAdapter

GetAdapters returns the composite adapter

func (*API) GetConfig

func (a *API) GetConfig() *Config

GetConfig returns the API configuration

func (*API) GetHandlers

func (a *API) GetHandlers() *handlers.Handlers

GetHandlers returns the handlers instance

func (*API) GetRouter

func (a *API) GetRouter() chi.Router

GetRouter returns the configured Chi router

func (*API) GetSSEManager

func (a *API) GetSSEManager() *sse.Manager

GetSSEManager returns the SSE manager instance

func (*API) IsRunning

func (a *API) IsRunning() bool

IsRunning returns whether the API is currently running

func (*API) Start

func (a *API) Start(ctx context.Context) error

Start initializes and starts the API services

func (*API) Stop

func (a *API) Stop(ctx context.Context) error

Stop gracefully shuts down the API services

type Config

type Config struct {
	// Authentication configuration
	EnableAuth bool              `yaml:"enable_auth" json:"enable_auth"`
	JWTSecret  string            `yaml:"jwt_secret" json:"jwt_secret"`
	APIKeys    map[string]string `yaml:"api_keys" json:"api_keys"`

	// CORS configuration
	CORSOrigins      []string `yaml:"cors_origins" json:"cors_origins"`
	EnableCORS       bool     `yaml:"enable_cors" json:"enable_cors"`
	CORSAllowHeaders []string `yaml:"cors_allow_headers" json:"cors_allow_headers"`
	CORSAllowMethods []string `yaml:"cors_allow_methods" json:"cors_allow_methods"`

	// Rate limiting configuration
	RateLimit       int           `yaml:"rate_limit" json:"rate_limit"`
	RateLimitBurst  int           `yaml:"rate_limit_burst" json:"rate_limit_burst"`
	RateLimitWindow time.Duration `yaml:"rate_limit_window" json:"rate_limit_window"`

	// Request size limits
	MaxRequestSize int64 `yaml:"max_request_size" json:"max_request_size"`

	// SSE configuration
	SSEEnabled bool       `yaml:"sse_enabled" json:"sse_enabled"`
	SSEConfig  sse.Config `yaml:"sse_config" json:"sse_config"`

	// Middleware configuration
	EnableTracing        bool          `yaml:"enable_tracing" json:"enable_tracing"`
	EnableMetrics        bool          `yaml:"enable_metrics" json:"enable_metrics"`
	EnableRequestLogging bool          `yaml:"enable_request_logging" json:"enable_request_logging"`
	RequestTimeout       time.Duration `yaml:"request_timeout" json:"request_timeout"`

	// Validation configuration
	StrictValidation       bool `yaml:"strict_validation" json:"strict_validation"`
	AllowUnknownFields     bool `yaml:"allow_unknown_fields" json:"allow_unknown_fields"`
	EnableSchemaValidation bool `yaml:"enable_schema_validation" json:"enable_schema_validation"`
}

Config holds API configuration options

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns sensible defaults for API configuration

type Services

type Services struct {
	// Core services
	Bot             service.BotService
	Job             service.JobService
	Campaign        common.CampaignService
	Corpus          common.CorpusService
	Result          service.ResultService
	System          service.SystemService
	Monitoring      service.MonitoringService
	Reproducibility common.ReproducibilityService
	CrashMinimizer  common.CrashMinimizerService
	Deduplication   common.DeduplicationService
	Analytics       service.AnalyticsService

	// Storage
	Storage     common.Storage
	FileStorage common.FileStorage

	// Repositories
	BotRepo      botRepo.AgentRepository
	JobRepo      jobRepo.JobRepository
	CampaignRepo campaignRepo.CampaignRepository
	CrashRepo    crashRepo.CrashRepository

	// Domain services
	BotRegistry *registry.Service
	Executor    executor.Executor
}

Services represents the domain services needed by the API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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