Lets say I’ve set up a host like so:
ctx := context.Background()
opt := []libp2p.Option {
libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/" + c.Port),
// Load private key to create p2p ID
libp2p.Identity(c.Account.P2PPriv),
// Use the noise encryption protocol
libp2p.Security(noise.ID, noise.New),
// support TLS connections
libp2p.Security(libp2ptls.ID, libp2ptls.New),
// Attempt to open ports using uPNP for NATed hosts.
libp2p.NATPortMap(),
}
host, err := libp2p.New(ctx, opt...)
if err != nil {
return Client {}, fmt.Errorf("Failed to open P2P Host: %s", err)
}
How would i go about printing a message in console when a different peer connects?