From b2f6f6f88dbd4196bbb9e2a8398e843f0264f787 Mon Sep 17 00:00:00 2001 From: "aegir[bot]" Date: Wed, 29 Nov 2023 14:29:39 +0000 Subject: [PATCH] docs: update documentation [skip ci] --- assets/highlight.css | 16 +++--- assets/navigation.js | 2 +- assets/search.js | 2 +- assets/style.css | 11 ++++ classes/stream.YamuxStream.html | 80 +++++++++++++++++++------- enums/index.FrameType.html | 9 +++ enums/index.GoAwayCode.html | 4 +- enums/stream.StreamState.html | 4 +- functions/config.verifyConfig.html | 2 +- functions/index.yamux.html | 2 +- index.html | 34 +++-------- interfaces/config.Config.html | 18 +++--- interfaces/index.FrameHeader.html | 20 +++++++ interfaces/index.YamuxMuxerInit.html | 29 ++++++++++ interfaces/stream.YamuxStreamInit.html | 32 +++++++++-- modules/config.html | 4 +- modules/index.html | 12 +++- modules/stream.html | 4 +- variables/config.defaultConfig.html | 2 +- 19 files changed, 204 insertions(+), 83 deletions(-) create mode 100644 enums/index.FrameType.html create mode 100644 interfaces/index.FrameHeader.html create mode 100644 interfaces/index.YamuxMuxerInit.html diff --git a/assets/highlight.css b/assets/highlight.css index 3a2b434..8e17baf 100644 --- a/assets/highlight.css +++ b/assets/highlight.css @@ -17,14 +17,14 @@ --dark-hl-7: #9CDCFE; --light-hl-8: #A31515; --dark-hl-8: #CE9178; - --light-hl-9: #008000; - --dark-hl-9: #6A9955; - --light-hl-10: #0000FF; - --dark-hl-10: #569CD6; - --light-hl-11: #0070C1; - --dark-hl-11: #4FC1FF; - --light-hl-12: #795E26; - --dark-hl-12: #DCDCAA; + --light-hl-9: #0000FF; + --dark-hl-9: #569CD6; + --light-hl-10: #0070C1; + --dark-hl-10: #4FC1FF; + --light-hl-11: #795E26; + --dark-hl-11: #DCDCAA; + --light-hl-12: #008000; + --dark-hl-12: #6A9955; --light-hl-13: #098658; --dark-hl-13: #B5CEA8; --light-code-background: #FFFFFF; diff --git a/assets/navigation.js b/assets/navigation.js index f6ff117..6113533 100644 --- a/assets/navigation.js +++ b/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA43SQU+DMBQH8O/SM3ERdTHczA5mZ05m4fBsX6WRFlNeNxbDd5eBQkuZ2ZHXf368f9PDNyNsiWWM10aqD5awL6Cy/9a1cBU2m3F+V5Ku+sNPZQTL0oTxUlXComHZYSJ2C0IZQiuBz8puDXvadslkCJTgKlpSR7AK3r19glwIPqSed0Sr5HnJSWc4qdpMnB8Lte1jV3heP8M2vqVhfNMlvdYvJ+j/JHBW0Dj9Z8znIffsLXEG7dq1NiMxHP/boiGLoOMa4/ymHvkQzQkoKvKreInrVd4uu+aLdXgFTTOv42VC6D69Qu2NotV3GIuXaPwgi674AWSRsoIbAwAA" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA43RTU+EMBAG4P8yZ6IRdWO4GRI/Dp7wYjYcRjq4jbRsynSFGP67ERRavrLXzpuHYd79NzDVDBFkpc7lBwRwRD5ABKoUtqDqsn+/OLAqIIBPqQVEYQDZQRbCkIZoPxDxhJCayeSYjUq8hN3u2mAwBOVoC55SJzQS3519vJwPXoeOdyIj82bK5VZnLEs9cG7M13Y3bep4Uguq51fqns860oNBRa/NkUaEtFX/xDD2sTtnhcfy/gubuBQrxDhfN7rPPBEKMot9Ocv0qa3O3lDZ+sXWZJ615A3PD26RzW9yqa8e6sabPVVsCNW8qP79rKaSLpow8uzQf4qTWD9199PJZJ2swKoa13EyPnQVrlCrl56Ly7dO2/QHybgqp/0DAAA=" \ No newline at end of file diff --git a/assets/search.js b/assets/search.js index 0a8f84e..f1aa046 100644 --- a/assets/search.js +++ b/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA8Vb227bRhD9F/pVUb03SfZb4MZFUDQt4rRBYBgGI60cIhQpkJQV1/C/d28iZ6hdmpRU5CUKpTkzh3Nmh7vL9XNU5Nsyurx9jr4n2SK6pKMoi1cyuozUpfwRjaJNkaqr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wcIMCoJBCiTl1AmQFxURCt+mO4dmdAUu5NEfPgB8Qm4RUTtzaVNq1KbhdMK4nIer1WEjqk5qNBzAgZwG8OeXaIIC+kwBiFf9I7KFMe+uotgDlizB+ZU/q7aUL9EgSKhEFz91ZTE98MB5JKGXKQ6dooFBJqMrsgh8MTNjeXTtlQbDZjangbgxQHdSeCKnm9vf2hzagIUJNdO22YvYLDtSLCMmnX/Jt3atH0ERB0tjr0Hm9XwxcAO48pJ1uaHO9F16YvXCABpUnXkVv7YY+gINb5yH+Gt5uawyMGB5qFaYNF+2SAW2YctfLQ5ppD5ncuuMqMD54IvDQkNXowr5LAUhQaDxUaBoZloyC4ca6gmMX+52dgUbJurIYfDSANIggk6qFokA8euFGbajx7OeegKAk9CB1TaodmoDQJEj4KSvqs6UAC2qdBIv1KSv1NcSBIichxe2fcuzPz2CdBaD6tdAyL7prhoGaEaFnovtzHEAdMO/C7ItEQZmzUGMA2PZcgILQ1NvR1QJgnaxlmmTK6Pbu5eU/tVXK6qs0AAA="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA8VcXW/jthL9L8qrNg0/5eSt2Hbb4KJ7i83eWxRGsNDadCJUlgxJzkeD/PcLioo0I3MUyfJFn9LGc2YO5wyHNMnsS1Dkj2VwtXwJ/kqydXDFwyCLtya4CpJsbZ6CMNgXaXAVbPP1PjXlD/Vvz++rbRqEwSqNy9KUwVUQvIZvHrRsXTzH233nYrPPVlWSZ29O6k89rsJgFxcmq1oOwLdSQrfuv32rnndmhP8z95+t/UCwBuWYd4G7tKzybJPcHeTF/XpsYh5MkWyeP2JXHf/GGbQazlNDCvBVXZp6YZKsMsUmXnWkj4rALng3njQf6f/MWQ7FaMypUCaLv6fmX8bsfkyTBzMy7CFqBoW/3txc25gPcTqShA83g8Y2frrOvuf7bH1TFSbeliNp+HDzaPx7Xx3H4xA4g0iSJVUSp87XH0m2zh9vkr/HVgiNnpebI+n4kfOo/GbKMr4z01hg0DQComuba7OJ92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7rV4UHwyA06ogZdv8Up3VsckESYRWrMBr7eBuQvQb4uCOymfX4NEn0BgIwC1hcMINGg4DQ1yI09X71v7oc6rARMFTXKGtuvcqVAVEUg70xVVCit3WHHS8CbspRUiu5MZS9DN+5+FrAG2ihqXtzlcX3sDCiDwWpqsA62qm9LQUQwWkWN1l2x9+eBZABKaeqgj/Xp0r65BwAuQFkoKlnNH1F2KACiMQlSh4Fpw6IBUBKn7rrJUS7rEyfgB8RmTdOLqB6QNPegxt2DgmGD9qcWBLqd/Ul7fNx5AH1r0bCgyuXtCguUCyhVTbWg+tQfYACkCUhJvo2fEnekXL6d1XZ+wMgvGz8Ug238tHXnfgcqgMbAmpUgovK4jZ/y5uzYwwfMHHbReKKmwTZ+GqwNMB9Ys0BGVK2580XQPuDi2gxJUNWd1Q8MKvjAABQXKHVFleauviYD8gJdNJXJ5p3LYdcC3BXVp3fNk4TDyQBqWVHpso9dH5snuGApAxkX70NX7bsp4AJwF9TAba9e2TdhRf0mDKBB2uS76Ef3sA3AwdAlxd/C+61XgOkoqXKtV5iiX2dgheGyWaYozayHzDy+/SkgiA86iKTmr0UX7k0hQILqlFR1WiQtGQdzVgwFxy4OVx8BmrkYyiK5fIE0KJJJ1UNxIB5v9nCCaqaHuWcgKCNZ1zC86VZAek2tFk2L7HNmgDMjZXvOivYPDgEWTBJG7U7K56ys/0wS4MDsYNTkOti9gZagqaS6fxTgcG8Oq5qGlr2Gq0AZaapl20ecm7wYrmwBKltSmaKKUYF0aaqZNP+aBEgyyPEQZmuv0Pq7Kg1GHlEjr+GHZcxBI+CUugDbj80Bc+5tYLdhsEt2Jk0yE1wtb19f/weKZR+AqUMAAA=="; \ No newline at end of file diff --git a/assets/style.css b/assets/style.css index 108428c..07a385b 100644 --- a/assets/style.css +++ b/assets/style.css @@ -11,6 +11,7 @@ --light-color-text-aside: #6e6e6e; --light-color-link: #1f70c2; + --light-color-ts-keyword: #056bd6; --light-color-ts-project: #b111c9; --light-color-ts-module: var(--light-color-ts-project); --light-color-ts-namespace: var(--light-color-ts-project); @@ -50,6 +51,7 @@ --dark-color-text-aside: #dddddd; --dark-color-link: #00aff4; + --dark-color-ts-keyword: #3399ff; --dark-color-ts-project: #e358ff; --dark-color-ts-module: var(--dark-color-ts-project); --dark-color-ts-namespace: var(--dark-color-ts-project); @@ -91,6 +93,7 @@ --color-text-aside: var(--light-color-text-aside); --color-link: var(--light-color-link); + --color-ts-keyword: var(--light-color-ts-keyword); --color-ts-module: var(--light-color-ts-module); --color-ts-namespace: var(--light-color-ts-namespace); --color-ts-enum: var(--light-color-ts-enum); @@ -132,6 +135,7 @@ --color-text-aside: var(--dark-color-text-aside); --color-link: var(--dark-color-link); + --color-ts-keyword: var(--dark-color-ts-keyword); --color-ts-module: var(--dark-color-ts-module); --color-ts-namespace: var(--dark-color-ts-namespace); --color-ts-enum: var(--dark-color-ts-enum); @@ -180,6 +184,7 @@ body { --color-text-aside: var(--light-color-text-aside); --color-link: var(--light-color-link); + --color-ts-keyword: var(--light-color-ts-keyword); --color-ts-module: var(--light-color-ts-module); --color-ts-namespace: var(--light-color-ts-namespace); --color-ts-enum: var(--light-color-ts-enum); @@ -219,6 +224,7 @@ body { --color-text-aside: var(--dark-color-text-aside); --color-link: var(--dark-color-link); + --color-ts-keyword: var(--dark-color-ts-keyword); --color-ts-module: var(--dark-color-ts-module); --color-ts-namespace: var(--dark-color-ts-namespace); --color-ts-enum: var(--dark-color-ts-enum); @@ -984,6 +990,11 @@ a.tsd-index-link { overflow-x: auto; } +.tsd-signature-keyword { + color: var(--color-ts-keyword); + font-weight: normal; +} + .tsd-signature-symbol { color: var(--color-text-aside); font-weight: normal; diff --git a/classes/stream.YamuxStream.html b/classes/stream.YamuxStream.html index bd1a05f..8796e1b 100644 --- a/classes/stream.YamuxStream.html +++ b/classes/stream.YamuxStream.html @@ -1,50 +1,90 @@ -YamuxStream | @chainsafe/libp2p-yamux - v5.0.3

