rpc/codec/codec.go

24 lines
399 B
Go
Raw Normal View History

2017-11-26 10:15:51 +00:00
package codec
import "io"
// Codec interface contains the encoder for response or decoder for request.
// Eg. gzip, flate compressions.
type Codec interface {
Encode(w io.Writer) io.Writer
Decode(r io.Reader) io.Reader
}
type codec struct {
}
func (_ *codec) Encode(w io.Writer) io.Writer {
return w
}
func (_ *codec) Decode(r io.Reader) io.Reader {
return r
}
var DefaultCodec = &codec{}