mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 11:27:42 +08:00
21 lines
559 B
Go
21 lines
559 B
Go
// The identify package handles how peers identify with eachother upon
|
|
// connection to the network
|
|
package identify
|
|
|
|
import (
|
|
peer "github.com/jbenet/go-ipfs/peer"
|
|
u "github.com/jbenet/go-ipfs/util"
|
|
)
|
|
|
|
// Perform initial communication with this peer to share node ID's and
|
|
// initiate communication
|
|
func Handshake(self, remote *peer.Peer, in, out chan []byte) error {
|
|
// TODO: make this more... secure.
|
|
out <- self.ID
|
|
resp := <-in
|
|
remote.ID = peer.ID(resp)
|
|
u.DOut("[%s] identify: Got node id: %s", self.ID.Pretty(), remote.ID.Pretty())
|
|
|
|
return nil
|
|
}
|