Example #1
0
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
}
Example #2
0
		logger       *logrus.Logger
		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
		)