tell if a peer supports DATAGRAM frames in the ConnectionState

This commit is contained in:
Marten Seemann
2019-10-06 10:31:30 +02:00
parent 356c69944e
commit e951646fb6
2 changed files with 8 additions and 2 deletions

View File

@@ -264,7 +264,8 @@ type Config struct {
// ConnectionState records basic details about a QUIC connection
type ConnectionState struct {
TLS handshake.ConnectionState
TLS handshake.ConnectionState
SupportsDatagrams bool
}
// A Listener for incoming QUIC connections

View File

@@ -632,9 +632,14 @@ func (s *session) Context() context.Context {
return s.ctx
}
func (s *session) supportsDatagrams() bool {
return s.peerParams.MaxDatagramFrameSize != protocol.InvalidByteCount
}
func (s *session) ConnectionState() ConnectionState {
return ConnectionState{
TLS: s.cryptoStreamHandler.ConnectionState(),
TLS: s.cryptoStreamHandler.ConnectionState(),
SupportsDatagrams: s.supportsDatagrams(),
}
}