Table of Contents

Interface IQuicConnection

Namespace
VpnHood.Net.Quic.Abstractions
Assembly
VpnHood.Net.Quic.Abstractions.dll

Represents an established QUIC connection, over which either side opens and accepts streams. VpnHood uses QUIC as a transport, so its streams are plain Stream objects.

public interface IQuicConnection : IAsyncDisposable
Inherited Members

Remarks

The caller owns the connection and each stream it returns, and disposes them. Disposing the connection closes it, and disposes the streams the peer opened that nobody accepted.

Properties

LocalEndPoint

Gets the connection's local address and port.

IPEndPoint LocalEndPoint { get; }

Property Value

IPEndPoint

Remarks

The Android and iOS clients do not know it, and give the any address with port 0.

RemoteEndPoint

Gets the connection's remote address and port.

IPEndPoint RemoteEndPoint { get; }

Property Value

IPEndPoint

Methods

AcceptInboundStreamAsync(CancellationToken)

Accepts the next stream the peer opens: a bidirectional one, or on a server, also a unidirectional one, which only reads.

ValueTask<Stream> AcceptInboundStreamAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

ValueTask<Stream>

A task whose result is the stream, which the caller owns and disposes.

Exceptions

OperationCanceledException

cancellationToken was canceled.

InvalidOperationException

The connection is closed, on the Android and iOS clients.

IOException

The connection is closed, on MsQuic, or the stream could not start, on iOS.

OpenOutboundStreamAsync(CancellationToken)

Opens a bidirectional stream.

ValueTask<Stream> OpenOutboundStreamAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

ValueTask<Stream>

A task whose result is the stream, which the caller owns and disposes.

Remarks

MsQuic waits for the peer's stream allowance; the iOS client may fail at once instead.

Exceptions

OperationCanceledException

cancellationToken was canceled.

IOException

The stream could not be opened, as when the connection is closed.

ObjectDisposedException

The connection is disposed.