YamuxStream is used to represent a logical stream within a session

-

Hierarchy

Constructors

constructor +YamuxStream | @chainsafe/libp2p-yamux

YamuxStream is used to represent a logical stream within a session

+

Hierarchy

Constructors

Properties

_id: number
config: Config
epochStart: number

An 'epoch' is the time it takes to process and read data

+

Constructors

Properties

_id: number
config: Config
direction: Direction
epochStart: number

An 'epoch' is the time it takes to process and read data

Used in conjunction with RTT to determine whether to increase the recvWindow

-
getRTT: (() => number)

Type declaration

    • (): number
    • Returns number

name?: string
recvWindow: number

The number of bytes available to receive in a full window

-
recvWindowCapacity: number

The number of available bytes to receive

-
sendFrame: ((header, body?) => void)

Type declaration

sendWindowCapacity: number

The number of available bytes to send

-
sendWindowCapacityUpdate?: (() => void)

Type declaration

    • (): void
    • Callback to notify that the sendWindowCapacity has been updated

      -

      Returns void

Methods

  • getSendFlags determines any flags that are appropriate +

getRTT: (() => number)

Type declaration

    • (): number
    • Returns number

id: string
log: Logger
metadata: Record<string, unknown>
name?: string
protocol?: string
readStatus: ReadStatus
recvWindow: number

