mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2024-12-27 23:40:16 +08:00
4c43736fe9
Introduces custom types in protobuf to serde directly into multiaddrs and peer IDs. Simplify purge by ordering addrs by expiry. In general, getting this readier for merge.
28 lines
720 B
Protocol Buffer
28 lines
720 B
Protocol Buffer
syntax = "proto3";
|
|
package pstore.pb;
|
|
|
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
|
|
|
option (gogoproto.benchgen_all) = true;
|
|
option (gogoproto.populate_all) = true;
|
|
|
|
// AddrBookRecord represents a record for a peer in the address book.
|
|
message AddrBookRecord {
|
|
// The peer ID.
|
|
bytes id = 1 [(gogoproto.customtype) = "ProtoPeerID"];
|
|
|
|
// The multiaddresses. This is a sorted list where element 0 expires the soonest.
|
|
repeated AddrEntry addrs = 2;
|
|
|
|
// AddrEntry represents a single multiaddress.
|
|
message AddrEntry {
|
|
bytes addr = 1 [(gogoproto.customtype) = "ProtoAddr"];
|
|
|
|
// The point in time when this address expires.
|
|
int64 expiry = 2;
|
|
|
|
// The original TTL of this address.
|
|
int64 ttl = 3;
|
|
}
|
|
}
|