track changes to peer records in -core

This commit is contained in:
Yusef Napora 2020-01-22 10:23:47 -05:00 committed by vyzo
parent 5b0ec14ea7
commit 919d81fd91
3 changed files with 85 additions and 74 deletions

View File

@ -3,6 +3,7 @@ package pubsub
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/libp2p/go-libp2p-core/record"
"math/rand" "math/rand"
"time" "time"
@ -13,7 +14,6 @@ import (
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore" "github.com/libp2p/go-libp2p-core/peerstore"
"github.com/libp2p/go-libp2p-core/protocol" "github.com/libp2p/go-libp2p-core/protocol"
"github.com/libp2p/go-libp2p-core/routing"
) )
const ( const (
@ -93,7 +93,7 @@ type GossipSubRouter struct {
type connectInfo struct { type connectInfo struct {
p peer.ID p peer.ID
srr *routing.SignedRoutingState spr *record.Envelope
} }
func (gs *GossipSubRouter) Protocols() []protocol.ID { func (gs *GossipSubRouter) Protocols() []protocol.ID {
@ -306,19 +306,23 @@ func (gs *GossipSubRouter) pxConnect(peers []*pb.PeerInfo) {
continue continue
} }
var srr *routing.SignedRoutingState var srr *record.Envelope
var err error if pi.SignedPeerRecord != nil {
if pi.SignedAddrs != nil {
// the peer sent us a signed record; ensure that it is valid // the peer sent us a signed record; ensure that it is valid
srr, err = routing.UnmarshalSignedRoutingState(pi.SignedAddrs) envelope, r, err := record.ConsumeEnvelope(pi.SignedPeerRecord, peer.PeerRecordEnvelopeDomain)
if err != nil { if err != nil {
log.Warningf("error unmarshalling routing record obtained through px: %s", err) log.Warningf("error unmarshalling routing record obtained through px: %s", err)
continue continue
} }
if srr.PeerID != p { rec, ok := r.(*peer.PeerRecord)
log.Warningf("bogus routing record obtained through px: peer ID %s doesn't match expected peer %s", srr.PeerID, p) if !ok {
log.Warnf("bogus routing record obtained through px: envelope payload is not PeerRecord")
}
if rec.PeerID != p {
log.Warnf("bogus routing record obtained through px: peer ID %s doesn't match expected peer %s", rec.PeerID, p)
continue continue
} }
srr = envelope
} }
toconnect = append(toconnect, connectInfo{p, srr}) toconnect = append(toconnect, connectInfo{p, srr})
@ -347,8 +351,12 @@ func (gs *GossipSubRouter) connector() {
} }
log.Debugf("connecting to %s", ci.p) log.Debugf("connecting to %s", ci.p)
if ci.srr != nil { cab, ok := peerstore.GetCertifiedAddrBook(gs.p.host.Peerstore())
gs.p.host.Peerstore().AddCertifiedAddrs(ci.srr, peerstore.TempAddrTTL) if ok && ci.spr != nil {
err := cab.ProcessPeerRecord(ci.spr, peerstore.TempAddrTTL)
if err != nil {
log.Debugf("error processing peer record: %s", err)
}
} }
ctx, cancel := context.WithTimeout(gs.p.ctx, GossipSubConnectionTimeout) ctx, cancel := context.WithTimeout(gs.p.ctx, GossipSubConnectionTimeout)
@ -822,21 +830,24 @@ func (gs *GossipSubRouter) makePrune(p peer.ID, topic string) *pb.ControlPrune {
return p != xp return p != xp
}) })
cab, peerstoreSupportsSignedAddrs := peerstore.GetCertifiedAddrBook(gs.p.host.Peerstore())
px := make([]*pb.PeerInfo, 0, len(peers)) px := make([]*pb.PeerInfo, 0, len(peers))
for _, p := range peers { for _, p := range peers {
// see if we have a signed address record to send back; if we don't, just send // see if we have a signed peer record to send back; if we don't, just send
// the peer ID and let the pruned peer find them in the DHT -- we can't trust // the peer ID and let the pruned peer find them in the DHT -- we can't trust
// unsigned address records through px anyway. // unsigned address records through px anyway.
srr := gs.p.host.Peerstore().SignedRoutingState(p) var recordBytes []byte
var saddrs []byte if peerstoreSupportsSignedAddrs {
spr := cab.GetPeerRecord(p)
var err error var err error
if srr != nil { if spr != nil {
saddrs, err = srr.Marshal() recordBytes, err = spr.Marshal()
if err != nil { if err != nil {
log.Warningf("error marshaling signed routing state for %s: %s", p, err) log.Warnf("error marshaling signed peer record for %s: %s", p, err)
} }
} }
px = append(px, &pb.PeerInfo{PeerID: []byte(p), SignedAddrs: saddrs}) }
px = append(px, &pb.PeerInfo{PeerID: []byte(p), SignedPeerRecord: recordBytes})
} }
return &pb.ControlPrune{TopicID: &topic, Peers: px} return &pb.ControlPrune{TopicID: &topic, Peers: px}

View File

