Documentation
¶
Overview ¶
Package route implements the CoreC RESTful API gateway: HTTP routing, middleware (CORS, rate limiting, authentication, request metrics), request handlers, WebSocket streams, and Prometheus-format metrics exposition.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ReloadFunc func(path, payload string) error PatchFunc func(patch map[string]any) error GetConfigFunc func() *core.Config GetRawConfigFunc func() (string, error) // Path A: GET /configs/raw — full redacted YAML ValidateFunc func(payload string) ([]string, error) // Path A: POST /configs/validate — dry-run; returns idle warnings + error // Version is the build version, injected via ldflags: // -ldflags "-X github.com/CoreC-Dev/CoreC/hub/route.Version=1.0.0" // Default "dev" for local/test builds. Version = "dev" )
Functions ¶
func CloseServer ¶
func CloseServer() error
func ReCreateServer ¶
func ReCreateServer(cfg *Config)
Types ¶
type Config ¶
type Config struct {
Addr string
Secret string
// TLS support (M1). When both are set, the server uses HTTPS.
TLSCert string
TLSKey string
// AllowedOrigins restricts CORS to specific origins (M3).
// Empty means permissive default (Access-Control-Allow-Origin: *).
AllowedOrigins []string
// RateLimitPerSec limits requests per second per IP (M2).
// 0 means no limit.
RateLimitPerSec int
// HTTP server timeouts. Zero values fall back to defaults, except for
// ReadTimeout and WriteTimeout whose default is 0 (disabled) so that
// long-lived WebSocket connections are not killed by an absolute
// deadline. Set them explicitly to enable absolute deadlines.
ReadHeaderTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
// PprofDisabled controls whether pprof profiling endpoints are
// disabled. Default false (pprof enabled, backward compatible).
// Set to true to disable pprof entirely.
PprofDisabled bool
// PprofAddr, when non-empty, starts a separate HTTP server for pprof
// endpoints on this address. This keeps profiling endpoints off the
// main API port. When empty, pprof is registered on the main server
// (unless PprofDisabled is true). The separate server does NOT require
// authentication, so it should only be bound to a loopback or
// private interface.
PprofAddr string
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.