The number of bytes available to receive in a full window

+
recvWindowCapacity: number

The number of available bytes to receive

+
sendFrame: ((header, body?) => void)

Type declaration

sendWindowCapacity: number

The number of available bytes to send

+
sendWindowCapacityUpdate?: (() => void)

Type declaration

    • (): void
    • Callback to notify that the sendWindowCapacity has been updated

      +

      Returns void

source: AsyncGenerator<Uint8ArrayList, void, unknown>
status: StreamStatus
timeline: StreamTimeline
writeStatus: WriteStatus

Methods

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Close immediately for reading and writing and send a reset message (local +error)

    +

    Parameters

    Returns void

  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • The underlying muxer has closed, no more messages can be sent or will +be received, close immediately to free up resources

    +

    Returns void

  • getSendFlags determines any flags that are appropriate based on the current stream state.

    The state is updated as a side-effect.

    -

    Returns number

  • handleWindowUpdate is called when the stream receives a window update frame

    -

    Parameters

    Returns void

  • processFlags is used to update the state of the stream based on set flags, if any.

    -

    Parameters

    • flags: number

    Returns void

  • Send a message to the remote muxer, informing them no more data messages +

    Returns number

  • handleWindowUpdate is called when the stream receives a window update frame

    +

    Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • processFlags is used to update the state of the stream based on set flags, if any.

    +

    Parameters

    • flags: number

    Returns void

  • The remote closed for reading so we should not send any more +messages

    +

    Returns void

  • The remote closed for writing so we should expect to receive no more +messages

    +

    Returns void

  • Receive a reset message - close immediately for reading and writing (remote +error)

    +

    Returns void

  • Send a message to the remote muxer, informing them no more data messages will be read by this end of the stream

    -

    Returns Promise<void>

  • Send a message to the remote muxer, informing them no more data messages +

    Returns Promise<void>

  • Send a message to the remote muxer, informing them no more data messages will be sent by this end of the stream

    -

    Returns Promise<void>

  • Send a message to the remote muxer informing them a new stream is being +

    Returns Promise<void>

  • Send a message to the remote muxer informing them a new stream is being opened.

    This is a noop for Yamux because the first window update is sent when .newStream is called on the muxer which opens the stream on the remote.

    -

    Returns Promise<void>

  • Send a reset message to the remote muxer

    -

    Returns Promise<void>

  • potentially sends a window update enabling further writes to take place.

    -

    Returns void

  • Wait for the send window to be non-zero

    +

    Returns Promise<void>

  • potentially sends a window update enabling further writes to take place.

    +

    Returns void

  • When an extending class reads data from it's implementation-specific source, +call this method to allow the stream consumer to read the data.

    +

    Parameters

    Returns void

  • Returns the amount of unread data - can be used to prevent large amounts of +data building up when the stream consumer is too slow.

    +

    Returns number

  • Wait for the send window to be non-zero

    Will throw with ERR_STREAM_ABORT if the stream gets aborted

    -

    Parameters

    Returns Promise<void>

