Documentation ¶
Index ¶
- Constants
- func NewHandler(options HandlerOptions) http.Handler
- func NewProxyHandler(badGatewayPage string, forwardHeaders bool) http.Handler
- func NewStashingWriter(limit int, dest io.Writer) *stashingWriter
- func ProxyErrorHandler(badGatewayPage string) func(w http.ResponseWriter, r *http.Request, err error)
- func Shutdown() int
- type Cache
- type CacheHandler
- type CacheKey
- type CacheableResponse
- func (c *CacheableResponse) CacheStatus() (bool, time.Time)
- func (c *CacheableResponse) Header() http.Header
- func (c *CacheableResponse) ToBuffer() ([]byte, error)
- func (c *CacheableResponse) Write(bytes []byte) (int, error)
- func (c *CacheableResponse) WriteCachedResponse(w http.ResponseWriter, r *http.Request)
- func (c *CacheableResponse) WriteHeader(statusCode int)
- type Config
- type GetCurrentTime
- type HandlerOptions
- type LoggingMiddleware
- type MemoryCache
- type MemoryCacheEntry
- type MemoryCacheEntryMap
- type MemoryCacheKeyList
- type Monitor
- type Route
- type Router
- type SendfileHandler
- type Server
- type Service
- type Settings
- type UpstreamProcess
- type Variant
Constants ¶
View Source
const ( KB = 1024 MB = 1024 * KB ENV_PREFIX = "THRUSTER_" )
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(options HandlerOptions) http.Handler
func NewProxyHandler ¶
func NewStashingWriter ¶
func ProxyErrorHandler ¶
Types ¶
type CacheHandler ¶
type CacheHandler struct {
// contains filtered or unexported fields
}
func NewCacheHandler ¶
func NewCacheHandler(cache Cache, maxBodySize int, next http.Handler) *CacheHandler
func (*CacheHandler) ServeHTTP ¶
func (h *CacheHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type CacheableResponse ¶
type CacheableResponse struct { StatusCode int HttpHeader http.Header Body []byte VariantHeader http.Header // contains filtered or unexported fields }
func CacheableResponseFromBuffer ¶
func CacheableResponseFromBuffer(b []byte) (CacheableResponse, error)
func NewCacheableResponse ¶
func NewCacheableResponse(w http.ResponseWriter, maxBodyLength int) *CacheableResponse
func (*CacheableResponse) CacheStatus ¶
func (c *CacheableResponse) CacheStatus() (bool, time.Time)
func (*CacheableResponse) Header ¶
func (c *CacheableResponse) Header() http.Header
func (*CacheableResponse) ToBuffer ¶
func (c *CacheableResponse) ToBuffer() ([]byte, error)
func (*CacheableResponse) WriteCachedResponse ¶
func (c *CacheableResponse) WriteCachedResponse(w http.ResponseWriter, r *http.Request)
func (*CacheableResponse) WriteHeader ¶
func (c *CacheableResponse) WriteHeader(statusCode int)
type Config ¶
type Config struct { TargetPort int `yaml:"target_port"` UpstreamCommand string `yaml:"upstream_command"` UpstreamArgs []string `yaml:"upstream_args"` CacheSizeBytes int `yaml:"cache_size_bytes"` MaxCacheItemSizeBytes int `yaml:"max_cache_item_size_bytes"` XSendfileEnabled bool `yaml:"x_sendfile_enabled"` MaxRequestBody int `yaml:"max_request_body"` BadGatewayPage string `yaml:"bad_gateway_page"` HttpPort int `yaml:"http_port"` HttpIdleTimeout time.Duration `yaml:"http_idle_timeout"` HttpReadTimeout time.Duration `yaml:"http_read_timeout"` HttpWriteTimeout time.Duration `yaml:"http_write_timeout"` HealthCheckPath string `yaml:"health_check_path"` LogLevel slog.Level `yaml:"log_level"` }
type GetCurrentTime ¶
type HandlerOptions ¶
type HandlerOptions struct {
// contains filtered or unexported fields
}
type LoggingMiddleware ¶
type LoggingMiddleware struct {
// contains filtered or unexported fields
}
func NewLoggingMiddleware ¶
func NewLoggingMiddleware(logger *slog.Logger, next http.Handler) *LoggingMiddleware
func (*LoggingMiddleware) ServeHTTP ¶
func (h *LoggingMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MemoryCache ¶
func NewMemoryCache ¶
func NewMemoryCache(capacity, maxItemSize int) *MemoryCache
type MemoryCacheEntry ¶
type MemoryCacheEntry struct {
// contains filtered or unexported fields
}
type MemoryCacheEntryMap ¶
type MemoryCacheEntryMap map[CacheKey]*MemoryCacheEntry
type MemoryCacheKeyList ¶
type MemoryCacheKeyList []CacheKey
type Monitor ¶ added in v0.0.4
func NewMonitor ¶ added in v0.0.4
type Route ¶ added in v0.0.4
type SendfileHandler ¶
type SendfileHandler struct {
// contains filtered or unexported fields
}
func NewSendfileHandler ¶
func NewSendfileHandler(enabled bool, next http.Handler) *SendfileHandler
func (*SendfileHandler) ServeHTTP ¶
func (h *SendfileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) HealthCheck ¶ added in v0.0.4
type UpstreamProcess ¶
type UpstreamProcess struct { Started chan struct{} // contains filtered or unexported fields }
func NewUpstreamProcess ¶
func NewUpstreamProcess(name string, arg ...string) *UpstreamProcess
func (*UpstreamProcess) Start ¶ added in v0.0.4
func (p *UpstreamProcess) Start() error
func (*UpstreamProcess) Stop ¶ added in v0.0.4
func (p *UpstreamProcess) Stop() (int, error)
type Variant ¶
type Variant struct {
// contains filtered or unexported fields
}
func NewVariant ¶
func (*Variant) SetResponseHeader ¶
func (*Variant) VariantHeader ¶
Click to show internal directories.
Click to hide internal directories.