func setupIperfTransferrer(
	logger *logrus.Logger, cfg config.Config,
) (transferrer, error) {
	receiver := iperf.NewReceiver(logger, cfg.IperfPort)
	return transferrer{
		interruptible:    receiver,
		transferSender:   iperf.NewSender(logger),
		transferReceiver: receiver,
	}, nil
}
Exemple #2
0
		receiver     *iperf.Receiver
		sender       *iperf.Sender
		senderConn   net.Conn
		receiverConn net.Conn
	)

	BeforeEach(func() {
		logger = &logrus.Logger{
			Out:       GinkgoWriter,
			Level:     logrus.DebugLevel,
			Formatter: new(logrus.TextFormatter),
		}
		iperfPort := testhelpers.SelectPort(GinkgoParallelNode())

		receiver = iperf.NewReceiver(logger, iperfPort)
		sender = iperf.NewSender(logger)

		senderConn, receiverConn = net.Pipe()
	})

	AfterEach(func() {
		Expect(senderConn.Close()).To(Succeed())
		Expect(receiverConn.Close()).To(Succeed())
	})

	Context("when the connection is closed", func() {
		var (
			senderConn   net.Conn
			receiverConn net.Conn
		)