diff options
author | Damien Neil <dneil@google.com> | 2023-08-01 13:33:37 -0700 |
---|---|---|
committer | Damien Neil <dneil@google.com> | 2023-08-02 17:43:27 +0000 |
commit | 35de5f2b0ee28dd9981d2754336cb9bd26e44b28 (patch) | |
tree | 80f79fd2b862989301f1dfbab503dd4a7ac3690e | |
parent | a3b092d65e2df7584e452508a6a1ddc0d861a010 (diff) | |
download | go-35de5f2b0ee28dd9981d2754336cb9bd26e44b28.tar.gz go-35de5f2b0ee28dd9981d2754336cb9bd26e44b28.zip |
[release-branch.go1.21] crypto/tls: change SendSessionTicket to take an options struct
To allow for future evolution of the API, make
QUICConn.SendSessionTicket take a QUICSessionTicketOptions
rather than a single bool.
For #60107
Change-Id: I798fd0feec5c7581e3c3574e2de99611c81df47f
Reviewed-on: https://go-review.googlesource.com/c/go/+/514997
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
(cherry picked from commit a915b999c915eb7827396013bcb334747863e66e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/515335
Auto-Submit: Damien Neil <dneil@google.com>
-rw-r--r-- | api/go1.21.txt | 4 | ||||
-rw-r--r-- | src/crypto/tls/quic.go | 9 | ||||
-rw-r--r-- | src/crypto/tls/quic_test.go | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/api/go1.21.txt b/api/go1.21.txt index 42b3075fd8..50b6a5c219 100644 --- a/api/go1.21.txt +++ b/api/go1.21.txt @@ -60,7 +60,9 @@ pkg crypto/tls, method (*QUICConn) Close() error #44886 pkg crypto/tls, method (*QUICConn) ConnectionState() ConnectionState #44886 pkg crypto/tls, method (*QUICConn) HandleData(QUICEncryptionLevel, []uint8) error #44886 pkg crypto/tls, method (*QUICConn) NextEvent() QUICEvent #44886 -pkg crypto/tls, method (*QUICConn) SendSessionTicket(bool) error #60107 +pkg crypto/tls, method (*QUICConn) SendSessionTicket(QUICSessionTicketOptions) error #60107 +pkg crypto/tls, type QUICSessionTicketOptions struct #60107 +pkg crypto/tls, type QUICSessionTicketOptions struct, EarlyData bool #60107 pkg crypto/tls, method (*QUICConn) SetTransportParameters([]uint8) #44886 pkg crypto/tls, method (*QUICConn) Start(context.Context) error #44886 pkg crypto/tls, method (QUICEncryptionLevel) String() string #44886 diff --git a/src/crypto/tls/quic.go b/src/crypto/tls/quic.go index 6cb10df8ba..286302f0ec 100644 --- a/src/crypto/tls/quic.go +++ b/src/crypto/tls/quic.go @@ -246,10 +246,15 @@ func (q *QUICConn) HandleData(level QUICEncryptionLevel, data []byte) error { return nil } +type QUICSessionTicketOptions struct { + // EarlyData specifies whether the ticket may be used for 0-RTT. + EarlyData bool +} + // SendSessionTicket sends a session ticket to the client. // It produces connection events, which may be read with NextEvent. // Currently, it can only be called once. -func (q *QUICConn) SendSessionTicket(earlyData bool) error { +func (q *QUICConn) SendSessionTicket(opts QUICSessionTicketOptions) error { c := q.conn if !c.isHandshakeComplete.Load() { return quicError(errors.New("tls: SendSessionTicket called before handshake completed")) @@ -261,7 +266,7 @@ func (q *QUICConn) SendSessionTicket(earlyData bool) error { return quicError(errors.New("tls: SendSessionTicket called multiple times")) } q.sessionTicketSent = true - return quicError(c.sendSessionTicket(earlyData)) + return quicError(c.sendSessionTicket(opts.EarlyData)) } // ConnectionState returns basic TLS details about the connection. diff --git a/src/crypto/tls/quic_test.go b/src/crypto/tls/quic_test.go index 02503cff82..9a29fa56b8 100644 --- a/src/crypto/tls/quic_test.go +++ b/src/crypto/tls/quic_test.go @@ -125,7 +125,8 @@ func runTestQUICConnection(ctx context.Context, cli, srv *testQUICConn, onHandle case QUICHandshakeDone: a.complete = true if a == srv { - if err := srv.conn.SendSessionTicket(false); err != nil { + opts := QUICSessionTicketOptions{} + if err := srv.conn.SendSessionTicket(opts); err != nil { return err } } |