Documentation
¶
Overview ¶
Package server provides the Fiber HTTP server with built-in middleware, TLS, and security features.
Index ¶
- func Duration(s string, fallback time.Duration) time.Duration
- type AutocertTLS
- type CORSConfig
- type Config
- type ContentSecurityConf
- type CorrelationConfig
- type CryptionConf
- type EncryptCookieConf
- type ErrorResponse
- type LocalStorage
- type ManualTLS
- type PoolConfig
- type Presigner
- type RouteConfig
- type S3Config
- type S3Storage
- func (s *S3Storage) Delete(ctx context.Context, key string) error
- func (s *S3Storage) Download(ctx context.Context, key string) (io.ReadCloser, error)
- func (s *S3Storage) PresignTTL() time.Duration
- func (s *S3Storage) PresignURL(ctx context.Context, key string, ttl time.Duration) (string, error)
- func (s *S3Storage) Upload(ctx context.Context, key string, reader io.Reader, size int64, ...) error
- type SecurityConfig
- type Server
- type StorageBackend
- type TLSConfig
- type TelemetryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AutocertTLS ¶ added in v0.1.0
type CORSConfig ¶
type Config ¶
type Config struct {
Port int
Host string
Prefork bool
BodyLimit int
Timeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
MaxConns int
MaxBytes int
MetricsPath string
HealthPath string
ShutdownTimeout time.Duration
RecoverStack bool
APIPrefix string
Routes []RouteConfig
Logger bool
LoadShedding bool
Breaker bool
Compression bool
StreamRequestBody bool
ReduceMemoryUsage bool
// Security
SecurityHeaders *middleware.SecurityHeadersConfig
CSRF *middleware.CSRFConfig
RateLimit *middleware.RateLimitConfig
TLS *TLSConfig
SSRF *middleware.SSRFConfig
// Correlation enables the X-Correlation-ID tracking middleware.
Correlation *CorrelationConfig
// Logger config
LogSkipPaths []string
LogSampleRate float64
}
func DefaultConfig ¶
func DefaultConfig() Config
type ContentSecurityConf ¶
type CorrelationConfig ¶ added in v0.11.0
type CryptionConf ¶
type EncryptCookieConf ¶ added in v0.8.0
type ErrorResponse ¶
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
func NewLocalStorage ¶
func NewLocalStorage(root string) (*LocalStorage, error)
func (*LocalStorage) Download ¶
func (l *LocalStorage) Download(_ context.Context, key string) (io.ReadCloser, error)
type PoolConfig ¶ added in v0.6.0
type Presigner ¶ added in v0.6.0
type Presigner interface {
PresignURL(ctx context.Context, key string, ttl time.Duration) (string, error)
}
Presigner generates presigned URLs for direct client access. Optional extension of StorageBackend for S3-compatible storage.
type RouteConfig ¶
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
func NewS3Storage ¶
func (*S3Storage) PresignTTL ¶ added in v0.9.0
func (*S3Storage) PresignURL ¶ added in v0.6.0
type SecurityConfig ¶
type SecurityConfig struct {
ContentSecurity *ContentSecurityConf
Cryption *CryptionConf
EncryptCookie *EncryptCookieConf
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg Config, telemetry TelemetryConfig, security SecurityConfig, corsCfg *CORSConfig) *Server
type StorageBackend ¶
type StorageBackend interface {
Upload(ctx context.Context, key string, reader io.Reader, size int64, contentType string) error
Download(ctx context.Context, key string) (io.ReadCloser, error)
Delete(ctx context.Context, key string) error
}
StorageBackend abstracts file storage operations.
type TLSConfig ¶ added in v0.1.0
type TLSConfig struct {
Enabled bool `json:"enabled"`
Manual *ManualTLS `json:"manual" config:",optional"`
Autocert *AutocertTLS `json:"autocert" config:",optional"`
MinVersion string `json:"min_version" config:",optional"`
MaxVersion string `json:"max_version" config:",optional"`
CurvePrefs []string `json:"curve_preferences" config:",optional"`
CipherSuites []string `json:"cipher_suites" config:",optional"`
RedirectHTTP bool `json:"redirect_http" config:",optional"`
RedirectPort int `json:"redirect_port" config:",optional"`
}
Directories
¶
| Path | Synopsis |
|---|---|
|
auth
|
|
|
jwks
Package jwks provides JWKS key resolution for JWT signature validation.
|
Package jwks provides JWKS key resolution for JWT signature validation. |
|
openfga
Package openfga provides the OpenFGA authorization client.
|
Package openfga provides the OpenFGA authorization client. |
|
ory
Package ory provides Ory Kratos authentication and Keto authorization client.
|
Package ory provides Ory Kratos authentication and Keto authorization client. |
|
zitadel
Package zitadel provides Zitadel OIDC authentication and JWKS-based JWT validation.
|
Package zitadel provides Zitadel OIDC authentication and JWKS-based JWT validation. |
|
Package middleware provides Fiber HTTP middlewares for auth, security, validation, rate limiting, and more.
|
Package middleware provides Fiber HTTP middlewares for auth, security, validation, rate limiting, and more. |
Click to show internal directories.
Click to hide internal directories.