From 0a29189d3abec3c192ca830c32b217151fab9b12 Mon Sep 17 00:00:00 2001 From: "aegir[bot]" Date: Thu, 8 Feb 2024 08:05:59 +0000 Subject: [PATCH] docs: update documentation [skip ci] --- assets/highlight.css | 56 +++++++++++----------- assets/main.js | 4 +- assets/style.css | 50 +++++++++++++------ classes/stream.YamuxStream.html | 51 ++++++++++---------- enums/index.FrameType.html | 10 ++-- enums/index.GoAwayCode.html | 4 +- enums/stream.StreamState.html | 4 +- functions/config.verifyConfig.html | 2 +- functions/index.yamux.html | 2 +- index.html | 11 +++-- interfaces/config.Config.html | 16 +++---- interfaces/index.FrameHeader.html | 12 ++--- interfaces/index.YamuxMuxerComponents.html | 4 +- interfaces/index.YamuxMuxerInit.html | 18 +++---- interfaces/stream.YamuxStreamInit.html | 10 ++-- modules/config.html | 4 +- modules/index.html | 8 ++-- modules/stream.html | 4 +- variables/config.defaultConfig.html | 2 +- 19 files changed, 149 insertions(+), 123 deletions(-) diff --git a/assets/highlight.css b/assets/highlight.css index 8e17baf..a8e7b6d 100644 --- a/assets/highlight.css +++ b/assets/highlight.css @@ -1,32 +1,32 @@ :root { - --light-hl-0: #000000; - --dark-hl-0: #D4D4D4; - --light-hl-1: #800000; - --dark-hl-1: #808080; - --light-hl-2: #800000; - --dark-hl-2: #569CD6; - --light-hl-3: #000000FF; - --dark-hl-3: #D4D4D4; - --light-hl-4: #E50000; - --dark-hl-4: #9CDCFE; - --light-hl-5: #0000FF; - --dark-hl-5: #CE9178; - --light-hl-6: #AF00DB; - --dark-hl-6: #C586C0; - --light-hl-7: #001080; - --dark-hl-7: #9CDCFE; - --light-hl-8: #A31515; - --dark-hl-8: #CE9178; - --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-hl-0: #AF00DB; + --dark-hl-0: #C586C0; + --light-hl-1: #000000; + --dark-hl-1: #D4D4D4; + --light-hl-2: #001080; + --dark-hl-2: #9CDCFE; + --light-hl-3: #A31515; + --dark-hl-3: #CE9178; + --light-hl-4: #0000FF; + --dark-hl-4: #569CD6; + --light-hl-5: #0070C1; + --dark-hl-5: #4FC1FF; + --light-hl-6: #795E26; + --dark-hl-6: #DCDCAA; + --light-hl-7: #008000; + --dark-hl-7: #6A9955; + --light-hl-8: #098658; + --dark-hl-8: #B5CEA8; + --light-hl-9: #800000; + --dark-hl-9: #808080; + --light-hl-10: #800000; + --dark-hl-10: #569CD6; + --light-hl-11: #000000FF; + --dark-hl-11: #D4D4D4; + --light-hl-12: #E50000; + --dark-hl-12: #9CDCFE; + --light-hl-13: #0000FF; + --dark-hl-13: #CE9178; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } diff --git a/assets/main.js b/assets/main.js index d0aa8d5..7270cff 100644 --- a/assets/main.js +++ b/assets/main.js @@ -1,8 +1,8 @@ "use strict"; "use strict";(()=>{var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Pe(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. `,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` - ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){D||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!D&&this.active&&n.target.closest(".col-sidebar")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } -`}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var Z=class extends C{constructor(n){super(n);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let r=Q.getItem(this.key);this.el.open=r?r==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let i=this.summary.querySelector("a");i&&i.addEventListener("click",()=>{location.assign(i.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); + ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(F,n=>this.onDocumentPointerDown(n)),document.addEventListener(B,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } +`,this.handleValueChange()}fromLocalStorage(){let e=Q.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){Q.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(e=>{e.style.display="block";let n=Array.from(e.querySelectorAll(".tsd-index-link")).every(r=>r.offsetParent==null);e.style.display=n?"none":"block"})}};var Z=class extends C{constructor(e){super(e),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let r=this.summary.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); /*! Bundled license information: lunr/lunr.js: diff --git a/assets/style.css b/assets/style.css index 07a385b..98a4377 100644 --- a/assets/style.css +++ b/assets/style.css @@ -29,7 +29,7 @@ --light-color-ts-constructor-signature: var(--light-color-ts-constructor); --light-color-ts-parameter: var(--light-color-ts-variable); /* type literal not included as links will never be generated to it */ - --light-color-ts-type-parameter: var(--light-color-ts-type-alias); + --light-color-ts-type-parameter: #a55c0e; --light-color-ts-accessor: var(--light-color-ts-property); --light-color-ts-get-signature: var(--light-color-ts-accessor); --light-color-ts-set-signature: var(--light-color-ts-accessor); @@ -69,7 +69,7 @@ --dark-color-ts-constructor-signature: var(--dark-color-ts-constructor); --dark-color-ts-parameter: var(--dark-color-ts-variable); /* type literal not included as links will never be generated to it */ - --dark-color-ts-type-parameter: var(--dark-color-ts-type-alias); + --dark-color-ts-type-parameter: #e07d13; --dark-color-ts-accessor: var(--dark-color-ts-property); --dark-color-ts-get-signature: var(--dark-color-ts-accessor); --dark-color-ts-set-signature: var(--dark-color-ts-accessor); @@ -266,12 +266,12 @@ h6 { line-height: 1.2; } -h1 > a, -h2 > a, -h3 > a, -h4 > a, -h5 > a, -h6 > a { +h1 > a:not(.link), +h2 > a:not(.link), +h3 > a:not(.link), +h4 > a:not(.link), +h5 > a:not(.link), +h6 > a:not(.link) { text-decoration: none; color: var(--color-text); } @@ -649,6 +649,28 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { font-weight: bold; } +.tsd-full-hierarchy:not(:last-child) { + margin-bottom: 1em; + padding-bottom: 1em; + border-bottom: 1px solid var(--color-accent); +} +.tsd-full-hierarchy, +.tsd-full-hierarchy ul { + list-style: none; + margin: 0; + padding: 0; +} +.tsd-full-hierarchy ul { + padding-left: 1.5rem; +} +.tsd-full-hierarchy a { + padding: 0.25rem 0 !important; + font-size: 1rem; + display: inline-flex; + align-items: center; + color: var(--color-text); +} + .tsd-panel-group.tsd-index-group { margin-bottom: 0; } @@ -714,12 +736,15 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { } .tsd-navigation > a, .tsd-navigation .tsd-accordion-summary { - width: calc(100% - 0.5rem); + width: calc(100% - 0.25rem); + display: flex; + align-items: center; } .tsd-navigation a, .tsd-navigation summary > span, .tsd-page-navigation a { - display: inline-flex; + display: flex; + width: calc(100% - 0.25rem); align-items: center; padding: 0.25rem; color: var(--color-text); @@ -759,11 +784,6 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { margin-left: -1.5rem; } -.tsd-nested-navigation > li > a, -.tsd-nested-navigation > li > span { - width: calc(100% - 1.75rem - 0.5rem); -} - .tsd-page-navigation ul { padding-left: 1.75rem; } diff --git a/classes/stream.YamuxStream.html b/classes/stream.YamuxStream.html index 157ccac..06c65d0 100644 --- a/classes/stream.YamuxStream.html +++ b/classes/stream.YamuxStream.html @@ -1,5 +1,5 @@ YamuxStream | @chainsafe/libp2p-yamux

YamuxStream is used to represent a logical stream within a session

-

Hierarchy

Constructors

Hierarchy

Constructors

Properties

_id: number
config: Config
direction: Direction
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

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 +

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)

