cuhttp

package
v1.28.3 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0, MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedCORSOrigins added in v1.28.3

func AllowedCORSOrigins(domainName string) []string

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

func CORS(allowedOrigins []string) func(http.Handler) http.Handler

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

func Compression(cfg *config.CompressionConfig) (func(http.Handler) http.Handler, error)

Compression wraps handlers with gzip/brotli/deflate based on config levels.

func LoggingMiddleware added in v1.28.3

func LoggingMiddleware(next http.Handler) http.Handler

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

func MountRetrievalPublicRoutes(ctx context.Context, r *chi.Mux, d *deps.Deps) *denylist.Filter

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

func MountStandardRoutes(r chi.Router)

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

func SecureHeaders(csp string) func(http.Handler) http.Handler

SecureHeaders adds standard browser security headers.

func StartHTTPServer

func StartHTTPServer(ctx context.Context, d *deps.Deps, sd *ServiceDeps) error

StartHTTPServer starts the public-facing server for market calls.

func StartServer added in v1.28.3

func StartServer(ctx context.Context, cfg *config.HTTPConfig, db *harmonydb.DB, handler http.Handler, label string) error

StartServer runs cfg's public HTTPS (or delegated HTTP) listener until ctx is cancelled.

Types

type AutocertCache added in v1.28.3

type AutocertCache struct {
	DB *harmonydb.DB
}

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

func (AutocertCache) Get added in v1.28.3

func (c AutocertCache) Get(ctx context.Context, key string) ([]byte, error)

func (AutocertCache) Put added in v1.28.3

func (c AutocertCache) Put(ctx context.Context, key string, data []byte) 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
}

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.

Jump to

Keyboard shortcuts

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