@@ -18,8 +18,8 @@ type Handler struct {
1818 pb * pubsub.PubSub
1919 serviceTopic string
2020 networkTopics mapset.Set
21- identityMap map [string ]string
22- multiaddress string
21+ identityMap map [peer. ID ]string
22+ peerID peer. ID
2323 matrixID string
2424 PbMutex sync.Mutex
2525}
@@ -31,13 +31,13 @@ type TextMessage struct {
3131 From peer.ID
3232}
3333
34- func NewHandler (pb * pubsub.PubSub , serviceTopic , multiaddress string , networkTopics * mapset.Set ) Handler {
34+ func NewHandler (pb * pubsub.PubSub , serviceTopic string , peerID peer. ID , networkTopics * mapset.Set ) Handler {
3535 return Handler {
3636 pb : pb ,
3737 serviceTopic : serviceTopic ,
3838 networkTopics : * networkTopics ,
39- identityMap : make (map [string ]string ),
40- multiaddress : multiaddress ,
39+ identityMap : make (map [peer. ID ]string ),
40+ peerID : peerID ,
4141 }
4242}
4343
@@ -98,8 +98,8 @@ func (h *Handler) HandleIncomingMessage(topic string, msg pubsub.Message, handle
9898 Body : "" ,
9999 Flag : api .FlagIdentityResponse ,
100100 },
101- Multiaddress : h . multiaddress ,
102- MatrixID : h .matrixID ,
101+ PeerID : h . peerID ,
102+ MatrixID : h .matrixID ,
103103 }
104104 sendData , err := json .Marshal (respond )
105105 if err != nil {
@@ -118,7 +118,7 @@ func (h *Handler) HandleIncomingMessage(topic string, msg pubsub.Message, handle
118118 log .Println ("Error occurred during unmarshalling the message data from IdentityResponse" )
119119 return
120120 }
121- h .identityMap [respond .Multiaddress ] = respond .MatrixID
121+ h .identityMap [respond .PeerID ] = respond .MatrixID
122122 default :
123123 log .Printf ("\n Unknown message type: %#x\n " , message .Flag )
124124 }
@@ -129,8 +129,8 @@ func (h *Handler) SetMatrixID(matrixID string) {
129129 h .matrixID = matrixID
130130}
131131
132- // Returns copy of handler's identity map ([multiaddress ]=>[matrixID])
133- func (h * Handler ) GetIdentityMap () map [string ]string {
132+ // Returns copy of handler's identity map ([peer.ID ]=>[matrixID])
133+ func (h * Handler ) GetIdentityMap () map [peer. ID ]string {
134134 return h .identityMap
135135}
136136
0 commit comments