RustViaduct.sys.mjs

class RustViaduct.sys.BackendAlreadyInitialized()

BackendAlreadyInitialized

class RustViaduct.sys.BackendError()

BackendError

class RustViaduct.sys.BackendNotInitialized()

BackendNotInitialized

class RustViaduct.sys.Method()

HTTP Methods.

The supported methods are the limited to what’s supported by android-components.

class RustViaduct.sys.NetworkError()

NetworkError

class RustViaduct.sys.NonTlsUrl()

NonTlsUrl

class RustViaduct.sys.OhttpChannelNotConfigured()

OhttpChannelNotConfigured

class RustViaduct.sys.OhttpConfig()

Configuration for an OHTTP channel

RustViaduct.sys.OhttpConfig.gatewayHost

type: string

The gateway host that provides encryption keys and decrypts requests

RustViaduct.sys.OhttpConfig.relayUrl

type: string

The relay URL that will proxy requests

class RustViaduct.sys.OhttpConfigFetchFailed()

OhttpConfigFetchFailed

class RustViaduct.sys.OhttpNotSupported()

OhttpNotSupported

class RustViaduct.sys.OhttpRequestError()

OhttpRequestError

class RustViaduct.sys.OhttpResponseError()

OhttpResponseError

class RustViaduct.sys.RequestHeaderError()

RequestHeaderError

class RustViaduct.sys.Response()

A response from the server.

RustViaduct.sys.Response.body

type: string

The body of the response.

RustViaduct.sys.Response.headers

type: Headers

The headers returned with this response.

RustViaduct.sys.Response.requestMethod

The method used to request this response.

RustViaduct.sys.Response.status

type: number

The HTTP Status code of this response.

RustViaduct.sys.Response.url

type: ViaductUrl

The URL of this response.

class RustViaduct.sys.SetBackendError()

SetBackendError

class RustViaduct.sys.UrlError()

Note: we return this if the server returns a bad URL with its response. This probably should never happen, but who knows.

RustViaduct.sys.allowAndroidEmulatorLoopback()

Allow non-HTTPS requests to the emulator loopback URL

RustViaduct.sys.clearOhttpChannels()

Clear all OHTTP channel configurations

RustViaduct.sys.configureDefaultOhttpChannels()

Configure default OHTTP channels for common Mozilla services This sets up: - “relay1”: For general telemetry and services through Mozilla’s shared gateway - “merino”: For Firefox Suggest recommendations through Merino’s dedicated relay/gateway

RustViaduct.sys.configureOhttpChannel(channel, config)

Configure an OHTTP channel with the given configuration If an existing OHTTP config exists with the same name, it will be overwritten

Arguments:
  • channel (string)

  • config (OhttpConfig)

RustViaduct.sys.initBackend(backend)

initBackend

Arguments:
  • backend (Backend)

RustViaduct.sys.listOhttpChannels()

List all configured OHTTP channels

Returns:

Array.<string>

RustViaduct.sys.sendOhttpRequest(request, channel)

Send a request through an OHTTP channel.

This encrypts the request and routes it through the configured OHTTP relay/gateway for the specified channel.

# Arguments * request - The request to send * channel - The name of the OHTTP channel to use (e.g., “merino”)

# Example (Kotlin) `kotlin val response = sendOhttpRequest( Request( method = Method.GET, url = "https://example.com/api", headers = mapOf("Accept" to "application/json"), body = null ), "merino" ) `

Arguments:
  • request (Request)

  • channel (string)

Returns:

Promise.<Response> – }

RustViaduct.sys.setGlobalDefaultUserAgent(userAgent)

Set the global default user-agent

This is what’s used when no user-agent is set in the ClientSettings and no user-agent header is set in the Request.

Arguments:
  • userAgent (string)