// NewStream returns a new stream to given peer p. // If there is no connection to p, attempts to create one. func (n *Network) NewStream(p peer.ID) (inet.Stream, error) { log.Debugf("[%s] network opening stream to peer [%s]", n.local, p) s, err := n.Swarm().NewStreamWithPeer(p) if err != nil { return nil, err } return inet.Stream(s), nil }
func (n *ps2netNotifee) ClosedStream(s *ps.Stream) { n.not.ClosedStream(n.net, inet.Stream((*Stream)(s))) }
func (n *ps2netNotifee) OpenedStream(s *ps.Stream) { n.not.OpenedStream(n.net, inet.Stream((*Stream)(s))) }
// NewStream returns a new Stream from this connection func (c *Conn) NewStream() (inet.Stream, error) { s, err := c.NewSwarmStream() return inet.Stream(s), err }