/// <summary> /// Binds an endpoint to be used for QUIC connections. /// </summary> /// <param name="endpoint">The endpoint to bind to.</param> /// <param name="features">Additional features to be used to create the listener.</param> /// <param name="cancellationToken">To cancel the </param> /// <returns>A </returns> public ValueTask <IMultiplexedConnectionListener> BindAsync(EndPoint endpoint, IFeatureCollection?features = null, CancellationToken cancellationToken = default) { if (endpoint == null) { throw new ArgumentNullException(nameof(endpoint)); } var sslServerAuthenticationOptions = features?.Get <SslServerAuthenticationOptions>(); if (sslServerAuthenticationOptions == null) { throw new InvalidOperationException("Couldn't find HTTPS configuration for QUIC transport."); } if (sslServerAuthenticationOptions.ServerCertificate == null && sslServerAuthenticationOptions.ServerCertificateContext == null && sslServerAuthenticationOptions.ServerCertificateSelectionCallback == null) { var message = $"{nameof(SslServerAuthenticationOptions)} must provide a server certificate using {nameof(SslServerAuthenticationOptions.ServerCertificate)}," + $" {nameof(SslServerAuthenticationOptions.ServerCertificateContext)}, or {nameof(SslServerAuthenticationOptions.ServerCertificateSelectionCallback)}."; throw new InvalidOperationException(message); } var transport = new QuicConnectionListener(_options, _log, endpoint, sslServerAuthenticationOptions); return(new ValueTask <IMultiplexedConnectionListener>(transport)); }
/// <summary> /// Binds an endpoint to be used for QUIC connections. /// </summary> /// <param name="endpoint">The endpoint to bind to.</param> /// <param name="features">Additional features to be used to create the listener.</param> /// <param name="cancellationToken">To cancel the </param> /// <returns>A </returns> public ValueTask <IMultiplexedConnectionListener> BindAsync(EndPoint endpoint, IFeatureCollection?features = null, CancellationToken cancellationToken = default) { var sslServerAuthenticationOptions = features?.Get <SslServerAuthenticationOptions>(); if (sslServerAuthenticationOptions == null) { throw new InvalidOperationException("Couldn't find HTTPS configuration for QUIC transport."); } if (sslServerAuthenticationOptions.ServerCertificate == null) { throw new InvalidOperationException("SslServerAuthenticationOptions.ServerCertificate must be configured with a value."); } var transport = new QuicConnectionListener(_options, _log, endpoint, sslServerAuthenticationOptions); return(new ValueTask <IMultiplexedConnectionListener>(transport)); }
/// <summary> /// Binds an endpoint to be used for QUIC connections. /// </summary> /// <param name="endpoint">The endpoint to bind to.</param> /// <param name="features">Additional features to be used to create the listener.</param> /// <param name="cancellationToken">To cancel the </param> /// <returns>A </returns> public async ValueTask <IMultiplexedConnectionListener> BindAsync(EndPoint endpoint, IFeatureCollection?features = null, CancellationToken cancellationToken = default) { if (endpoint == null) { throw new ArgumentNullException(nameof(endpoint)); } var tlsConnectionOptions = features?.Get <TlsConnectionCallbackOptions>(); if (tlsConnectionOptions == null) { throw new InvalidOperationException("Couldn't find HTTPS configuration for QUIC transport."); } if (tlsConnectionOptions.ApplicationProtocols == null || tlsConnectionOptions.ApplicationProtocols.Count == 0) { throw new InvalidOperationException("No application protocols specified for QUIC transport."); } var transport = new QuicConnectionListener(_options, _log, endpoint, tlsConnectionOptions); await transport.CreateListenerAsync(); return(transport); }
public ValueTask <IMultiplexedConnectionListener> BindAsync(EndPoint endpoint, IFeatureCollection features = null, CancellationToken cancellationToken = default) { var transport = new QuicConnectionListener(_options, _log, endpoint); return(new ValueTask <IMultiplexedConnectionListener>(transport)); }
public ValueTask <IConnectionListener> BindAsync(EndPoint endpoint, CancellationToken cancellationToken = default) { var transport = new QuicConnectionListener(_options, _log, endpoint); return(new ValueTask <IConnectionListener>(transport)); }