func (p *printer) NetworkConns(ni inet.Network) { fmt.Fprintf(p.w, "%s connected to:\n", ni.LocalPeer()) for _, c := range ni.Conns() { fmt.Fprintf(p.w, "\t%s (addr: %s)\n", c.RemotePeer(), c.RemoteMultiaddr()) } fmt.Fprintf(p.w, "\n") }
func (mn *mocknet) LinksBetweenNets(n1, n2 inet.Network) []Link { return mn.LinksBetweenPeers(n1.LocalPeer(), n2.LocalPeer()) }
func (mn *mocknet) DisconnectNets(n1, n2 inet.Network) error { return n1.ClosePeer(n2.LocalPeer()) }
func (mn *mocknet) ConnectNets(a, b inet.Network) (inet.Conn, error) { return a.DialPeer(mn.ctx, b.LocalPeer()) }
func (mn *mocknet) UnlinkNets(n1, n2 inet.Network) error { return mn.UnlinkPeers(n1.LocalPeer(), n2.LocalPeer()) }
func DivulgeAddresses(a, b inet.Network) { id := a.LocalPeer() addrs := a.Peerstore().Addrs(id) b.Peerstore().AddAddrs(id, addrs, pstore.PermanentAddrTTL) }