\ No newline at end of file +

Parameters

Returns Promise<void>

Generated using TypeDoc

\ No newline at end of file diff --git a/enums/index.FrameType.html b/enums/index.FrameType.html new file mode 100644 index 0000000..dff2f9b --- /dev/null +++ b/enums/index.FrameType.html @@ -0,0 +1,9 @@ +FrameType | @chainsafe/libp2p-yamux

Enumeration Members

Enumeration Members

Data: 0

Used to transmit data. May transmit zero length payloads depending on the flags.

+
GoAway: 3

Used to close a session.

+
Ping: 2

Used to measure RTT. It can also be used to heart-beat and do keep-alives over TCP.

+
WindowUpdate: 1

Used to updated the senders receive window size. This is used to implement per-session flow control.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/enums/index.GoAwayCode.html b/enums/index.GoAwayCode.html index bbdf125..73f755d 100644 --- a/enums/index.GoAwayCode.html +++ b/enums/index.GoAwayCode.html @@ -1,4 +1,4 @@ -GoAwayCode | @chainsafe/libp2p-yamux - v5.0.3

Enumeration Members

InternalError +GoAwayCode | @chainsafe/libp2p-yamux

Enumeration Members

InternalError: 2
NormalTermination: 0
ProtocolError: 1
\ No newline at end of file +

