Documentation
¶
Index ¶
- Constants
- func NewCompressionGuardHandler(next http.Handler) http.Handler
- func NewCompressionHandler(jitter int, disableOnAuth bool, next http.Handler) http.Handler
- func NewHandler(options HandlerOptions) http.Handler
- func NewProxyHandler(targetUrl *url.URL, badGatewayPage string, forwardHeaders bool) http.Handler
- func NewRequestStartHandler(next http.Handler) 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) Flush()
- 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 LoggingHandler
- 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 NewCompressionGuardHandler ¶ added in v0.1.17
func NewCompressionHandler ¶ added in v0.1.17
func NewHandler ¶
func NewHandler(options HandlerOptions) http.Handler
func NewProxyHandler ¶
func NewRequestStartHandler ¶ added in v0.1.17
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) Flush ¶ added in v0.1.15
func (c *CacheableResponse) Flush()
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
GzipCompressionEnabled bool
GzipCompressionDisableOnAuth bool
GzipCompressionJitter int
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
H2CEnabled bool
ForwardHeaders bool
LogLevel slog.Level
LogRequests bool
}
type GetCurrentTime ¶
type HandlerOptions ¶
type HandlerOptions struct {
// contains filtered or unexported fields
}
type LoggingHandler ¶ added in v0.1.17
type LoggingHandler struct {
// contains filtered or unexported fields
}
func NewLoggingHandler ¶ added in v0.1.17
func NewLoggingHandler(logger *slog.Logger, next http.Handler) *LoggingHandler
func (*LoggingHandler) ServeHTTP ¶ added in v0.1.17
func (h *LoggingHandler) 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.