syntax = "proto3";

message Peer {
  // Multiaddrs we know about
  repeated Address addresses = 1;

  // The protocols the peer supports
  repeated string protocols = 2;

  // The public key of the peer
  optional bytes public_key = 4;

  // The most recently received signed PeerRecord
  optional bytes peer_record_envelope = 5;

  // Any peer metadata
  map<string, bytes> metadata = 6;

  // Any tags the peer has
  map<string, Tag> tags = 7;

  // timestamp in ms of when this peer was last updated
  optional uint64 updated = 8 [jstype = JS_NUMBER];
}

// Address represents a single multiaddr
message Address {
  bytes multiaddr = 1;

  // Flag to indicate if the address comes from a certified source
  optional bool isCertified = 2;

  // timestamp in ms of when this address was observed
  optional uint64 observed = 3 [jstype = JS_NUMBER];
}

message Tag {
  uint32 value = 1; // tag value 0-100
  optional uint64 expiry = 2; // ms timestamp after which the tag is no longer valid
}
