neo-go/pkg/network/payload/payload.go
Roman Khimov 90e13debe4 network: implement getaddr sends and addr receival
Request new addresses if we're short on known addresses pool size.
2019-09-16 16:26:30 +03:00

28 lines
613 B
Go

package payload
import "io"
// Payload is anything that can be binary encoded/decoded.
type Payload interface {
EncodeBinary(io.Writer) error
DecodeBinary(io.Reader) error
}
// NullPayload is a dummy payload with no fields.
type NullPayload struct {
}
// NewNullPayload returns zero-sized stub payload.
func NewNullPayload() *NullPayload {
return &NullPayload{}
}
// DecodeBinary implements the Payload interface.
func (p *NullPayload) DecodeBinary(r io.Reader) error {
return nil
}
// EncodeBinary implements the Payload interface.
func (p *NullPayload) EncodeBinary(r io.Writer) error {
return nil
}