Class QUICConnection

Hierarchy

  • StartStop
    • QUICConnection

Constructors

Properties

[initLock]: RWLockWriter
_remoteHost: Host

Remote host which can change on every QUICConnection.recv.

_remotePort: Port

Remote port which can change on every QUICConnection.recv.

caDERs: Uint8Array[] = []

Array of independent CA certificates in DER format.

certDERs: Uint8Array[] = []

Chain of local certificates from leaf to root in DER format.

closedP: Promise<void>

Resolves once the connection has closed.

codeToReason: StreamCodeToReason
config: QUICConfig
connTimeoutTimer?: Timer<void>

Quiche connection timer. This performs time delayed state transitions.

connectionId: QUICConnectionId

This is the source connection ID.

errorLast: null | ErrorQUICConnectionLocal<unknown> | ErrorQUICConnectionPeer<unknown> | ErrorQUICConnectionIdleTimeout<unknown> | ErrorQUICConnectionInternal<unknown> = null

Stores the last dispatched error. If no error, it will be null.

QUICConnection.stop will need this if it is called by the user concurrent with handling EventQUICConnectionError. It ensures that this.stop uses the original error when force destroying the streams.

keepAliveIntervalTimer?: Timer<void>

Keep alive timer.

Quiche does not natively ensure activity on the connection. This interval timer guarantees that there will be activity on the connection by sending acknowlegement eliciting frames, which will cause the peer to acknowledge.

This is still useful even if the config.maxIdleTimeout is set to 0, which means the connection will never timeout due to being idle.

This mechanism will only start working after secureEstablishedP.

logger: Logger
reasonToCode: StreamReasonToCode
recvLock: Lock = ...

This ensures that recv is serialised. Prevents a new recv call intercepting the previous recv call that is still finishing up with a send call.

rejectSecureEstablishedP: ((reason?) => void)

Type declaration

    • (reason?): void
    • Parameters

      • Optional reason: any

      Returns void

resolveClosedP: (() => void)

Type declaration

    • (): void
    • Returns void

resolveSecureEstablishedP: (() => void)

Type declaration

    • (): void
    • Returns void

secureEstablished: boolean = false

Secure connection establishment means that this connection has completed peer certificate verification, and the connection is ready to be used.

secureEstablishedP: Promise<void>

Resolves after connection is established and peer certs have been verified.

socket: QUICSocket
streamIdClientBidi: StreamId = ...

Client initiated bidirectional stream starts at 0. Increment by 4 to get the next ID.

streamIdClientUni: StreamId = ...

Client initiated unidirectional stream starts at 2. Increment by 4 to get the next ID.

streamIdServerBidi: StreamId = ...

Server initiated bidirectional stream starts at 1. Increment by 4 to get the next ID.

streamIdServerUni: StreamId = ...

Server initiated unidirectional stream starts at 3. Increment by 4 to get the next ID.

type: "client" | "server"

This determines when it is a client or server connection.

Accessors

  • get [eventHandled](): ReadonlyWeakSet<Event>
  • Returns ReadonlyWeakSet<Event>

  • get [eventHandlers](): ReadonlyMap<string, Set<EventHandlerInfo>>
  • Returns ReadonlyMap<string, Set<EventHandlerInfo>>

  • get [eventTarget](): EventTarget
  • Returns EventTarget

  • get [handleEventError](): ((evt) => void)
  • Returns ((evt) => void)

      • (evt): void
      • Parameters

        • evt: EventError

        Returns void

  • get [running](): boolean
  • Returns boolean

  • get [statusP](): Promise<Status>
  • Returns Promise<Status>

  • get [status](): Status
  • Returns Status

Methods

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Parameters

    • event: Event

    Returns boolean

  • Array of independent CA certificates in DER format.

    Returns Uint8Array[]

  • Chain of local certificates from leaf to root in DER format.

    Returns Uint8Array[]

  • Chain of remote certificates from leaf to root in DER format.

    Returns Uint8Array[]

  • Handles EventQUICConnectionClose. Registered once.

    This event means that this.conn.close() is already called. It does not mean that this.closedP is resolved. The resolving of this.closedP depends on the this.connTimeoutTimer.

    Parameters

    Returns Promise<void>

  • Handle EventQUICConnectionError.

    QUIC connections always close with errors. Graceful errors are logged out at INFO level, while non-graceful errors are logged out at ERROR level.

    Internal errors will be thrown upwards to become an uncaught exception.

    Parameters

    Returns void

    Throws

  • Handles all EventQUICStream events.

    Parameters

    • evt: EventAll<Event>

    Returns void

  • Handles EventQUICStreamSend.

    This handler will trigger this.send when there is data in the writable stream buffer. As this is asynchronous, it is necessary to check if this QUICConnection is still running.

    Returns Promise<void>

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

  • Sets up the connection timeout timer.

    This only gets called on the first QUICConnection.send. It's the responsiblity of this timer to resolve the closedP.

    Returns void

  • Starts the QUIC connection.

    This will complete the handshake and verify the peer's certificate. The connection will be ready to be used after this resolves. The peer's verification of the local certificate occurs concurrently.

    Parameters

    • Optional opts: {
          data?: Uint8Array;
          remoteInfo?: RemoteInfo;
      }
      • Optional data?: Uint8Array

        server connections receive initial data

      • Optional remoteInfo?: RemoteInfo

        server connections receive remote host and port

    • Optional ctx: Partial<ContextTimedInput>

      timed context overrides config.minIdleTimeout which only works if config.maxIdleTimeout is greater than config.minIdleTimeout

    Returns PromiseCancellable<void>

    Throws

    • if timed out due to ctx.timer or config.minIdleTimeout

    Throws

    • if no initial data for server connection

    Throws

    • all other connection failure errors
  • Starts the keep alive interval timer.

    Interval time should be less than maxIdleTimeout unless it is 0, which means Infinity.

    If the maxIdleTimeout is 0, this can still be useful to maintain activity on the connection.

    Parameters

    • ms: number

    Returns void

  • Stops the QUIC connection.

    Parameters

    • opts: {
          errorCode?: ConnectionErrorCode;
          force?: boolean;
          isApp: false;
          reason?: Uint8Array;
      } | {
          errorCode?: number;
          force?: boolean;
          isApp?: true;
          reason?: Uint8Array;
      } = {}

    Returns Promise<void>

Generated using TypeDoc