Enumeration Members

InternalError: 2
NormalTermination: 0
ProtocolError: 1

Generated using TypeDoc

\ No newline at end of file diff --git a/enums/stream.StreamState.html b/enums/stream.StreamState.html index 2744231..fa79ee5 100644 --- a/enums/stream.StreamState.html +++ b/enums/stream.StreamState.html @@ -1,6 +1,6 @@ -StreamState | @chainsafe/libp2p-yamux - v5.0.3

Enumeration Members

Established +StreamState | @chainsafe/libp2p-yamux

Enumeration Members

Established: 3
Finished: 4
Init: 0
SYNReceived: 2
SYNSent: 1
\ No newline at end of file +

Enumeration Members

Established: 3
Finished: 4
Init: 0
SYNReceived: 2
SYNSent: 1

Generated using TypeDoc

\ No newline at end of file diff --git a/functions/config.verifyConfig.html b/functions/config.verifyConfig.html index c926cd9..a9d775f 100644 --- a/functions/config.verifyConfig.html +++ b/functions/config.verifyConfig.html @@ -1 +1 @@ -verifyConfig | @chainsafe/libp2p-yamux - v5.0.3
\ No newline at end of file +verifyConfig | @chainsafe/libp2p-yamux

Generated using TypeDoc

\ No newline at end of file diff --git a/functions/index.yamux.html b/functions/index.yamux.html index 968be19..8d30cd6 100644 --- a/functions/index.yamux.html +++ b/functions/index.yamux.html @@ -1 +1 @@ -yamux | @chainsafe/libp2p-yamux - v5.0.3
\ No newline at end of file +yamux | @chainsafe/libp2p-yamux

Generated using TypeDoc

\ No newline at end of file diff --git a/index.html b/index.html index bf4f006..da13cd2 100644 --- a/index.html +++ b/index.html @@ -1,40 +1,20 @@ -@chainsafe/libp2p-yamux - v5.0.3

@chainsafe/libp2p-yamux - v5.0.3

@chainsafe/libp2p-yamux

codecov +@chainsafe/libp2p-yamux

@chainsafe/libp2p-yamux

codecov CI

Yamux stream multiplexer for libp2p

-

Table of contents

-

Install

$ npm i @chainsafe/libp2p-yamux
+

Install

$ npm i @chainsafe/libp2p-yamux
 
-

Browser <script> tag

Loading this module through a script tag will make it's exports available as ChainsafeLibp2pYamux in the global namespace.

+

Browser <script> tag

Loading this module through a script tag will make it's exports available as ChainsafeLibp2pYamux in the global namespace.

<script src="https://unpkg.com/@chainsafe/libp2p-yamux/dist/index.min.js"></script>
 
-

Usage

import { yamux } from '@chainsafe/libp2p-yamux'
import { pipe } from 'it-pipe'
import { duplexPair } from 'it-pair/duplex'
import all from 'it-all'

