Class to lookup the hostname, port and host headers of a given Matrix servername according to the server discovery section of the spec.

Constructors

  • Parameters

    • opts: {
          currentTimeMs?: number;
          dns?: DnsInterface;
          fetch?: ((input, init?) => Promise<Response>);
      } = {}
      • Optional currentTimeMs?: number
      • Optional dns?: DnsInterface
      • Optional fetch?: ((input, init?) => Promise<Response>)
          • (input, init?): Promise<Response>
          • Parameters

            • input: string | URL | Request
            • Optional init: RequestInit

            Returns Promise<Response>

    Returns MatrixHostResolver

Accessors

Methods

  • Resolves a Matrix serverName into the baseURL for federated requests, and the Host header to use when serving requests.

    Results are cached by default. Please note that failures are cached, determined by the constant CacheFailureForMS.

    Parameters

    • hostname: string

      The Matrix hostname to resolve. e.g. matrix.org

    • skipCache: boolean = false

      Should the request be executed regardless of the cached value? Existing cached values will be overwritten.

    Returns Promise<{
        hostHeader: string;
        url: URL;
    }>

    The baseurl of the Matrix server (excluding /_matrix/federation suffix), and the hostHeader to be used.

  • Resolves a Matrix serverName, fetching any delegated information. This request is NOT cached. For general use, please use resolveMatrixServer.

    Parameters

    • hostname: string

      The Matrix hostname to resolve. e.g. matrix.org

    Returns Promise<HostResolveResult>

    An object describing the delegated details for the host.

Generated using TypeDoc