summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/encode/brotli
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/encode/brotli')
-rw-r--r--modules/caddyhttp/encode/brotli/brotli_precompressed.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/caddyhttp/encode/brotli/brotli_precompressed.go b/modules/caddyhttp/encode/brotli/brotli_precompressed.go
new file mode 100644
index 0000000..fbd0441
--- /dev/null
+++ b/modules/caddyhttp/encode/brotli/brotli_precompressed.go
@@ -0,0 +1,31 @@
+package caddybrotli
+
+import (
+ "github.com/caddyserver/caddy/v2"
+ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode"
+)
+
+func init() {
+ caddy.RegisterModule(BrotliPrecompressed{})
+}
+
+// BrotliPrecompressed provides the file extension for files precompressed with brotli encoding.
+type BrotliPrecompressed struct{}
+
+// CaddyModule returns the Caddy module information.
+func (BrotliPrecompressed) CaddyModule() caddy.ModuleInfo {
+ return caddy.ModuleInfo{
+ ID: "http.precompressed.br",
+ New: func() caddy.Module { return new(BrotliPrecompressed) },
+ }
+}
+
+// AcceptEncoding returns the name of the encoding as
+// used in the Accept-Encoding request headers.
+func (BrotliPrecompressed) AcceptEncoding() string { return "br" }
+
+// Suffix returns the filename suffix of precompressed files.
+func (BrotliPrecompressed) Suffix() string { return ".br" }
+
+// Interface guards
+var _ encode.Precompressed = (*BrotliPrecompressed)(nil)