Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 02:15 UTC
| 1 | package caddybrotli |
| 2 | |
| 3 | import ( |
| 4 | "github.com/caddyserver/caddy/v2" |
| 5 | "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode" |
| 6 | ) |
| 7 | |
| 8 | func init() { |
| 9 | caddy.RegisterModule(BrotliPrecompressed{}) |
| 10 | } |
| 11 | |
| 12 | // BrotliPrecompressed provides the file extension for files precompressed with brotli encoding. |
| 13 | type BrotliPrecompressed struct{} |
| 14 | |
| 15 | // CaddyModule returns the Caddy module information. |
| 16 | func (BrotliPrecompressed) CaddyModule() caddy.ModuleInfo { |
| 17 | return caddy.ModuleInfo{ |
| 18 | ID: "http.precompressed.br", |
| 19 | New: func() caddy.Module { return new(BrotliPrecompressed) }, |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | // AcceptEncoding returns the name of the encoding as |
| 24 | // used in the Accept-Encoding request headers. |
| 25 | func (BrotliPrecompressed) AcceptEncoding() string { return "br" } |
| 26 | |
| 27 | // Suffix returns the filename suffix of precompressed files. |
| 28 | func (BrotliPrecompressed) Suffix() string { return ".br" } |
| 29 | |
| 30 | // Interface guards |
| 31 | var _ encode.Precompressed = (*BrotliPrecompressed)(nil) |