Documentation
¶
Index ¶
- func AllowedCORSOrigins(domainName string) []string
- func CORS(allowedOrigins []string) func(http.Handler) http.Handler
- func Compression(cfg *config.CompressionConfig) (func(http.Handler) http.Handler, error)
- func LoggingMiddleware(next http.Handler) http.Handler
- func MountCommonPublicRoutes(ctx context.Context, r *chi.Mux, d *deps.Deps) (*ipni_provider.Provider, error)
- func MountRetrievalPublicRoutes(ctx context.Context, r *chi.Mux, d *deps.Deps) *denylist.Filter
- func MountStandardRoutes(r chi.Router)
- func NewRouter(cfg RouterConfig) *chi.Mux
- func SecureHeaders(csp string) func(http.Handler) http.Handler
- func StartHTTPServer(ctx context.Context, d *deps.Deps, sd *ServiceDeps) error
- func StartServer(ctx context.Context, cfg *config.HTTPConfig, db *harmonydb.DB, ...) error
- type AutocertCache
- type RouterConfig
- type RouterMap
- type ServiceDeps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowedCORSOrigins ¶ added in v1.28.3
AllowedCORSOrigins returns the public API CORS allowlist. DEV_CURIO_EXTERNAL_URL overrides the default https://{domainName} origin for local dev.
func CORS ¶ added in v1.28.3
CORS allows cross-origin API calls from AllowedCORSOrigins (e.g. market and PDP piece uploads). Exposes the Location header so clients can read redirect targets after upload.
func Compression ¶ added in v1.28.3
Compression wraps handlers with gzip/brotli/deflate based on config levels.
func LoggingMiddleware ¶ added in v1.28.3
LoggingMiddleware attaches request timing for debug logs.
func MountCommonPublicRoutes ¶ added in v1.28.3
func MountCommonPublicRoutes(ctx context.Context, r *chi.Mux, d *deps.Deps) (*ipni_provider.Provider, error)
MountCommonPublicRoutes mounts public endpoints shared by curio and skiff: piece/IPFS retrieval with bad-bits denylist filtering, and IPNI provider routes. The returned IPNI provider is started for publishing and can be passed to PDP route mounting.
func MountRetrievalPublicRoutes ¶ added in v1.28.3
MountRetrievalPublicRoutes mounts piece/IPFS retrieval with bad-bits denylist filtering. Skiff and full Curio both use this; tests can mount it without standing up IPNI.
func MountStandardRoutes ¶ added in v1.28.3
MountStandardRoutes registers health and version endpoints shared by public servers.
func NewRouter ¶ added in v1.28.3
func NewRouter(cfg RouterConfig) *chi.Mux
NewRouter builds a chi router with the standard public-server middleware.
func SecureHeaders ¶ added in v1.28.3
SecureHeaders adds standard browser security headers.
func StartHTTPServer ¶
StartHTTPServer starts the public-facing server for market calls.
Types ¶
type AutocertCache ¶ added in v1.28.3
AutocertCache stores Let's Encrypt certificates in harmonydb.
func (AutocertCache) Delete ¶ added in v1.28.3
func (c AutocertCache) Delete(ctx context.Context, key string) error
type RouterConfig ¶ added in v1.28.3
type RouterConfig struct {
// CSP enables secure response headers when non-empty (market server only).
CSP string
// DomainName is used to derive the default allowed CORS origin (https://{DomainName}).
DomainName string
}
RouterConfig configures the shared public HTTP router middleware stack.
type RouterMap ¶
type RouterMap map[string]http.HandlerFunc
RouterMap is the map that allows the library user to pass in their own routes
type ServiceDeps ¶ added in v1.25.1
type ServiceDeps struct {
servicedeps.Deps
DealMarket *storage_market.CurioStorageDealMarket
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package servicedeps holds shared HTTP service dependency handles without pulling in the full cuhttp server / deal-market dependency graph.
|
Package servicedeps holds shared HTTP service dependency handles without pulling in the full cuhttp server / deal-market dependency graph. |