Documentation ¶
Index ¶
- Constants
- func NewHandler(options HandlerOptions) http.Handler
- func NewProxyHandler(targetUrl *url.URL, 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)
- 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 SendfileHandler
- type Server
- type Service
- 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 UpstreamCommand string UpstreamArgs []string CacheSizeBytes int MaxCacheItemSizeBytes int XSendfileEnabled bool MaxRequestBody int TLSDomains []string ACMEDirectoryURL string EAB_KID string EAB_HMACKey string StoragePath string BadGatewayPage string HttpPort int HttpsPort int HttpIdleTimeout time.Duration HttpReadTimeout time.Duration HttpWriteTimeout time.Duration ForwardHeaders bool LogLevel slog.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 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 UpstreamProcess ¶
type UpstreamProcess struct { Started chan struct{} // contains filtered or unexported fields }
func NewUpstreamProcess ¶
func NewUpstreamProcess(name string, arg ...string) *UpstreamProcess
func (*UpstreamProcess) Run ¶
func (p *UpstreamProcess) Run() (int, error)
type Variant ¶ added in v0.0.2
type Variant struct {
// contains filtered or unexported fields
}
func NewVariant ¶ added in v0.0.2
func (*Variant) SetResponseHeader ¶ added in v0.0.2
func (*Variant) VariantHeader ¶ added in v0.0.2
Click to show internal directories.
Click to hide internal directories.