mirror of
https://github.com/XTLS/REALITY.git
synced 2025-08-22 22:48:36 +00:00
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>
This commit is contained in:
parent
979284f821
commit
6fd44f977d
9
quic.go
9
quic.go
@ -247,10 +247,15 @@ func (q *QUICConn) HandleData(level QUICEncryptionLevel, data []byte) error {
|
|||||||
return nil
|
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.
|
// SendSessionTicket sends a session ticket to the client.
|
||||||
// It produces connection events, which may be read with NextEvent.
|
// It produces connection events, which may be read with NextEvent.
|
||||||
// Currently, it can only be called once.
|
// Currently, it can only be called once.
|
||||||
func (q *QUICConn) SendSessionTicket(earlyData bool) error {
|
func (q *QUICConn) SendSessionTicket(opts QUICSessionTicketOptions) error {
|
||||||
c := q.conn
|
c := q.conn
|
||||||
if !c.isHandshakeComplete.Load() {
|
if !c.isHandshakeComplete.Load() {
|
||||||
return quicError(errors.New("tls: SendSessionTicket called before handshake completed"))
|
return quicError(errors.New("tls: SendSessionTicket called before handshake completed"))
|
||||||
@ -262,7 +267,7 @@ func (q *QUICConn) SendSessionTicket(earlyData bool) error {
|
|||||||
return quicError(errors.New("tls: SendSessionTicket called multiple times"))
|
return quicError(errors.New("tls: SendSessionTicket called multiple times"))
|
||||||
}
|
}
|
||||||
q.sessionTicketSent = true
|
q.sessionTicketSent = true
|
||||||
return quicError(c.sendSessionTicket(earlyData))
|
return quicError(c.sendSessionTicket(opts.EarlyData))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConnectionState returns basic TLS details about the connection.
|
// ConnectionState returns basic TLS details about the connection.
|
||||||
|
Loading…
Reference in New Issue
Block a user