mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-12 05:23:42 +08:00
24 lines
487 B
Go
24 lines
487 B
Go
|
package caddystd
|
||
|
|
||
|
import (
|
||
|
"github.com/caddyserver/caddy2"
|
||
|
"github.com/caddyserver/caddy2/modules/caddyhttp/encode"
|
||
|
"github.com/klauspost/compress/zstd"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
caddy2.RegisterModule(caddy2.Module{
|
||
|
Name: "http.encoders.zstd",
|
||
|
New: func() interface{} { return new(Zstd) },
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// Zstd can create zstd encoders.
|
||
|
type Zstd struct{}
|
||
|
|
||
|
// NewEncoder returns a new gzip writer.
|
||
|
func (z Zstd) NewEncoder() encode.Encoder {
|
||
|
writer, _ := zstd.NewWriter(nil)
|
||
|
return writer
|
||
|
}
|