func printConns(n inet.Network) string { s := fmt.Sprintf("Connections in %s:\n", n) for _, c := range n.Conns() { s = s + fmt.Sprintf("- %s\n", c) } return s }
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 (nn *metricsNotifiee) Disconnected(n inet.Network, v inet.Conn) { peersTotalGauge(n.LocalPeer()).Set(float64(len(n.Conns()))) }