// Connect two yamux muxers to demo basic stream multiplexing functionality

const clientMuxer = yamux({
client: true,
onIncomingStream: stream => {
// echo data on incoming streams
pipe(stream, stream)
},
onStreamEnd: stream => {
// do nothing
}
})()

const serverMuxer = yamux({
client: false,
onIncomingStream: stream => {
// echo data on incoming streams
pipe(stream, stream)
},
onStreamEnd: stream => {
// do nothing
}
})()

// `p` is our "connections", what we use to connect the two sides
// In a real application, a connection is usually to a remote computer
const p = duplexPair()

// connect the muxers together
pipe(p[0], clientMuxer, p[0])
pipe(p[1], serverMuxer, p[1])

// now either side can open streams
const stream0 = clientMuxer.newStream()
const stream1 = serverMuxer.newStream()

// Send some data to the other side
const encoder = new TextEncoder()
const data = [encoder.encode('hello'), encoder.encode('world')]
pipe(data, stream0)

// Receive data back
const result = await pipe(stream0, all)

// close a stream
stream1.close()

// close the muxer
clientMuxer.close() -
-

API

This library implements the StreamMuxerFactory, StreamMuxer and Stream interfaces defined in @libp2p/interfaces/stream-muxer.

-

Contribute

The libp2p implementation in JavaScript is a work in progress. As such, there are a few things you can do right now to help out:

-
    -
  • Go through the modules and check out existing issues. This is especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
  • -
  • Perform code reviews. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
  • -
-

API Docs

\ No newline at end of file +

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/interfaces/config.Config.html b/interfaces/config.Config.html index efa9716..d709d64 100644 --- a/interfaces/config.Config.html +++ b/interfaces/config.Config.html @@ -1,4 +1,4 @@ -Config | @chainsafe/libp2p-yamux - v5.0.3

Hierarchy

  • Config

Properties

enableKeepAlive +Config | @chainsafe/libp2p-yamux
interface Config {
    enableKeepAlive: boolean;
    initialStreamWindowSize: number;
    keepAliveInterval: number;
    log?: Logger;
    maxInboundStreams: number;
    maxMessageSize: number;
    maxOutboundStreams: number;
    maxStreamWindowSize: number;
}

Properties

enableKeepAlive: boolean

Used to do periodic keep alive messages using a ping.

-
initialStreamWindowSize: number

Used to control the initial window size that we allow for a stream.

+
initialStreamWindowSize: number

Used to control the initial window size that we allow for a stream.

measured in bytes

-
keepAliveInterval: number

How often to perform the keep alive

+
keepAliveInterval: number

How often to perform the keep alive

measured in milliseconds

-
log?: Logger

Used to control the log destination

+
log?: Logger

Used to control the log destination

It can be disabled by explicitly setting to undefined

-
maxInboundStreams: number

Maximum number of concurrent inbound streams that we accept. +

maxInboundStreams: number

Maximum number of concurrent inbound streams that we accept. If the peer tries to open more streams, those will be reset immediately.

-
maxMessageSize: number

Maximum size of a message that we'll send on a stream. +

maxMessageSize: number

Maximum size of a message that we'll send on a stream. This ensures that a single stream doesn't hog a connection.

-
maxOutboundStreams: number

Maximum number of concurrent outbound streams that we accept. +

maxOutboundStreams: number

Maximum number of concurrent outbound streams that we accept. If the application tries to open more streams, the call to newStream will throw

-
maxStreamWindowSize: number

Used to control the maximum window size that we allow for a stream.

-
\ No newline at end of file +
maxStreamWindowSize: number

Used to control the maximum window size that we allow for a stream.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/interfaces/index.FrameHeader.html b/interfaces/index.FrameHeader.html new file mode 100644 index 0000000..a9a1aeb --- /dev/null +++ b/interfaces/index.FrameHeader.html @@ -0,0 +1,20 @@ +FrameHeader | @chainsafe/libp2p-yamux
interface FrameHeader {
    flag: number;
    length: number;
    streamID: number;
    type: FrameType;
    version?: number;
}

Properties

