This commit is contained in:
Yusef Napora 2019-11-08 11:42:36 -05:00
parent 2ebfd9d4f2
commit c016eb5a80
3 changed files with 12 additions and 12 deletions

View File

@ -20,11 +20,11 @@ type SignedEnvelope struct {
// A binary identifier that indicates what kind of data is contained in the payload.
// TODO(yusef): enforce multicodec prefix
TypeHint []byte
TypeHint []byte
// The envelope payload. This is private to discourage accessing the payload without verifying the signature.
// To access, use the Open method.
contents []byte
contents []byte
// The signature of the domain string, type hint, and contents.
signature []byte
@ -91,8 +91,8 @@ func (e *SignedEnvelope) Marshal() ([]byte, error) {
}
msg := pb.SignedEnvelope{
PublicKey: key,
TypeHint: e.TypeHint,
Contents: e.contents,
TypeHint: e.TypeHint,
Contents: e.contents,
Signature: e.signature,
}
return proto.Marshal(&msg)

View File

@ -5,8 +5,8 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
ma "github.com/multiformats/go-multiaddr"
pb "github.com/libp2p/go-libp2p-core/routing/pb"
ma "github.com/multiformats/go-multiaddr"
"time"
)
@ -47,8 +47,8 @@ func RoutingStateFromAddrInfo(info *peer.AddrInfo) *RoutingState {
annotated[i] = &AnnotatedAddr{Multiaddr: a}
}
return &RoutingState{
PeerID: info.ID,
Seq: statelessSeqNo(),
PeerID: info.ID,
Seq: statelessSeqNo(),
Addresses: annotated,
}
}
@ -106,8 +106,8 @@ func (s *RoutingState) Marshal() ([]byte, error) {
return nil, err
}
msg := pb.RoutingStateRecord{
PeerId: id,
Seq: s.Seq,
PeerId: id,
Seq: s.Seq,
Addresses: addrsToProtobuf(s.Addresses),
}
return proto.Marshal(&msg)