Interface ConnectNetworkOptions

interface ConnectNetworkOptions {
    H3Transport?: typeof H3Transport;
    addRoutes?: NameLike[];
    connectTimeout?: number;
    fallback?: readonly string[];
    fastest?: number;
    fch?: false | FchRequest;
    fw?: Forwarder;
    mtu?: number;
    preferH3?: boolean;
    preferTcp?: boolean;
    testConnection?: false | TestConnectionPacket | TestConnectionPacket[] | ((face) => Promise<unknown>);
    testConnectionTimeout?: number;
    tryDefaultGateway?: boolean;
}

Hierarchy (view full)

Properties

H3Transport?: typeof H3Transport

Enable HTTP/3 transport.

Remarks

This is only relevant in browser environment.

This should be set to H3Transport class instance. Having this option avoids always pulling in H3Transport code, to reduce browser bundle size in applications that do not use it.

addRoutes?: NameLike[]

Routes to be added on the created face.

Default Value

["/"]

connectTimeout?: number

Connect timeout (in milliseconds).

fallback?: readonly string[]

Fallback routers, used if FCH and default gateway are both unavailable.

fastest?: number

Number of faces to keep; others are closed. Faces are ranked by shortest testConnection duration.

Default Value

1
fch?: false | FchRequest

FCH request, or false to disable FCH query.

Default Value

{ count: 4 }

Logical forwarder to attach faces to.

Default Value

Forwarder.getDefault()

mtu?: number

Override MTU of datagram faces.

preferH3?: boolean

Whether to try HTTP/3 before all other options.

Default Value

false

Remarks

Ignored if H3Transport is not enabled or supported.

preferTcp?: boolean

Use TCP instead of UDP.

Remarks

This is only relevant in Node.js environment.

testConnection?: false | TestConnectionPacket | TestConnectionPacket[] | ((face) => Promise<unknown>)

Test face connection.

Type declaration

    • (face): Promise<unknown>
    • Parameters

      Returns Promise<unknown>

Default Value

"/localhop/nfd/rib/list"

Remarks

  • false: skip test.
  • string or Name or Interest or array: express Interest(s) and wait for first Data reply. If string ends with "/*", it's replaced with a random component.
  • function: execute the custom tester function.
testConnectionTimeout?: number

InterestLifetime of connection test Interest packets.

Default Value

2000

Remarks

Used only if testConnection is a string or Name.

tryDefaultGateway?: boolean

Whether to consider default IPv4 gateway as a candidate.

Default Value

true

Remarks

This option has no effect if IPv4 gateway cannot be determined, e.g. in browser.

Generated using TypeDoc