Properties

flag: number

The flags field is used to provide additional information related to the message type.

+
length: number

The meaning of the length field depends on the message type:

+
    +
  • Data - provides the length of bytes following the header
  • +
  • Window update - provides a delta update to the window size
  • +
  • Ping - Contains an opaque value, echoed back
  • +
  • Go Away - Contains an error code
  • +
+
streamID: number

The StreamID field is used to identify the logical stream the frame is addressing. +The client side should use odd ID's, and the server even. +This prevents any collisions. Additionally, the 0 ID is reserved to represent the session.

+
type: FrameType

The type field is used to switch the frame message type.

+
version?: number

The version field is used for future backward compatibility. +At the current time, the field is always set to 0, to indicate the initial version.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/interfaces/index.YamuxMuxerInit.html b/interfaces/index.YamuxMuxerInit.html new file mode 100644 index 0000000..f3d1f53 --- /dev/null +++ b/interfaces/index.YamuxMuxerInit.html @@ -0,0 +1,29 @@ +YamuxMuxerInit | @chainsafe/libp2p-yamux
interface YamuxMuxerInit {
    direction?: Direction;
    enableKeepAlive?: boolean;
    initialStreamWindowSize?: number;
    keepAliveInterval?: number;
    log?: Logger;
    maxInboundStreams?: number;
    maxMessageSize?: number;
    maxOutboundStreams?: number;
    maxStreamWindowSize?: number;
    onIncomingStream?(stream): void;
    onStreamEnd?(stream): void;
}

Hierarchy

Properties

direction?: Direction

Outbound stream muxers are opened by the local node, inbound stream muxers are opened by the remote

+
enableKeepAlive?: boolean

Used to do periodic keep alive messages using a ping.

+
initialStreamWindowSize?: number

Used to control the initial window size that we allow for a stream.

+

measured in bytes

+
keepAliveInterval?: number

How often to perform the keep alive

+

measured in milliseconds

+
log?: Logger

Used to control the log destination

+

It can be disabled by explicitly setting to undefined

+
maxInboundStreams?: number

Maximum number of concurrent inbound streams that we accept. +If the peer tries to open more streams, those will be reset immediately.

+
maxMessageSize?: number

Maximum size of a message that we'll send on a stream. +This ensures that a single stream doesn't hog a connection.

+
maxOutboundStreams?: number

Maximum number of concurrent outbound streams that we accept. +If the application tries to open more streams, the call to newStream will throw

+
maxStreamWindowSize?: number

Used to control the maximum window size that we allow for a stream.

+

Methods

  • A callback function invoked every time an incoming stream is opened

    +

    Parameters

    Returns void

  • A callback function invoke every time a stream ends

    +

    Parameters

    Returns void

Generated using TypeDoc

\ No newline at end of file diff --git a/interfaces/stream.YamuxStreamInit.html b/interfaces/stream.YamuxStreamInit.html index 50417df..178edbf 100644 --- a/interfaces/stream.YamuxStreamInit.html +++ b/interfaces/stream.YamuxStreamInit.html @@ -1,6 +1,30 @@ -YamuxStreamInit | @chainsafe/libp2p-yamux - v5.0.3

Hierarchy

Properties

config -getRTT +YamuxStreamInit | @chainsafe/libp2p-yamux
interface YamuxStreamInit {
    closeTimeout?: number;
    config: Config;
    direction: Direction;
    id: string;
    log: Logger;
    metadata?: Record<string, unknown>;
    name?: string;
    sendCloseWriteTimeout?: number;
    state: StreamState;
    getRTT(): number;
    onAbort?(err): void;
    onCloseRead?(): void;
    onCloseWrite?(): void;
    onEnd?(err?): void;
    onReset?(): void;
    sendFrame(header, body?): void;
}

Hierarchy

Properties

config: Config
getRTT: (() => number)

Type declaration

    • (): number
    • Returns number

name?: string
sendFrame: ((header, body?) => void)

Type declaration

\ No newline at end of file +

Methods

Properties

closeTimeout?: number

How long to wait in ms for stream data to be written to the underlying +connection when closing the writable end of the stream. (default: 500)

+
config: Config
direction: Direction

