Documentation
¶
Index ¶
Constants ¶
const ( Zstandard Provider = 1 << iota Brotli // 2 GZip // 4 Deflate // 8 Identity Provider = 0 // no encoding // capacity for 3 more encoding types @ 16, 32, 64 // // browsers don't currently support snappy, so it is isolated to ensure a full // bifurcation of web vs. general encoders, as more providers are added later Snappy Provider = 128 // for use in headers ZstandardValue = "zstd" BrotliValue = "br" GZipValue = "gzip" DeflateValue = "deflate" SnappyValue = "snappy" // might be used in configs ZstandardAltValue = "zstandard" BrotliAltValue = "brotli" )
Variables ¶
var ( AllSupportedWebProviders string AllSupportedWebProvidersBitmap Provider )
these are populated in init based on maxWebProvider, providerVals, and providerValLookup
Functions ¶
func Providers ¶
func Providers() []string
Providers returns the list of encodings that are known to be decodable in a web browser
func WebProviders ¶
func WebProviders() []string
WebProviders returns the list of encodings that are known to be decodable by web browsers. This can be overlapped with the client's accepted encodings to determine which supported encodings can be applied to the ResponseWriter
Types ¶
type DecoderInitializer ¶
type DecoderInitializer func(io.Reader) reader.ReadCloserResetter
func GetDecoderInitializer ¶
func GetDecoderInitializer(provider string) DecoderInitializer
GetDecoderInitializer returns a DecoderInitializer - one that can be passed an io.ReadCloser to get a decoder Reader for the passed Reader
func SelectDecoderInitializer ¶
func SelectDecoderInitializer(p Provider) DecoderInitializer
SelectEncoderInitializer returns an EncoderInitializer based on the provided providers bitmap
type EncoderInitializer ¶
type EncoderInitializer func(io.Writer, int) io.WriteCloser
func GetEncoderInitializer ¶
func GetEncoderInitializer(provider string) (EncoderInitializer, string)
GetEncoderInitializer returns an EncoderInitializer - one that can be passed an io.Writer to get an encoder wrapper for the passed writer, as well as an encoding value that is compatible with Content-Encoding headers
func SelectEncoderInitializer ¶
func SelectEncoderInitializer(p Provider) (EncoderInitializer, string)
SelectEncoderInitializer returns an EncoderInitializer based on the provided providers bitmap
type Provider ¶
type Provider byte
func GetCompatibleWebProviders ¶
GetCompatibleWebProviders returns the string and the bitmap of the compatible providers negotiated between Trickster and the Client. The string representation is compatible with the Accept-Encoding header
func ProviderID ¶
ProviderID returns the byte value of the provided encoding provider name