Callback to notify that the sendWindowCapacity has been updated

+

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 +

    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 +

    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

  • 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 +

    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 +

    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 +

    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 +

    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>

  • 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, +

    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 +

    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

    +

    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>

Generated using TypeDoc

\ 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 index 6db23d6..52229ad 100644 --- a/enums/index.FrameType.html +++ b/enums/index.FrameType.html @@ -1,9 +1,9 @@ -FrameType | @chainsafe/libp2p-yamux

Enumeration Members

Data +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 +
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 9568525..8be6360 100644 --- a/enums/index.GoAwayCode.html +++ b/enums/index.GoAwayCode.html @@ -1,4 +1,4 @@ -GoAwayCode | @chainsafe/libp2p-yamux

Enumeration Members

InternalError +GoAwayCode | @chainsafe/libp2p-yamux

Enumeration Members

InternalError: 2
NormalTermination: 0
ProtocolError: 1

Generated using TypeDoc

\ 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 be8fdb0..e5841fd 100644 --- a/enums/stream.StreamState.html +++ b/enums/stream.StreamState.html @@ -1,6 +1,6 @@ -StreamState | @chainsafe/libp2p-yamux

Enumeration Members

Established +StreamState | @chainsafe/libp2p-yamux

Enumeration Members

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

Generated using TypeDoc

\ 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 17604bf..47fe093 100644 --- a/functions/config.verifyConfig.html +++ b/functions/config.verifyConfig.html @@ -1 +1 @@ -verifyConfig | @chainsafe/libp2p-yamux

Generated using TypeDoc

\ 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 eadaf73..e604295 100644 --- a/functions/index.yamux.html +++ b/functions/index.yamux.html @@ -1 +1 @@ -yamux | @chainsafe/libp2p-yamux

Generated using TypeDoc

\ 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 da13cd2..e064f31 100644 --- a/index.html +++ b/index.html @@ -3,10 +3,15 @@

Yamux stream multiplexer for libp2p

-

Install

$ npm i @chainsafe/libp2p-yamux
+

