func (node *HostNode) OpenStreams(id peer.ID, protocols ...protocol.ID) error {
	protoStrings := make([]string, len(protocols))
	for i := range protocols {
		protoStrings[i] = string(protocols[i])
	}

	for _, p := range protoStrings {
		logrus.WithField("peerID", id).WithField("protocol", p).Debug("setting up stream")
		stream, err := node.host.NewStream(node.ctx, id, protocol.ID(p))
		if err != nil {
			return err
		}

		err = node.discovery.HandleOutgoing(protocol.ID(p), stream)
		if err != nil {
			return err
		}
	}

	return nil
}
// OpenStreams opens streams to peer after connecting.
OpenStreams opens streams to peer after connecting.
// OpenStreams opens streams to peer after connecting .
func (node *HostNode) OpenStreams(id peer.ID, protocols ...protocol.ID) error {
	protoStrings := make([]string, len(protocols))
	for i := range protocols {
		protoStrings[i] = string(protocols[i])
	}
	for _, p := range protoStrings {
		logrus.WithField("peerID", id).WithField("protocol", p).Debug("setting up stream")
		stream, err := node.host.NewStream(node.ctx, id, protocol.ID(p))
		if err != nil {
			return err
		}
		err = node.discovery.HandleOutgoing(protocol.ID(p), stream)
		if err != nil {
			return err
		}
	}
	return nil
}
func ( node * HostNode ) OpenStreams ( id peer . ID , protocols ... protocol . ID ) error { protoStrings := make ( [ ] string , len ( protocols ) ) for i := range protocols { protoStrings [ i ] = string ( protocols [ i ] ) } for _ , p := range protoStrings { logrus . WithField ( " " , id ) . WithField ( " " , p ) . Debug ( " " ) stream , err := node . host . NewStream ( node . ctx , id , protocol . ID ( p ) ) if err != nil { return err } err = node . discovery . HandleOutgoing ( protocol . ID ( p ) , stream ) if err != nil { return err } } return nil }
OpenStreams opens streams to peer after connecting.
OpenStreams opens streams to peer after connecting .