@ -589,7 +589,7 @@ func (m *ControlPrune) GetPeers() []*PeerInfo {
type PeerInfo struct { type PeerInfo struct {
PeerID []byte `protobuf:"bytes,1,opt,name=peerID" json:"peerID,omitempty"` PeerID []byte `protobuf:"bytes,1,opt,name=peerID" json:"peerID,omitempty"`
SignedAddrs []byte `protobuf:"bytes,2,opt,name=signedAddrs" json:"signedAddrs,omitempty"` SignedPeerRecord []byte `protobuf:"bytes,2,opt,name=signedPeerRecord" json:"signedPeerRecord,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -635,9 +635,9 @@ func (m *PeerInfo) GetPeerID() []byte {
return nil return nil
} }
func (m *PeerInfo) GetSignedAddrs() []byte { func (m *PeerInfo) GetSignedPeerRecord() []byte {
if m != nil { if m != nil {
return m.SignedAddrs return m.SignedPeerRecord
} }
return nil return nil
} }
@ -835,48 +835,48 @@ func init() {
func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) } func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) }
var fileDescriptor_77a6da22d6a3feb1 = []byte{ var fileDescriptor_77a6da22d6a3feb1 = []byte{
// 650 bytes of a gzipped FileDescriptorProto // 655 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcd, 0x6e, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcf, 0x6e, 0xd3, 0x4e,
0x10, 0xc7, 0xd9, 0x38, 0xa9, 0xe3, 0x89, 0x5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 0xa8, 0x0e, 0xda, 0xfb, 0xfe, 0x87,
0x3f, 0xac, 0x97, 0x1a, 0xdf, 0x08, 0xe8, 0xca, 0x1b, 0x7d, 0xb3, 0xe4, 0xe4, 0xe9, 0xbf, 0xa7, 0x06, 0x91, 0xc1, 0xf1, 0xc1, 0x51, 0xa3, 0xd2, 0xfc, 0x4a, 0x40, 0x57, 0xde, 0xe8, 0xeb, 0x05,
0x11, 0xbf, 0x05, 0x1f, 0x5b, 0x60, 0x9c, 0xf2, 0x8b, 0x81, 0x9b, 0x4e, 0xf8, 0xcc, 0xcc, 0x22, 0x27, 0x5b, 0x7f, 0x9f, 0x46, 0x3e, 0x4b, 0x3e, 0x36, 0xc1, 0x38, 0xe3, 0x97, 0x03, 0x37, 0x99,
0x61, 0x3f, 0xc3, 0x46, 0x2b, 0x86, 0xd6, 0xc1, 0x38, 0x18, 0x74, 0x59, 0xbf, 0xb7, 0x6c, 0xeb, 0xf0, 0x99, 0x99, 0x79, 0xc2, 0x7e, 0x8a, 0x8d, 0xae, 0x19, 0x5a, 0x03, 0xe3, 0x70, 0xb0, 0xc3,
0x9d, 0xf9, 0xe3, 0xb2, 0x49, 0x7e, 0x5d, 0x36, 0xc9, 0xef, 0xcb, 0x26, 0xf9, 0x1b, 0x00, 0x00, 0xfa, 0xbd, 0x45, 0x5b, 0x6f, 0xcd, 0xef, 0x57, 0x2d, 0xf2, 0xf3, 0xaa, 0x45, 0x7e, 0x5d, 0xb5,
0xff, 0xff, 0xe3, 0x53, 0xd4, 0xac, 0x6d, 0x05, 0x00, 0x00, 0xc8, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x58, 0xd6, 0x7d, 0x1f, 0x77, 0x05, 0x00, 0x00,
} }
func (m *RPC) Marshal() (dAtA []byte, err error) { func (m *RPC) Marshal() (dAtA []byte, err error) {
@ -1271,11 +1271,11 @@ func (m *PeerInfo) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintRpc(dAtA, i, uint64(len(m.PeerID))) i = encodeVarintRpc(dAtA, i, uint64(len(m.PeerID)))
i += copy(dAtA[i:], m.PeerID) i += copy(dAtA[i:], m.PeerID)
} }
if m.SignedAddrs != nil { if m.SignedPeerRecord != nil {
dAtA[i] = 0x12 dAtA[i] = 0x12
i++ i++
i = encodeVarintRpc(dAtA, i, uint64(len(m.SignedAddrs))) i = encodeVarintRpc(dAtA, i, uint64(len(m.SignedPeerRecord)))
i += copy(dAtA[i:], m.SignedAddrs) i += copy(dAtA[i:], m.SignedPeerRecord)
} }
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i += copy(dAtA[i:], m.XXX_unrecognized)
@ -1616,8 +1616,8 @@ func (m *PeerInfo) Size() (n int) {
l = len(m.PeerID) l = len(m.PeerID)
n += 1 + l + sovRpc(uint64(l)) n += 1 + l + sovRpc(uint64(l))
} }
if m.SignedAddrs != nil { if m.SignedPeerRecord != nil {
l = len(m.SignedAddrs) l = len(m.SignedPeerRecord)
n += 1 + l + sovRpc(uint64(l)) n += 1 + l + sovRpc(uint64(l))
} }
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
@ -2895,7 +2895,7 @@ func (m *PeerInfo) Unmarshal(dAtA []byte) error {
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SignedAddrs", wireType) return fmt.Errorf("proto: wrong wireType = %d for field SignedPeerRecord", wireType)
} }
var byteLen int var byteLen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2922,9 +2922,9 @@ func (m *PeerInfo) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.SignedAddrs = append(m.SignedAddrs[:0], dAtA[iNdEx:postIndex]...) m.SignedPeerRecord = append(m.SignedPeerRecord[:0], dAtA[iNdEx:postIndex]...)
if m.SignedAddrs == nil { if m.SignedPeerRecord == nil {
m.SignedAddrs = []byte{} m.SignedPeerRecord = []byte{}
} }
iNdEx = postIndex iNdEx = postIndex
default: default:

View File

@ -50,7 +50,7 @@ message ControlPrune {
message PeerInfo { message PeerInfo {
optional bytes peerID = 1; optional bytes peerID = 1;
optional bytes signedAddrs = 2; optional bytes signedPeerRecord = 2;
} }
message TopicDescriptor { message TopicDescriptor {