complement.go 484 Bytes
Newer Older
1 2 3
package mocknet

import (
tavit ohanian's avatar
tavit ohanian committed
4
	"gitlab.dms3.io/p2p/go-p2p-core/network"
5 6 7 8 9 10 11 12 13 14 15 16 17
)

// StreamComplement returns the other end of the given stream. This function
// panics when passed a non-mocknet stream.
func StreamComplement(s network.Stream) network.Stream {
	return s.(*stream).rstream
}

// ConnComplement returns the other end of the given connection. This function
// panics when passed a non-mocknet connection.
func ConnComplement(c network.Conn) network.Conn {
	return c.(*conn).rconn
}