Rename node.Decode and node.Encode
EncodeMeta and DecodeMeta are more explicit.
This commit is contained in:
@ -26,8 +26,8 @@ func (n *Node) String() string {
|
||||
return n.Addr.String()
|
||||
}
|
||||
|
||||
// Encode the node metadata to bytes, in a deterministic reversible way
|
||||
func (n *Node) Encode(limit int) ([]byte, error) {
|
||||
// EncodeMeta the node metadata to bytes, in a deterministic reversible way
|
||||
func (n *Node) EncodeMeta(limit int) ([]byte, error) {
|
||||
buf := &bytes.Buffer{}
|
||||
if err := gob.NewEncoder(buf).Encode(n.nodeMeta); err != nil {
|
||||
return nil, errors.Wrap(err, "could not encode local state")
|
||||
@ -38,8 +38,8 @@ func (n *Node) Encode(limit int) ([]byte, error) {
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
// Decode the node Meta field into its metadata
|
||||
func (n *Node) Decode() error {
|
||||
// DecodeMeta the node Meta field into its metadata
|
||||
func (n *Node) DecodeMeta() error {
|
||||
// TODO: we blindly trust the info we get from the peers; We should be more defensive to limit the damage a leaked
|
||||
// PSK can cause.
|
||||
nm := nodeMeta{}
|
||||
|
Reference in New Issue
Block a user