@@ -195,12 +195,12 @@ func (c *commImpl) createConnection(endpoint string, expectedPKIID common.PKIidT
195
195
conn .pkiID = pkiID
196
196
conn .logger = c .logger
197
197
198
- h := func (m * proto.GossipMessage ) {
198
+ h := func (m * proto.SignedGossipMessage ) {
199
199
c .logger .Debug ("Got message:" , m )
200
200
c .msgPublisher .DeMultiplex (& ReceivedMessageImpl {
201
- conn : conn ,
202
- lock : conn ,
203
- GossipMessage : m ,
201
+ conn : conn ,
202
+ lock : conn ,
203
+ SignedGossipMessage : m ,
204
204
})
205
205
}
206
206
conn .handler = h
@@ -211,15 +211,15 @@ func (c *commImpl) createConnection(endpoint string, expectedPKIID common.PKIidT
211
211
return nil , err
212
212
}
213
213
214
- func (c * commImpl ) Send (msg * proto.GossipMessage , peers ... * RemotePeer ) {
214
+ func (c * commImpl ) Send (msg * proto.SignedGossipMessage , peers ... * RemotePeer ) {
215
215
if c .isStopping () || len (peers ) == 0 {
216
216
return
217
217
}
218
218
219
219
c .logger .Debug ("Entering, sending" , msg , "to " , len (peers ), "peers" )
220
220
221
221
for _ , peer := range peers {
222
- go func (peer * RemotePeer , msg * proto.GossipMessage ) {
222
+ go func (peer * RemotePeer , msg * proto.SignedGossipMessage ) {
223
223
c .sendToEndpoint (peer , msg )
224
224
}(peer , msg )
225
225
}
@@ -247,7 +247,7 @@ func (c *commImpl) isPKIblackListed(p common.PKIidType) bool {
247
247
return false
248
248
}
249
249
250
- func (c * commImpl ) sendToEndpoint (peer * RemotePeer , msg * proto.GossipMessage ) {
250
+ func (c * commImpl ) sendToEndpoint (peer * RemotePeer , msg * proto.SignedGossipMessage ) {
251
251
if c .isStopping () {
252
252
return
253
253
}
@@ -388,7 +388,7 @@ func (c *commImpl) authenticateRemotePeer(stream stream) (common.PKIidType, erro
388
388
remoteAddress := extractRemoteAddress (stream )
389
389
remoteCertHash := extractCertificateHashFromContext (ctx )
390
390
var err error
391
- var cMsg * proto.GossipMessage
391
+ var cMsg * proto.SignedGossipMessage
392
392
var signer proto.Signer
393
393
394
394
// If TLS is detected, sign the hash of our cert to bind our TLS cert
@@ -475,11 +475,11 @@ func (c *commImpl) GossipStream(stream proto.Gossip_GossipStreamServer) error {
475
475
return nil
476
476
}
477
477
478
- h := func (m * proto.GossipMessage ) {
478
+ h := func (m * proto.SignedGossipMessage ) {
479
479
c .msgPublisher .DeMultiplex (& ReceivedMessageImpl {
480
- conn : conn ,
481
- lock : conn ,
482
- GossipMessage : m ,
480
+ conn : conn ,
481
+ lock : conn ,
482
+ SignedGossipMessage : m ,
483
483
})
484
484
}
485
485
@@ -506,8 +506,8 @@ func (c *commImpl) disconnect(pkiID common.PKIidType) {
506
506
c .connStore .closeByPKIid (pkiID )
507
507
}
508
508
509
- func readWithTimeout (stream interface {}, timeout time.Duration , address string ) (* proto.GossipMessage , error ) {
510
- incChan := make (chan * proto.GossipMessage , 1 )
509
+ func readWithTimeout (stream interface {}, timeout time.Duration , address string ) (* proto.SignedGossipMessage , error ) {
510
+ incChan := make (chan * proto.SignedGossipMessage , 1 )
511
511
errChan := make (chan error , 1 )
512
512
go func () {
513
513
if srvStr , isServerStr := stream .(proto.Gossip_GossipStreamServer ); isServerStr {
@@ -541,7 +541,7 @@ func readWithTimeout(stream interface{}, timeout time.Duration, address string)
541
541
}
542
542
}
543
543
544
- func (c * commImpl ) createConnectionMsg (pkiID common.PKIidType , hash []byte , cert api.PeerIdentityType , signer proto.Signer ) * proto.GossipMessage {
544
+ func (c * commImpl ) createConnectionMsg (pkiID common.PKIidType , hash []byte , cert api.PeerIdentityType , signer proto.Signer ) * proto.SignedGossipMessage {
545
545
m := & proto.GossipMessage {
546
546
Tag : proto .GossipMessage_EMPTY ,
547
547
Nonce : 0 ,
@@ -553,8 +553,11 @@ func (c *commImpl) createConnectionMsg(pkiID common.PKIidType, hash []byte, cert
553
553
},
554
554
},
555
555
}
556
- m .Sign (signer )
557
- return m
556
+ sMsg := & proto.SignedGossipMessage {
557
+ GossipMessage : m ,
558
+ }
559
+ sMsg .Sign (signer )
560
+ return sMsg
558
561
}
559
562
560
563
type stream interface {
0 commit comments