Skip to content

Commit 4bdc6df

Browse files
committed
quic: expand package docs, and document Stream
For golang/go#58547 Change-Id: Ie5dd0ed383ea7a5b3a45103cb730ff62792f62e1 Reviewed-on: https://go-review.googlesource.com/c/net/+/565797 Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent 22cbde9 commit 4bdc6df

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

internal/quic/doc.go

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,44 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// Package quic is an experimental, incomplete implementation of the QUIC protocol.
6-
// This package is a work in progress, and is not ready for use at this time.
5+
// Package quic implements the QUIC protocol.
76
//
8-
// This package implements (or will implement) RFC 9000, RFC 9001, and RFC 9002.
7+
// This package is a work in progress.
8+
// It is not ready for production usage.
9+
// Its API is subject to change without notice.
10+
//
11+
// This package is low-level.
12+
// Most users will use it indirectly through an HTTP/3 implementation.
13+
//
14+
// # Usage
15+
//
16+
// An [Endpoint] sends and receives traffic on a network address.
17+
// Create an Endpoint to either accept inbound QUIC connections
18+
// or create outbound ones.
19+
//
20+
// A [Conn] is a QUIC connection.
21+
//
22+
// A [Stream] is a QUIC stream, an ordered, reliable byte stream.
23+
//
24+
// # Cancelation
25+
//
26+
// All blocking operations may be canceled using a context.Context.
27+
// When performing an operation with a canceled context, the operation
28+
// will succeed if doing so does not require blocking. For example,
29+
// reading from a stream will return data when buffered data is available,
30+
// even if the stream context is canceled.
31+
//
32+
// # Limitations
33+
//
34+
// This package is a work in progress.
35+
// Known limitations include:
36+
//
37+
// - Performance is untuned.
38+
// - 0-RTT is not supported.
39+
// - Address migration is not supported.
40+
// - Server preferred addresses are not supported.
41+
// - The latency spin bit is not supported.
42+
// - Stream send/receive windows are configurable,
43+
// but are fixed and do not adapt to available throughput.
44+
// - Path MTU discovery is not implemented.
945
package quic

internal/quic/stream.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ import (
1414
"math"
1515
)
1616

17+
// A Stream is an ordered byte stream.
18+
//
19+
// Streams may be bidirectional, read-only, or write-only.
20+
// Methods inappropriate for a stream's direction
21+
// (for example, [Write] to a read-only stream)
22+
// return errors.
23+
//
24+
// It is not safe to perform concurrent reads from or writes to a stream.
25+
// It is safe, however, to read and write at the same time.
26+
//
27+
// Reads and writes are buffered.
28+
// It is generally not necessary to wrap a stream in a [bufio.ReadWriter]
29+
// or otherwise apply additional buffering.
30+
//
31+
// To cancel reads or writes, use the [SetReadContext] and [SetWriteContext] methods.
1732
type Stream struct {
1833
id streamID
1934
conn *Conn

0 commit comments

Comments
 (0)