rpc/codec/codec.go
crusader 2286a5021e ing
2017-11-26 19:15:51 +09:00

24 lines
399 B
Go

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{}