import { type ClientOptions } from "https://deno.land/x/smoldot@light-js-deno-v0.7.9/client.d.ts";
Configuration of a client.
Properties
Callback that the client will invoke in order to report a log event.
By default, prints the log on the console
. If you want to disable logging altogether,
please pass an empty callback function.
The client will never call the callback with a value of level
superior to this value.
Defaults to 3.
While this filtering could be done directly by the logCallback
, passing a maximum log level
leads to better performances as the client doesn't even need to generate a message
when it
knows that this message isn't interesting.
Maximum amount of CPU that the client should consume on average.
This must be a number between 0.0
and 1.0
. For example, passing 0.25
bounds the client
to 25% of CPU power.
Defaults to 1.0
if no value is provided.
Note that this is implemented by sleeping for certain amounts of time in order for the average CPU consumption to not go beyond the given limit. It is therefore still possible for the client to use high amounts of CPU for short amounts of time.
If true
, then the client will never open any TCP connection.
Defaults to false
.
This option can be used in order to mimic an environment where the TCP protocol isn't supported (e.g. browsers) from an environment where TCP is supported (e.g. NodeJS).
This option has no effect in environments where the TCP protocol isn't supported anyway.
If true
, then the client will never open any non-secure WebSocket connection.
Defaults to false
.
This option can be used in order to mimic an environment where non-secure WebSocket connections aren't supported (e.g. web pages) from an environment where they are supported (e.g. NodeJS).
This option has no effect in environments where non-secure WebSocket connections aren't supported anyway.
If true
, then the client will never open any non-secure WebSocket connection to addresses
other than localhost
or 127.0.0.1
.
Defaults to false
.
This option is similar to forbidWs
, except that connections to localhost
and 127.0.0.1
do not take the value of this option into account.
This option can be used in order to mimic an environment where non-secure WebSocket connections aren't supported (e.g. web pages) from an environment where they are supported (e.g. NodeJS).
This option has no effect in environments where non-secure WebSocket connections aren't supported anyway.
If true
, then the client will never open any secure WebSocket connection.
Defaults to false
.
This option exists of the sake of completeness. All environments support secure WebSocket connections.