server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duration

func Duration(s string, fallback time.Duration) time.Duration

Types

type CORSConfig

type CORSConfig struct {
	Origins     []string
	Methods     []string
	Headers     []string
	Credentials bool
	MaxAge      int
}

type Config

type Config struct {
	Port            int
	Host            string
	Prefork         bool
	BodyLimit       int
	Timeout         time.Duration
	MaxConns        int
	MaxBytes        int
	MetricsPath     string
	HealthPath      string
	ShutdownTimeout time.Duration
	RecoverStack    bool
	APIPrefix       string
	Routes          []RouteConfig
}

func DefaultConfig

func DefaultConfig() Config

type ContentSecurityConf

type ContentSecurityConf struct {
	Enabled   bool
	Strict    bool
	PublicKey string
}

type CryptionConf

type CryptionConf struct {
	Enabled bool
	Key     string
}

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type LocalStorage

type LocalStorage struct {
	// contains filtered or unexported fields
}

func NewLocalStorage

func NewLocalStorage(root string) (*LocalStorage, error)

func (*LocalStorage) Delete

func (l *LocalStorage) Delete(ctx context.Context, key string) error

func (*LocalStorage) Download

func (l *LocalStorage) Download(ctx context.Context, key string) (io.ReadCloser, error)

func (*LocalStorage) Upload

func (l *LocalStorage) Upload(ctx context.Context, key string, reader io.Reader, _ int64, _ string) error

type RouteConfig

type RouteConfig struct {
	Path       string
	Middleware []string // middleware names: logger, shedding, breaker, maxconns, maxbytes, gunzip, prometheus, trace, cors, jwt, content_security, cryption
}

type S3Config

type S3Config struct {
	Endpoint        string
	Region          string
	Bucket          string
	AccessKeyID     string
	SecretAccessKey string
	UseSSL          bool
}

type S3Storage

type S3Storage struct {
	// contains filtered or unexported fields
}

func NewS3Storage

func NewS3Storage(cfg S3Config) (*S3Storage, error)

func (*S3Storage) Delete

func (s *S3Storage) Delete(ctx context.Context, key string) error

func (*S3Storage) Download

func (s *S3Storage) Download(ctx context.Context, key string) (io.ReadCloser, error)

func (*S3Storage) Upload

func (s *S3Storage) Upload(ctx context.Context, key string, reader io.Reader, size int64, contentType string) error

type SecurityConfig

type SecurityConfig struct {
	ContentSecurity *ContentSecurityConf
	Cryption        *CryptionConf
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config, telemetry TelemetryConfig, security SecurityConfig, corsCfg *CORSConfig) *Server

func (*Server) App

func (s *Server) App() *fiber.App

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop()

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 TelemetryConfig

type TelemetryConfig struct {
	Enabled  bool
	Name     string
	Endpoint string
	Sampler  float64
	Batcher  string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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