prysm-pulse/beacon-chain/p2p/encoder/network_encoding.go
Nishant Das 79e57e8e8e Add Flag for SSZ Encoding (#3256)
* add flag and enum

* change help message

* linter

* add flag

* add comment

* one more comment

* fix panic

* preston's comments

* add panic
2019-08-21 12:33:48 -04:00

24 lines
690 B
Go

package encoder
import (
"io"
"github.com/gogo/protobuf/proto"
)
// Defines the different encoding formats
const (
SSZ = "ssz" // SSZ is SSZ only.
SSZSnappy = "ssz-snappy" // SSZSnappy is SSZ with snappy compression.
)
// NetworkEncoding represents an encoder compatible with Ethereum 2.0 p2p.
type NetworkEncoding interface {
// Decode reads bytes from the reader and decodes it to the provided message.
Decode(io.Reader, proto.Message) error
// Encode an arbitrary message to the provided writer.
Encode(io.Writer, proto.Message) (int, error)
// ProtocolSuffix returns the last part of the protocol ID to indicate the encoding scheme.
ProtocolSuffix() string
}