Class QUICServer

Hierarchy

  • StartStop
    • QUICServer

Constructors

Properties

[initLock]: RWLockWriter
_closed: boolean = false
_closedP: Promise<void>
codeToReason?: StreamCodeToReason

Custom code to reason converted for new connections.

config: QUICConfig
isSocketShared: boolean

Determines if socket is shared.

logger: Logger
minIdleTimeout?: number

The minimum idle timeout to be used for new connections.

reasonToCode?: StreamReasonToCode

Custom reason to code converter for new connections.

resolveClosedP: (() => void)

Type declaration

    • (): void
    • Returns void

socket: QUICSocket

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

  • get closed(): boolean
  • Server is no longer accepting connections.

    Returns boolean

Methods

  • Parameters

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

    Returns void

  • Parameters

    • event: Event

    Returns boolean

  • Handles all EventQUICConnection events.

    Parameters

    • evt: EventAll<Event>

    Returns void

  • Handles EventQUICConnectionSend.

    This will propagate the connection send buffers to the socket. This may be concurrent and multiple send events may be processed at a time.

    Parameters

    Returns Promise<void>

  • Handles EventQUICServerClose. Registered once.

    This event propagates errors minus the internal errors.

    If this event is dispatched first before QUICServer.stop, it represents an evented close. This could originate from the QUICSocket. If it was from the QUICSocket, then here it will stop all connections with an transport code InternalError.

    Parameters

    Returns Promise<void>

  • Handles EventQUICServerError.

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

    Parameters

    Returns void

    Throws

  • Handles all EventQUICSocket events. Registered only if the socket is encapsulated.

    Parameters

    • evt: EventAll<Event>

    Returns void

  • Handles EventQUICSocketStopped. Registered once.

    It is an error if the socket was stopped while QUICServer wasn't stopped.

    Returns void

  • Creates a retry token. This will embed peer host IP and DCID into the token. It will authenticate the data by providing a signature signed by our key.

    Parameters

    Returns Promise<Buffer>

  • Parameters

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

    Returns void

  • Starts the QUICServer.

    Parameters

    • opts: {
          host?: string;
          ipv6Only?: boolean;
          port?: number;
          reuseAddr?: boolean;
      } = {}
      • Optional host?: string

        target host, ignored if socket is shared

      • Optional ipv6Only?: boolean

        force using IPv6 even when using ::

      • Optional port?: number

        target port, ignored if socket is shared

      • Optional reuseAddr?: boolean

        reuse existing port

    Returns Promise<void>

  • Stops the QUICServer.

    Parameters

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

    Returns Promise<void>

  • Updates the QUICConfig for new connections. It will not affect existing connections, they will keep using the old QUICConfig.

    Parameters

    Returns void

  • Validates the retry token. This will check that the token was signed by us. And it will check that the current host IP is the same as the one put into the token. This proves that the peer can in fact receive and send from the host IP. This returns the DCID inside the token, which was the original DCID.

    Parameters

    • tokenBuffer: Buffer
    • peerHost: Host

    Returns Promise<undefined | QUICConnectionId>

Generated using TypeDoc