Documentation
¶
Overview ¶
Package api — HTTP response helpers, pagination, and query parameter utilities.
Package api - HTTP route configuration for the Scanorama API server.
Package api provides HTTP REST API functionality for the Scanorama network scanner. It implements endpoints for scanning, discovery, host management, and system status.
Index ¶
- func SetBuildInfo(version, commit, buildTime string)
- type Config
- type ErrorResponse
- type Server
- func (s *Server) GetAddress() string
- func (s *Server) GetRouter() *mux.Router
- func (s *Server) IsRunning() bool
- func (s *Server) ParseJSON(r *http.Request, v interface{}) error
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop() error
- func (s *Server) WriteJSON(w http.ResponseWriter, r *http.Request, statusCode int, data interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetBuildInfo ¶ added in v0.16.0
func SetBuildInfo(version, commit, buildTime string)
SetBuildInfo sets the build information for use in status and version handlers.
Types ¶
type Config ¶
type Config struct {
Host string `yaml:"host" json:"host"`
Port int `yaml:"port" json:"port"`
ReadTimeout time.Duration `yaml:"read_timeout" json:"read_timeout"`
WriteTimeout time.Duration `yaml:"write_timeout" json:"write_timeout"`
IdleTimeout time.Duration `yaml:"idle_timeout" json:"idle_timeout"`
MaxHeaderBytes int `yaml:"max_header_bytes" json:"max_header_bytes"`
EnableCORS bool `yaml:"enable_cors" json:"enable_cors"`
CORSOrigins []string `yaml:"cors_origins" json:"cors_origins"`
RateLimitEnabled bool `yaml:"rate_limit_enabled" json:"rate_limit_enabled"`
RateLimitRequests int `yaml:"rate_limit_requests" json:"rate_limit_requests"`
RateLimitWindow time.Duration `yaml:"rate_limit_window" json:"rate_limit_window"`
AuthEnabled bool `yaml:"auth_enabled" json:"auth_enabled"`
APIKeys []string `yaml:"api_keys" json:"api_keys"`
}
Config holds API server configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns default API server configuration.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Timestamp time.Time `json:"timestamp"`
RequestID string `json:"request_id,omitempty"`
}
ErrorResponse represents a standard API error response.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the API server.
func (*Server) GetAddress ¶
GetAddress returns the server address.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package handlers provides HTTP request handlers for the Scanorama API.
|
Package handlers provides HTTP request handlers for the Scanorama API. |
|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
Package middleware provides HTTP middleware functions for the Scanorama API server.
|
Package middleware provides HTTP middleware functions for the Scanorama API server. |
Click to show internal directories.
Click to hide internal directories.