(t *testing.T, addr net.Addr)
| 59 | } |
| 60 | |
| 61 | func quicClient(t *testing.T, addr net.Addr) { |
| 62 | tlsConf := &tls.Config{ |
| 63 | InsecureSkipVerify: true, |
| 64 | NextProtos: []string{"argotunnel"}, |
| 65 | } |
| 66 | ctx, cancel := context.WithCancel(context.Background()) |
| 67 | defer cancel() |
| 68 | session, err := quic.DialAddr(ctx, addr.String(), tlsConf, testQUICConfig) |
| 69 | require.NoError(t, err) |
| 70 | |
| 71 | var wg sync.WaitGroup |
| 72 | for exchange := 0; exchange < exchanges; exchange++ { |
| 73 | quicStream, err := session.AcceptStream(context.Background()) |
| 74 | require.NoError(t, err) |
| 75 | wg.Add(1) |
| 76 | |
| 77 | go func(iter int) { |
| 78 | defer wg.Done() |
| 79 | |
| 80 | log := zerolog.Nop() |
| 81 | stream := NewSafeStreamCloser(quicStream, 30*time.Second, &log) |
| 82 | defer stream.Close() |
| 83 | |
| 84 | // Do a bunch of round trips over this stream that should work. |
| 85 | for msg := 0; msg < msgsPerExchange; msg++ { |
| 86 | clientRoundTrip(t, stream, true) |
| 87 | } |
| 88 | // And one that won't work necessarily, but shouldn't break other streams in the session. |
| 89 | if iter%2 == 0 { |
| 90 | clientRoundTrip(t, stream, false) |
| 91 | } |
| 92 | }(exchange) |
| 93 | } |
| 94 | |
| 95 | wg.Wait() |
| 96 | } |
| 97 | |
| 98 | func quicServer(t *testing.T, serverReady *sync.WaitGroup, conn net.PacketConn) { |
| 99 | ctx, cancel := context.WithCancel(context.Background()) |
no test coverage detected