About

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() +
+

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.

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

API Docs

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 +

Generated using TypeDoc

\ No newline at end of file diff --git a/interfaces/config.Config.html b/interfaces/config.Config.html index 997f05d..963798c 100644 --- a/interfaces/config.Config.html +++ b/interfaces/config.Config.html @@ -1,4 +1,4 @@ -Config | @chainsafe/libp2p-yamux
interface Config {
    enableKeepAlive: boolean;
    initialStreamWindowSize: number;
    keepAliveInterval: number;
    maxInboundStreams: number;
    maxMessageSize: number;
    maxOutboundStreams: number;
    maxStreamWindowSize: number;
}

Properties

enableKeepAlive +Config | @chainsafe/libp2p-yamux
interface Config {
    enableKeepAlive: boolean;
    initialStreamWindowSize: number;
    keepAliveInterval: number;
    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

-
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.

-

Generated using TypeDoc

\ 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 index 92ffcc4..b411535 100644 --- a/interfaces/index.FrameHeader.html +++ b/interfaces/index.FrameHeader.html @@ -1,20 +1,20 @@ -FrameHeader | @chainsafe/libp2p-yamux
interface FrameHeader {
    flag: number;
    length: number;
    streamID: number;
    type: FrameType;
    version?: number;
}

Properties

flag +FrameHeader | @chainsafe/libp2p-yamux
interface FrameHeader {
    flag: number;
    length: number;
    streamID: number;
    type: FrameType;
    version?: number;
}

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:

+
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. +

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. +

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 +

Generated using TypeDoc

\ No newline at end of file diff --git a/interfaces/index.YamuxMuxerComponents.html b/interfaces/index.YamuxMuxerComponents.html index ad840f3..536d405 100644 --- a/interfaces/index.YamuxMuxerComponents.html +++ b/interfaces/index.YamuxMuxerComponents.html @@ -1,2 +1,2 @@ -YamuxMuxerComponents | @chainsafe/libp2p-yamux
interface YamuxMuxerComponents {
    logger: ComponentLogger;
}

Properties

Properties

Generated using TypeDoc

\ No newline at end of file +YamuxMuxerComponents | @chainsafe/libp2p-yamux
interface YamuxMuxerComponents {
    logger: ComponentLogger;
}

Properties

Properties

Generated using TypeDoc

\ No newline at end of file diff --git a/interfaces/index.YamuxMuxerInit.html b/interfaces/index.YamuxMuxerInit.html index 92cb378..aae8999 100644 --- a/interfaces/index.YamuxMuxerInit.html +++ b/interfaces/index.YamuxMuxerInit.html @@ -1,4 +1,4 @@ -YamuxMuxerInit | @chainsafe/libp2p-yamux
interface YamuxMuxerInit {
    direction?: Direction;
    enableKeepAlive?: boolean;
    initialStreamWindowSize?: number;
    keepAliveInterval?: number;
    maxInboundStreams?: number;
    maxMessageSize?: number;
    maxOutboundStreams?: number;
    maxStreamWindowSize?: number;
    onIncomingStream?(stream): void;
    onStreamEnd?(stream): void;
}

Hierarchy

Properties

direction? +YamuxMuxerInit | @chainsafe/libp2p-yamux
interface YamuxMuxerInit {
    direction?: Direction;
    enableKeepAlive?: boolean;
    initialStreamWindowSize?: number;
    keepAliveInterval?: number;
    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.

+
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

-
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.

-

Methods

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

    +
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 +

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 2b80478..ece0b77 100644 --- a/interfaces/stream.YamuxStreamInit.html +++ b/interfaces/stream.YamuxStreamInit.html @@ -1,4 +1,4 @@ -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

closeTimeout? +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

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

+
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 +

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

    +

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 +

Returns void

Generated using TypeDoc

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

Index

Interfaces

Config +config | @chainsafe/libp2p-yamux

Index

Interfaces

Variables

Functions

Generated using TypeDoc

\ 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 2008a0b..777136e 100644 --- a/modules/index.html +++ b/modules/index.html @@ -1,12 +1,12 @@ 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: 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() +

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

Index

Enumerations

Interfaces

Functions

Generated using TypeDoc

\ 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 af64b8b..2561343 100644 --- a/modules/stream.html +++ b/modules/stream.html @@ -1,4 +1,4 @@ -stream | @chainsafe/libp2p-yamux

Index

Enumerations

StreamState +stream | @chainsafe/libp2p-yamux

Index

Enumerations

Classes

Interfaces

Generated using TypeDoc

\ 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 ae197ff..6f59a70 100644 --- a/variables/config.defaultConfig.html +++ b/variables/config.defaultConfig.html @@ -1 +1 @@ -defaultConfig | @chainsafe/libp2p-yamux

Variable defaultConfigConst

defaultConfig: Config = ...

Generated using TypeDoc

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

Variable defaultConfigConst

defaultConfig: Config = ...

Generated using TypeDoc

\ No newline at end of file