Skip to content

Commit

Permalink
Certified addresses (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusefnapora committed Mar 6, 2020
1 parent 53a6f36 commit 75bd6d5
Show file tree
Hide file tree
Showing 16 changed files with 1,010 additions and 131 deletions.
328 changes: 312 additions & 16 deletions p2p/host/peerstore/pb/pstore.pb.go

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions p2p/host/peerstore/pb/pstore.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ message AddrBookRecord {
// The multiaddresses. This is a sorted list where element 0 expires the soonest.
repeated AddrEntry addrs = 2;

// The most recently received signed PeerRecord.
CertifiedRecord certified_record = 3;

// AddrEntry represents a single multiaddress.
message AddrEntry {
bytes addr = 1 [(gogoproto.customtype) = "ProtoAddr"];
Expand All @@ -24,4 +27,14 @@ message AddrBookRecord {
// The original TTL of this address.
int64 ttl = 3;
}

// CertifiedRecord contains a serialized signed PeerRecord used to
// populate the signedAddrs list.
message CertifiedRecord {
// The Seq counter from the signed PeerRecord envelope
uint64 seq = 1;

// The serialized bytes of the SignedEnvelope containing the PeerRecord.
bytes raw = 2;
}
}
54 changes: 54 additions & 0 deletions p2p/host/peerstore/pb/pstorepb_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions p2p/host/peerstore/peerstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type peerstore struct {

// NewPeerstore creates a data structure that stores peer data, backed by the
// supplied implementations of KeyBook, AddrBook and PeerMetadata.
// Deprecated: use pstoreds.NewPeerstore or peerstoremem.NewPeerstore instead.
func NewPeerstore(kb pstore.KeyBook, ab pstore.AddrBook, pb pstore.ProtoBook, md pstore.PeerMetadata) pstore.Peerstore {
return &peerstore{
KeyBook: kb,
Expand Down
Loading

0 comments on commit 75bd6d5

Please sign in to comment.