Closed elct9620 closed 2 months ago
helper.go
PeerId
This design is to support lookup Peer by device public key and peer public key
// in memory peer store var peers map[PeerId]*Peer = make(map[PeerId]*Peer, 0) // Lookup by PeerId p1 := entity.NewPeerId([]byte{0}, []byte{1}) p2 := entity.NewPeerId([]byte{0}, []byte{1}) fmt.Printf("Is same: %t\n", peers[p1] == peers[p2]) // => Is same: true
helper.go
PeerId
value objectThis design is to support lookup Peer by device public key and peer public key