Further crufting

This commit is contained in:
Asim Aslam
2019-01-09 19:28:13 +00:00
parent 873fc6d663
commit 6e0e4a684c
6 changed files with 32 additions and 14 deletions

View File

@@ -23,13 +23,21 @@ type NewCodec func(io.ReadWriteCloser) Codec
// connection. ReadBody may be called with a nil argument to force the
// body to be read and discarded.
type Codec interface {
ReadHeader(*Message, MessageType) error
ReadBody(interface{}) error
Write(*Message, interface{}) error
Reader
Writer
Close() error
String() string
}
type Reader interface {
ReadHeader(*Message, MessageType) error
ReadBody(interface{}) error
}
type Writer interface {
Write(*Message, interface{}) error
}
// Message represents detailed information about
// the communication, likely followed by the body.
// In the case of an error, body may be nil.
@@ -42,5 +50,5 @@ type Message struct {
// The values read from the socket
Header map[string]string
Body []byte
Body []byte
}