The stream direction

+
id: string

A unique identifier for this stream

+
log: Logger

A Logger implementation used to log stream-specific information

+
metadata?: Record<string, unknown>

User specific stream metadata

+
name?: string
sendCloseWriteTimeout?: number

After the stream sink has closed, a limit on how long it takes to send +a close-write message to the remote peer.

+

Methods

  • Invoked when the the stream has errored

    +

    Parameters

    Returns void

  • Invoked when the readable end of the stream is closed

    +

    Returns void

  • Invoked when the writable end of the stream is closed

    +

    Returns void

  • Invoked when the stream ends

    +

    Parameters

    Returns void

  • Invoked when the the stream has been reset by the remote

    +

    Returns void

Generated using TypeDoc

\ No newline at end of file diff --git a/modules/config.html b/modules/config.html index 557319b..1f2500f 100644 --- a/modules/config.html +++ b/modules/config.html @@ -1,4 +1,4 @@ -config | @chainsafe/libp2p-yamux - v5.0.3

Index

Interfaces

Config +config | @chainsafe/libp2p-yamux

Index

Interfaces

Variables

Functions

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/modules/index.html b/modules/index.html index 501639f..a482e9b 100644 --- a/modules/index.html +++ b/modules/index.html @@ -1,3 +1,11 @@ -index | @chainsafe/libp2p-yamux - v5.0.3

Index

Enumerations

GoAwayCode +index | @chainsafe/libp2p-yamux

This module is a JavaScript implementation of Yamux from Hashicorp designed to be used with js-libp2p.

+

Example: Configure libp2p with Yamux

import { createLibp2p } from 'libp2p'
import { yamux } from '@chainsafe/libp2p-yamux'

const node = await createLibp2p({
// ... other options
streamMuxers: [
yamux()
]
}) +
+

Example: Using the low-level API

import { yamux } from '@chainsafe/libp2p-yamux'
import { pipe } from 'it-pipe'
import { duplexPair } from 'it-pair/duplex'
import all from 'it-all'

// Connect two yamux muxers to demo basic stream multiplexing functionality

const clientMuxer = yamux({
client: true,
onIncomingStream: stream => {
// echo data on incoming streams
pipe(stream, stream)
},
onStreamEnd: stream => {
// do nothing
}
})()

const serverMuxer = yamux({
client: false,
onIncomingStream: stream => {
// echo data on incoming streams
pipe(stream, stream)
},
onStreamEnd: stream => {
// do nothing
}
})()

// `p` is our "connections", what we use to connect the two sides
// In a real application, a connection is usually to a remote computer
const p = duplexPair()

// connect the muxers together
pipe(p[0], clientMuxer, p[0])
pipe(p[1], serverMuxer, p[1])

// now either side can open streams
const stream0 = clientMuxer.newStream()
const stream1 = serverMuxer.newStream()

// Send some data to the other side
const encoder = new TextEncoder()
const data = [encoder.encode('hello'), encoder.encode('world')]
pipe(data, stream0)

// Receive data back
const result = await pipe(stream0, all)

// close a stream
stream1.close()

// close the muxer
clientMuxer.close() +
+

Index

Enumerations

Interfaces

Functions

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/modules/stream.html b/modules/stream.html index 20d2fee..4718eb9 100644 --- a/modules/stream.html +++ b/modules/stream.html @@ -1,4 +1,4 @@ -stream | @chainsafe/libp2p-yamux - v5.0.3

Index

Enumerations

StreamState +stream | @chainsafe/libp2p-yamux

Index

Enumerations

Classes

Interfaces

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/variables/config.defaultConfig.html b/variables/config.defaultConfig.html index 4e1dddc..ee51cc8 100644 --- a/variables/config.defaultConfig.html +++ b/variables/config.defaultConfig.html @@ -1 +1 @@ -defaultConfig | @chainsafe/libp2p-yamux - v5.0.3

Variable defaultConfigConst

defaultConfig: Config = ...
\ No newline at end of file +defaultConfig | @chainsafe/libp2p-yamux

Variable defaultConfigConst

defaultConfig: Config = ...

Generated using TypeDoc

\ No newline at end of file