| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | using IceRpc.Transports.Quic; |
| | | 4 | | using System.Net.Quic; |
| | | 5 | | using System.Net.Security; |
| | | 6 | | using System.Runtime.Versioning; |
| | | 7 | | |
| | | 8 | | namespace IceRpc.Transports; |
| | | 9 | | |
| | | 10 | | /// <summary>A class to create outgoing multiplexed connections.</summary> |
| | | 11 | | public interface IMultiplexedClientTransport |
| | | 12 | | { |
| | | 13 | | /// <summary>Gets the default multiplexed client transport.</summary> |
| | | 14 | | /// <value>The default multiplexed client transport is the <see cref="QuicClientTransport" />.</value> |
| | | 15 | | public static IMultiplexedClientTransport Default |
| | | 16 | | { |
| | | 17 | | get |
| | 15 | 18 | | { |
| | 15 | 19 | | if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || OperatingSystem.IsWindows()) |
| | 15 | 20 | | { |
| | 15 | 21 | | if (QuicConnection.IsSupported) |
| | 15 | 22 | | { |
| | 15 | 23 | | return _quicClientTransport; |
| | | 24 | | } |
| | 0 | 25 | | throw new NotSupportedException( |
| | 0 | 26 | | "The default QUIC client transport is not available on this system. Please review the Platform Depen |
| | | 27 | | } |
| | 0 | 28 | | throw new PlatformNotSupportedException( |
| | 0 | 29 | | "The default QUIC client transport is not supported on this platform."); |
| | 15 | 30 | | } |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | [SupportedOSPlatform("linux")] |
| | | 34 | | [SupportedOSPlatform("macos")] |
| | | 35 | | [SupportedOSPlatform("windows")] |
| | 4 | 36 | | private static readonly QuicClientTransport _quicClientTransport = new(); |
| | | 37 | | |
| | | 38 | | /// <summary>Gets the transport's name.</summary> |
| | | 39 | | string Name { get; } |
| | | 40 | | |
| | | 41 | | /// <summary>Creates a new transport connection to the specified server address.</summary> |
| | | 42 | | /// <param name="serverAddress">The server address of the connection.</param> |
| | | 43 | | /// <param name="options">The multiplexed connection options.</param> |
| | | 44 | | /// <param name="clientAuthenticationOptions">The SSL client authentication options.</param> |
| | | 45 | | /// <returns>The new transport connection. This connection is not yet connected.</returns> |
| | | 46 | | /// <remarks>The IceRPC core can call this method concurrently so it must be thread-safe.</remarks> |
| | | 47 | | IMultiplexedConnection CreateConnection( |
| | | 48 | | ServerAddress serverAddress, |
| | | 49 | | MultiplexedConnectionOptions options, |
| | | 50 | | SslClientAuthenticationOptions? clientAuthenticationOptions); |
| | | 51 | | } |