add a GetConfigForClient callback to the Config

This commit is contained in:
Marten Seemann 2023-04-25 11:31:01 +02:00
parent ba942715db
commit bc7cb706c5
9 changed files with 223 additions and 47 deletions

View file

@ -239,6 +239,9 @@ type ConnectionIDGenerator interface {
// Config contains all configuration data needed for a QUIC server or client.
type Config struct {
// GetConfigForClient is called for incoming connections.
// If the error is not nil, the connection attempt is refused.
GetConfigForClient func(info *ClientHelloInfo) (*Config, error)
// The QUIC versions that can be negotiated.
// If not set, it uses all versions available.
Versions []VersionNumber
@ -324,6 +327,10 @@ type Config struct {
Tracer logging.Tracer
}
type ClientHelloInfo struct {
RemoteAddr net.Addr
}
// ConnectionState records basic details about a QUIC connection
type ConnectionState struct {
TLS handshake.ConnectionState