libp2p 1.0.7 → 1.0.8-93890c8f9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -189,4 +189,4 @@ Licensed under either of
189
189
 
190
190
  # Contribution
191
191
 
192
- 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.
192
+ 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.
package/dist/index.min.js CHANGED
@@ -58,7 +58,7 @@
58
58
  `),r),r.log.trace('handle: responded with "%s" for "%s"',i,i),{stream:n.unwrap(),protocol:i};if(i==="ls"){let s=new ze(...e.map(o=>En.single(Q(`${o}
59
59
  `))),Q(`
60
60
  `));r.log.trace('handle: respond with "%s" for %s',e,i),await _n(n,s,r),r.log.trace('handle: responded with "%s" for %s',e,i);continue}r.log('handle: respond with "na" for "%s"',i),await _n(n,Q(`na
61
- `),r),r.log('handle: responded with "na" for "%s"',i)}}var Ev=500,ql=class{id;remoteAddr;remotePeer;direction;timeline;multiplexer;encryption;status;transient;log;tags;_newStream;_close;_abort;_getStreams;constructor(e){let{remoteAddr:r,remotePeer:n,newStream:i,close:s,abort:o,getStreams:a}=e;this.id=`${parseInt(String(Math.random()*1e9)).toString(36)}${Date.now()}`,this.remoteAddr=r,this.remotePeer=n,this.direction=e.direction,this.status="open",this.timeline=e.timeline,this.multiplexer=e.multiplexer,this.encryption=e.encryption,this.transient=e.transient??!1,this.log=e.logger.forComponent(`libp2p:connection:${this.direction}:${this.id}`),this.remoteAddr.getPeerId()==null&&(this.remoteAddr=this.remoteAddr.encapsulate(`/p2p/${this.remotePeer}`)),this._newStream=i,this._close=s,this._abort=o,this._getStreams=a,this.tags=[]}[Symbol.toStringTag]="Connection";[m0]=!0;get streams(){return this._getStreams()}async newStream(e,r){if(this.status==="closing")throw new S("the connection is being closed","ERR_CONNECTION_BEING_CLOSED");if(this.status==="closed")throw new S("the connection is closed","ERR_CONNECTION_CLOSED");if(Array.isArray(e)||(e=[e]),this.transient&&r?.runOnTransientConnection!==!0)throw new S("Cannot open protocol stream on transient connection","ERR_TRANSIENT_CONNECTION");let n=await this._newStream(e,r);return n.direction="outbound",n}async close(e={}){if(!(this.status==="closed"||this.status==="closing")){if(this.log("closing connection to %a",this.remoteAddr),this.status="closing",e.signal==null){let r=AbortSignal.timeout(Ev);pt(1/0,r),e={...e,signal:r}}try{this.log.trace("closing all streams"),await Promise.all(this.streams.map(async r=>r.close(e))),this.log.trace("closing underlying transport"),await this._close(e),this.log.trace("updating timeline with close time"),this.status="closed",this.timeline.close=Date.now()}catch(r){this.log.error("error encountered during graceful close of connection to %a",this.remoteAddr,r),this.abort(r)}}}abort(e){this.log.error("aborting connection to %a due to error",this.remoteAddr,e),this.status="closing",this.streams.forEach(r=>{r.abort(e)}),this.log.error("all streams aborted",this.streams.length),this._abort(e),this.timeline.close=Date.now(),this.status="closed"}};function zm(t){return new ql(t)}var _v=3e4;function Sv(t,e){try{let{options:r}=e.getHandler(t);return r.maxInboundStreams}catch(r){if(r.code!==F.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return Nl}function Av(t,e,r={}){try{let{options:n}=e.getHandler(t);if(n.maxOutboundStreams!=null)return n.maxOutboundStreams}catch(n){if(n.code!==F.ERR_NO_HANDLER_FOR_PROTOCOL)throw n}return r.maxOutboundStreams??kl}function Hm(t,e,r){let n=0;return r.streams.forEach(i=>{i.direction===e&&i.protocol===t&&n++}),n}var fa=class{components;connectionEncryption;muxers;inboundUpgradeTimeout;events;constructor(e,r){this.components=e,this.connectionEncryption=new Map,r.connectionEncryption.forEach(n=>{this.connectionEncryption.set(n.protocol,n)}),this.muxers=new Map,r.muxers.forEach(n=>{this.muxers.set(n.protocol,n)}),this.inboundUpgradeTimeout=r.inboundUpgradeTimeout??3e4,this.events=e.events}async shouldBlockConnection(e,r,n){let i=this.components.connectionGater[n];if(i!==void 0&&await i(e,r))throw new S(`The multiaddr connection is blocked by gater.${n}`,F.ERR_CONNECTION_INTERCEPTED)}async upgradeInbound(e,r){if(!await this.components.connectionManager.acceptIncomingConnection(e))throw new S("connection denied",F.ERR_CONNECTION_DENIED);let i,s,o,a,c,u=AbortSignal.timeout(this.inboundUpgradeTimeout),l=()=>{e.abort(new S("inbound upgrade timeout",Ss))};u.addEventListener("abort",l,{once:!0}),pt(1/0,u);try{if(await this.components.connectionGater.denyInboundConnection?.(e)===!0)throw new S("The multiaddr connection is blocked by gater.acceptConnection",F.ERR_CONNECTION_INTERCEPTED);this.components.metrics?.trackMultiaddrConnection(e),e.log("starting the inbound connection upgrade");let f=e;if(r?.skipProtection!==!0){let h=this.components.connectionProtector;h!=null&&(e.log("protecting the inbound connection"),f=await h.protect(e))}try{if(i=f,r?.skipEncryption!==!0){({conn:i,remotePeer:s,protocol:c}=await this._encryptInbound(f));let h={...f,...i};await this.shouldBlockConnection(s,h,"denyInboundEncryptedConnection")}else{let h=e.remoteAddr.getPeerId();if(h==null)throw new S("inbound connection that skipped encryption must have a peer id",F.ERR_INVALID_MULTIADDR);let p=ce(h);c="native",s=p}if(o=i,r?.muxerFactory!=null)a=r.muxerFactory;else if(this.muxers.size>0){let h=await this._multiplexInbound({...f,...i},this.muxers);a=h.muxerFactory,o=h.stream}}catch(h){throw e.log.error("failed to upgrade inbound connection",h),h}return await this.shouldBlockConnection(s,e,"denyInboundUpgradedConnection"),e.log("successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:c,direction:"inbound",maConn:e,upgradedConn:o,muxerFactory:a,remotePeer:s,transient:r?.transient})}finally{u.removeEventListener("abort",l),this.components.connectionManager.afterUpgradeInbound()}}async upgradeOutbound(e,r){let n=e.remoteAddr.getPeerId(),i;n!=null&&(i=ce(n),await this.shouldBlockConnection(i,e,"denyOutboundConnection"));let s,o,a,c,u;this.components.metrics?.trackMultiaddrConnection(e),e.log("starting the outbound connection upgrade");let l=e;if(r?.skipProtection!==!0){let f=this.components.connectionProtector;f!=null&&(l=await f.protect(e))}try{if(s=l,r?.skipEncryption!==!0){({conn:s,remotePeer:o,protocol:c}=await this._encryptOutbound(l,i));let f={...l,...s};await this.shouldBlockConnection(o,f,"denyOutboundEncryptedConnection")}else{if(i==null)throw new S("Encryption was skipped but no peer id was passed",F.ERR_INVALID_PEER);c="native",o=i}if(a=s,r?.muxerFactory!=null)u=r.muxerFactory;else if(this.muxers.size>0){let f=await this._multiplexOutbound({...l,...s},this.muxers);u=f.muxerFactory,a=f.stream}}catch(f){throw e.log.error("failed to upgrade outbound connection",f),await e.close(f),f}return await this.shouldBlockConnection(o,e,"denyOutboundUpgradedConnection"),e.log("successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:c,direction:"outbound",maConn:e,upgradedConn:a,muxerFactory:u,remotePeer:o,transient:r?.transient})}_createConnection(e){let{cryptoProtocol:r,direction:n,maConn:i,upgradedConn:s,remotePeer:o,muxerFactory:a,transient:c}=e,u,l,f;a!=null&&(u=a.createStreamMuxer({direction:n,onIncomingStream:d=>{f!=null&&Promise.resolve().then(async()=>{let m=this.components.registrar.getProtocols(),{stream:y,protocol:g}=await is(d,m,{log:d.log,yieldBytes:!1});if(f==null)return;f.log("incoming stream opened on %s",g);let x=Sv(g,this.components.registrar);if(Hm(g,"inbound",f)===x){let I=new S(`Too many inbound protocol streams for protocol "${g}" - limit ${x}`,F.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS);throw d.abort(I),I}d.source=y.source,d.sink=y.sink,d.protocol=g,y.closeWrite!=null&&(d.closeWrite=y.closeWrite),y.closeRead!=null&&(d.closeRead=y.closeRead),y.close!=null&&(d.close=y.close),await this.components.peerStore.merge(o,{protocols:[g]}),this.components.metrics?.trackProtocolStream(d,f),this._onStream({connection:f,stream:d,protocol:g})}).catch(async m=>{f.log.error("error handling incoming stream id %s",d.id,m.message,m.code,m.stack),d.timeline.close==null&&await d.close()})}}),l=async(d,m={})=>{if(u==null)throw new S("Stream is not multiplexed",F.ERR_MUXER_UNAVAILABLE);f.log("starting new stream for protocols %s",d);let y=await u.newStream();f.log.trace("started new stream %s for protocols %s",y.id,d);try{if(m.signal==null){y.log("no abort signal was passed while trying to negotiate protocols %s falling back to default timeout",d);let v=AbortSignal.timeout(_v);pt(1/0,v),m={...m,signal:v}}y.log.trace("selecting protocol from protocols %s",d);let{stream:g,protocol:x}=await ns(y,d,{...m,log:y.log,yieldBytes:!0});y.log("selected protocol %s",x);let b=Av(x,this.components.registrar,m);if(Hm(x,"outbound",f)>=b){let v=new S(`Too many outbound protocol streams for protocol "${x}" - limit ${b}`,F.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw y.abort(v),v}return await this.components.peerStore.merge(o,{protocols:[x]}),y.source=g.source,y.sink=g.sink,y.protocol=x,g.closeWrite!=null&&(y.closeWrite=g.closeWrite),g.closeRead!=null&&(y.closeRead=g.closeRead),g.close!=null&&(y.close=g.close),this.components.metrics?.trackProtocolStream(y,f),y}catch(g){throw f.log.error("could not create new stream for protocols %s",d,g),y.timeline.close==null&&y.abort(g),g.code!=null?g:new S(String(g),F.ERR_UNSUPPORTED_PROTOCOL)}},Promise.all([u.sink(s.source),s.sink(u.source)]).catch(d=>{f.log.error("error piping data through muxer",d)}));let h=i.timeline;i.timeline=new Proxy(h,{set:(...d)=>(f!=null&&d[1]==="close"&&d[2]!=null&&h.close==null&&(async()=>{try{f.status==="open"&&await f.close()}catch(m){f.log.error("error closing connection after timeline close",m)}finally{this.events.safeDispatchEvent("connection:close",{detail:f})}})().catch(m=>{f.log.error("error thrown while dispatching connection:close event",m)}),Reflect.set(...d))}),i.timeline.upgraded=Date.now();let p=()=>{throw new S("connection is not multiplexed",F.ERR_CONNECTION_NOT_MULTIPLEXED)};return f=zm({remoteAddr:i.remoteAddr,remotePeer:o,status:"open",direction:n,timeline:i.timeline,multiplexer:u?.protocol,encryption:r,transient:c,logger:this.components.logger,newStream:l??p,getStreams:()=>u!=null?u.streams:[],close:async d=>{u!=null&&(f.log.trace("close muxer"),await u.close(d)),f.log.trace("close maconn"),await i.close(d),f.log.trace("closed maconn")},abort:d=>{i.abort(d),u?.abort(d)}}),this.events.safeDispatchEvent("connection:open",{detail:f}),f}_onStream(e){let{connection:r,stream:n,protocol:i}=e,{handler:s,options:o}=this.components.registrar.getHandler(i);if(r.transient&&o.runOnTransientConnection!==!0)throw new S("Cannot open protocol stream on transient connection","ERR_TRANSIENT_CONNECTION");s({connection:r,stream:n})}async _encryptInbound(e){let r=Array.from(this.connectionEncryption.keys());e.log("handling inbound crypto protocol selection",r);try{let{stream:n,protocol:i}=await is(e,r,{log:e.log}),s=this.connectionEncryption.get(i);if(s==null)throw new Error(`no crypto module found for ${i}`);return e.log("encrypting inbound connection using",i),{...await s.secureInbound(this.components.peerId,n),protocol:i}}catch(n){throw new S(String(n),F.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,r){let n=Array.from(this.connectionEncryption.keys());e.log("selecting outbound crypto protocol",n);try{e.log.trace("selecting encrypter from %s",n);let{stream:i,protocol:s}=await ns(e,n,{log:e.log,yieldBytes:!0}),o=this.connectionEncryption.get(s);if(o==null)throw new Error(`no crypto module found for ${s}`);return e.log("encrypting outbound connection to %p using %p",r),{...await o.secureOutbound(this.components.peerId,i,r),protocol:s}}catch(i){throw new S(String(i),F.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,r){let n=Array.from(r.keys());e.log("outbound selecting muxer %s",n);try{e.log.trace("selecting stream muxer from %s",n);let{stream:i,protocol:s}=await ns(e,n,{log:e.log,yieldBytes:!0});e.log("selected %s as muxer protocol",s);let o=r.get(s);return{stream:i,muxerFactory:o}}catch(i){throw e.log.error("error multiplexing outbound connection",i),new S(String(i),F.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,r){let n=Array.from(r.keys());e.log("inbound handling muxers %s",n);try{let{stream:i,protocol:s}=await is(e,n,{log:e.log}),o=r.get(s);return{stream:i,muxerFactory:o}}catch(i){throw e.log.error("error multiplexing inbound connection",i),new S(String(i),F.ERR_MUXER_UNAVAILABLE)}}};var Gm="1.0.7",Wm="libp2p";var Vl=class extends wi{peerId;peerStore;contentRouting;peerRouting;metrics;services;logger;status;components;log;constructor(e){super(),this.status="stopped";let r=new wi,n=r.dispatchEvent.bind(r);r.dispatchEvent=a=>{let c=n(a),u=this.dispatchEvent(new Ka(a.type,{detail:a.detail}));return c||u},pt(1/0,r),this.peerId=e.peerId,this.logger=e.logger??Qs(),this.log=this.logger.forComponent("libp2p"),this.services={};let i=this.components=Jd({peerId:e.peerId,nodeInfo:e.nodeInfo??{name:Wm,version:Gm},logger:this.logger,events:r,datastore:e.datastore??new So,connectionGater:up(e.connectionGater)});this.peerStore=this.configureComponent("peerStore",new Eo(i,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...e.peerStore})),e.metrics!=null&&(this.metrics=this.configureComponent("metrics",e.metrics(this.components))),i.events.addEventListener("peer:update",a=>{if(a.detail.previous==null){let c={id:a.detail.peer.id,multiaddrs:a.detail.peer.addresses.map(u=>u.multiaddr)};i.events.safeDispatchEvent("peer:discovery",{detail:c})}}),e.connectionProtector!=null&&this.configureComponent("connectionProtector",e.connectionProtector(i)),this.components.upgrader=new fa(this.components,{connectionEncryption:(e.connectionEncryption??[]).map((a,c)=>this.configureComponent(`connection-encryption-${c}`,a(this.components))),muxers:(e.streamMuxers??[]).map((a,c)=>this.configureComponent(`stream-muxers-${c}`,a(this.components))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.configureComponent("transportManager",new ia(this.components,e.transportManager)),this.configureComponent("connectionManager",new Xo(this.components,e.connectionManager)),this.configureComponent("registrar",new na(this.components)),this.configureComponent("addressManager",new Ao(this.components,e.addresses));let s=(e.peerRouters??[]).map((a,c)=>this.configureComponent(`peer-router-${c}`,a(this.components)));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new ra(this.components,{routers:s}));let o=(e.contentRouters??[]).map((a,c)=>this.configureComponent(`content-router-${c}`,a(this.components)));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new ta(this.components,{routers:o})),(e.peerDiscovery??[]).forEach((a,c)=>{this.configureComponent(`peer-discovery-${c}`,a(this.components)).addEventListener("peer",l=>{this.#e(l)})}),e.transports.forEach((a,c)=>{this.components.transportManager.add(this.configureComponent(`transport-${c}`,a(this.components)))}),e.services!=null)for(let a of Object.keys(e.services)){let c=e.services[a],u=c(this.components);if(u==null){this.log.error("service factory %s returned null or undefined instance",a);continue}this.services[a]=u,this.configureComponent(a,u),u[ka]!=null&&(this.log("registering service %s for content routing",a),o.push(u[ka])),u[Ua]!=null&&(this.log("registering service %s for peer routing",a),s.push(u[Ua])),u[Oa]!=null&&(this.log("registering service %s for peer discovery",a),u[Oa].addEventListener("peer",l=>{this.#e(l)}))}}configureComponent(e,r){return r==null&&this.log.error("component %s was null or undefined",e),this.components[e]=r,r}async start(){if(this.status==="stopped"){this.status="starting",this.log("libp2p is starting");try{await this.components.beforeStart?.(),await this.components.start(),await this.components.afterStart?.(),this.status="started",this.safeDispatchEvent("start",{detail:this}),this.log("libp2p has started")}catch(e){throw this.log.error("An error occurred starting libp2p",e),this.status="started",await this.stop(),e}}}async stop(){this.status==="started"&&(this.log("libp2p is stopping"),this.status="stopping",await this.components.beforeStop?.(),await this.components.stop(),await this.components.afterStop?.(),this.status="stopped",this.safeDispatchEvent("stop",{detail:this}),this.log("libp2p has stopped"))}getConnections(e){return this.components.connectionManager.getConnections(e)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){let e=new fn;for(let r of this.components.connectionManager.getConnections())e.add(r.remotePeer);return Array.from(e)}async dial(e,r={}){return this.components.connectionManager.openConnection(e,r)}async dialProtocol(e,r,n={}){if(r==null)throw new S("no protocols were provided to open a stream",F.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(r=Array.isArray(r)?r:[r],r.length===0)throw new S("no protocols were provided to open a stream",F.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this.dial(e,n)).newStream(r,n)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(e,r={}){Nr(e)&&(e=ce(e.getPeerId()??"")),await this.components.connectionManager.closeConnections(e,r)}async getPublicKey(e,r={}){if(this.log("getPublicKey %p",e),e.publicKey!=null)return e.publicKey;let n=await this.peerStore.get(e);if(n.id.publicKey!=null)return n.id.publicKey;let i=Te([Q("/pk/"),e.multihash.digest]),s=await this.contentRouting.get(i,r);return Mi(s),await this.peerStore.patch(e,{publicKey:s}),s}async handle(e,r,n){Array.isArray(e)||(e=[e]),await Promise.all(e.map(async i=>{await this.components.registrar.handle(i,r,n)}))}async unhandle(e){Array.isArray(e)||(e=[e]),await Promise.all(e.map(async r=>{await this.components.registrar.unhandle(r)}))}async register(e,r){return this.components.registrar.register(e,r)}unregister(e){this.components.registrar.unregister(e)}#e(e){let{detail:r}=e;if(r.id.toString()===this.peerId.toString()){this.log.error(new Error(F.ERR_DISCOVERED_SELF));return}this.components.peerStore.merge(r.id,{multiaddrs:r.multiaddrs}).catch(n=>{this.log.error(n)})}};async function Ym(t){return t.peerId??=await id(),new Vl(Np(t))}async function Rv(t){let e=await Ym(t);return t.start!==!1&&await e.start(),e}return cy(Cv);})();
61
+ `),r),r.log('handle: responded with "na" for "%s"',i)}}var Ev=500,ql=class{id;remoteAddr;remotePeer;direction;timeline;multiplexer;encryption;status;transient;log;tags;_newStream;_close;_abort;_getStreams;constructor(e){let{remoteAddr:r,remotePeer:n,newStream:i,close:s,abort:o,getStreams:a}=e;this.id=`${parseInt(String(Math.random()*1e9)).toString(36)}${Date.now()}`,this.remoteAddr=r,this.remotePeer=n,this.direction=e.direction,this.status="open",this.timeline=e.timeline,this.multiplexer=e.multiplexer,this.encryption=e.encryption,this.transient=e.transient??!1,this.log=e.logger.forComponent(`libp2p:connection:${this.direction}:${this.id}`),this.remoteAddr.getPeerId()==null&&(this.remoteAddr=this.remoteAddr.encapsulate(`/p2p/${this.remotePeer}`)),this._newStream=i,this._close=s,this._abort=o,this._getStreams=a,this.tags=[]}[Symbol.toStringTag]="Connection";[m0]=!0;get streams(){return this._getStreams()}async newStream(e,r){if(this.status==="closing")throw new S("the connection is being closed","ERR_CONNECTION_BEING_CLOSED");if(this.status==="closed")throw new S("the connection is closed","ERR_CONNECTION_CLOSED");if(Array.isArray(e)||(e=[e]),this.transient&&r?.runOnTransientConnection!==!0)throw new S("Cannot open protocol stream on transient connection","ERR_TRANSIENT_CONNECTION");let n=await this._newStream(e,r);return n.direction="outbound",n}async close(e={}){if(!(this.status==="closed"||this.status==="closing")){if(this.log("closing connection to %a",this.remoteAddr),this.status="closing",e.signal==null){let r=AbortSignal.timeout(Ev);pt(1/0,r),e={...e,signal:r}}try{this.log.trace("closing all streams"),await Promise.all(this.streams.map(async r=>r.close(e))),this.log.trace("closing underlying transport"),await this._close(e),this.log.trace("updating timeline with close time"),this.status="closed",this.timeline.close=Date.now()}catch(r){this.log.error("error encountered during graceful close of connection to %a",this.remoteAddr,r),this.abort(r)}}}abort(e){this.log.error("aborting connection to %a due to error",this.remoteAddr,e),this.status="closing",this.streams.forEach(r=>{r.abort(e)}),this.log.error("all streams aborted",this.streams.length),this._abort(e),this.timeline.close=Date.now(),this.status="closed"}};function zm(t){return new ql(t)}var _v=3e4;function Sv(t,e){try{let{options:r}=e.getHandler(t);return r.maxInboundStreams}catch(r){if(r.code!==F.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return Nl}function Av(t,e,r={}){try{let{options:n}=e.getHandler(t);if(n.maxOutboundStreams!=null)return n.maxOutboundStreams}catch(n){if(n.code!==F.ERR_NO_HANDLER_FOR_PROTOCOL)throw n}return r.maxOutboundStreams??kl}function Hm(t,e,r){let n=0;return r.streams.forEach(i=>{i.direction===e&&i.protocol===t&&n++}),n}var fa=class{components;connectionEncryption;muxers;inboundUpgradeTimeout;events;constructor(e,r){this.components=e,this.connectionEncryption=new Map,r.connectionEncryption.forEach(n=>{this.connectionEncryption.set(n.protocol,n)}),this.muxers=new Map,r.muxers.forEach(n=>{this.muxers.set(n.protocol,n)}),this.inboundUpgradeTimeout=r.inboundUpgradeTimeout??3e4,this.events=e.events}async shouldBlockConnection(e,r,n){let i=this.components.connectionGater[n];if(i!==void 0&&await i(e,r))throw new S(`The multiaddr connection is blocked by gater.${n}`,F.ERR_CONNECTION_INTERCEPTED)}async upgradeInbound(e,r){if(!await this.components.connectionManager.acceptIncomingConnection(e))throw new S("connection denied",F.ERR_CONNECTION_DENIED);let i,s,o,a,c,u=AbortSignal.timeout(this.inboundUpgradeTimeout),l=()=>{e.abort(new S("inbound upgrade timeout",Ss))};u.addEventListener("abort",l,{once:!0}),pt(1/0,u);try{if(await this.components.connectionGater.denyInboundConnection?.(e)===!0)throw new S("The multiaddr connection is blocked by gater.acceptConnection",F.ERR_CONNECTION_INTERCEPTED);this.components.metrics?.trackMultiaddrConnection(e),e.log("starting the inbound connection upgrade");let f=e;if(r?.skipProtection!==!0){let h=this.components.connectionProtector;h!=null&&(e.log("protecting the inbound connection"),f=await h.protect(e))}try{if(i=f,r?.skipEncryption!==!0){({conn:i,remotePeer:s,protocol:c}=await this._encryptInbound(f));let h={...f,...i};await this.shouldBlockConnection(s,h,"denyInboundEncryptedConnection")}else{let h=e.remoteAddr.getPeerId();if(h==null)throw new S("inbound connection that skipped encryption must have a peer id",F.ERR_INVALID_MULTIADDR);let p=ce(h);c="native",s=p}if(o=i,r?.muxerFactory!=null)a=r.muxerFactory;else if(this.muxers.size>0){let h=await this._multiplexInbound({...f,...i},this.muxers);a=h.muxerFactory,o=h.stream}}catch(h){throw e.log.error("failed to upgrade inbound connection",h),h}return await this.shouldBlockConnection(s,e,"denyInboundUpgradedConnection"),e.log("successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:c,direction:"inbound",maConn:e,upgradedConn:o,muxerFactory:a,remotePeer:s,transient:r?.transient})}finally{u.removeEventListener("abort",l),this.components.connectionManager.afterUpgradeInbound()}}async upgradeOutbound(e,r){let n=e.remoteAddr.getPeerId(),i;n!=null&&(i=ce(n),await this.shouldBlockConnection(i,e,"denyOutboundConnection"));let s,o,a,c,u;this.components.metrics?.trackMultiaddrConnection(e),e.log("starting the outbound connection upgrade");let l=e;if(r?.skipProtection!==!0){let f=this.components.connectionProtector;f!=null&&(l=await f.protect(e))}try{if(s=l,r?.skipEncryption!==!0){({conn:s,remotePeer:o,protocol:c}=await this._encryptOutbound(l,i));let f={...l,...s};await this.shouldBlockConnection(o,f,"denyOutboundEncryptedConnection")}else{if(i==null)throw new S("Encryption was skipped but no peer id was passed",F.ERR_INVALID_PEER);c="native",o=i}if(a=s,r?.muxerFactory!=null)u=r.muxerFactory;else if(this.muxers.size>0){let f=await this._multiplexOutbound({...l,...s},this.muxers);u=f.muxerFactory,a=f.stream}}catch(f){throw e.log.error("failed to upgrade outbound connection",f),await e.close(f),f}return await this.shouldBlockConnection(o,e,"denyOutboundUpgradedConnection"),e.log("successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:c,direction:"outbound",maConn:e,upgradedConn:a,muxerFactory:u,remotePeer:o,transient:r?.transient})}_createConnection(e){let{cryptoProtocol:r,direction:n,maConn:i,upgradedConn:s,remotePeer:o,muxerFactory:a,transient:c}=e,u,l,f;a!=null&&(u=a.createStreamMuxer({direction:n,onIncomingStream:d=>{f!=null&&Promise.resolve().then(async()=>{let m=this.components.registrar.getProtocols(),{stream:y,protocol:g}=await is(d,m,{log:d.log,yieldBytes:!1});if(f==null)return;f.log("incoming stream opened on %s",g);let x=Sv(g,this.components.registrar);if(Hm(g,"inbound",f)===x){let I=new S(`Too many inbound protocol streams for protocol "${g}" - limit ${x}`,F.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS);throw d.abort(I),I}d.source=y.source,d.sink=y.sink,d.protocol=g,y.closeWrite!=null&&(d.closeWrite=y.closeWrite),y.closeRead!=null&&(d.closeRead=y.closeRead),y.close!=null&&(d.close=y.close),await this.components.peerStore.merge(o,{protocols:[g]}),this.components.metrics?.trackProtocolStream(d,f),this._onStream({connection:f,stream:d,protocol:g})}).catch(async m=>{f.log.error("error handling incoming stream id %s",d.id,m.message,m.code,m.stack),d.timeline.close==null&&await d.close()})}}),l=async(d,m={})=>{if(u==null)throw new S("Stream is not multiplexed",F.ERR_MUXER_UNAVAILABLE);f.log("starting new stream for protocols %s",d);let y=await u.newStream();f.log.trace("started new stream %s for protocols %s",y.id,d);try{if(m.signal==null){y.log("no abort signal was passed while trying to negotiate protocols %s falling back to default timeout",d);let v=AbortSignal.timeout(_v);pt(1/0,v),m={...m,signal:v}}y.log.trace("selecting protocol from protocols %s",d);let{stream:g,protocol:x}=await ns(y,d,{...m,log:y.log,yieldBytes:!0});y.log("selected protocol %s",x);let b=Av(x,this.components.registrar,m);if(Hm(x,"outbound",f)>=b){let v=new S(`Too many outbound protocol streams for protocol "${x}" - limit ${b}`,F.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw y.abort(v),v}return await this.components.peerStore.merge(o,{protocols:[x]}),y.source=g.source,y.sink=g.sink,y.protocol=x,g.closeWrite!=null&&(y.closeWrite=g.closeWrite),g.closeRead!=null&&(y.closeRead=g.closeRead),g.close!=null&&(y.close=g.close),this.components.metrics?.trackProtocolStream(y,f),y}catch(g){throw f.log.error("could not create new stream for protocols %s",d,g),y.timeline.close==null&&y.abort(g),g.code!=null?g:new S(String(g),F.ERR_UNSUPPORTED_PROTOCOL)}},Promise.all([u.sink(s.source),s.sink(u.source)]).catch(d=>{f.log.error("error piping data through muxer",d)}));let h=i.timeline;i.timeline=new Proxy(h,{set:(...d)=>(f!=null&&d[1]==="close"&&d[2]!=null&&h.close==null&&(async()=>{try{f.status==="open"&&await f.close()}catch(m){f.log.error("error closing connection after timeline close",m)}finally{this.events.safeDispatchEvent("connection:close",{detail:f})}})().catch(m=>{f.log.error("error thrown while dispatching connection:close event",m)}),Reflect.set(...d))}),i.timeline.upgraded=Date.now();let p=()=>{throw new S("connection is not multiplexed",F.ERR_CONNECTION_NOT_MULTIPLEXED)};return f=zm({remoteAddr:i.remoteAddr,remotePeer:o,status:"open",direction:n,timeline:i.timeline,multiplexer:u?.protocol,encryption:r,transient:c,logger:this.components.logger,newStream:l??p,getStreams:()=>u!=null?u.streams:[],close:async d=>{u!=null&&(f.log.trace("close muxer"),await u.close(d)),f.log.trace("close maconn"),await i.close(d),f.log.trace("closed maconn")},abort:d=>{i.abort(d),u?.abort(d)}}),this.events.safeDispatchEvent("connection:open",{detail:f}),f}_onStream(e){let{connection:r,stream:n,protocol:i}=e,{handler:s,options:o}=this.components.registrar.getHandler(i);if(r.transient&&o.runOnTransientConnection!==!0)throw new S("Cannot open protocol stream on transient connection","ERR_TRANSIENT_CONNECTION");s({connection:r,stream:n})}async _encryptInbound(e){let r=Array.from(this.connectionEncryption.keys());e.log("handling inbound crypto protocol selection",r);try{let{stream:n,protocol:i}=await is(e,r,{log:e.log}),s=this.connectionEncryption.get(i);if(s==null)throw new Error(`no crypto module found for ${i}`);return e.log("encrypting inbound connection using",i),{...await s.secureInbound(this.components.peerId,n),protocol:i}}catch(n){throw new S(String(n),F.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,r){let n=Array.from(this.connectionEncryption.keys());e.log("selecting outbound crypto protocol",n);try{e.log.trace("selecting encrypter from %s",n);let{stream:i,protocol:s}=await ns(e,n,{log:e.log,yieldBytes:!0}),o=this.connectionEncryption.get(s);if(o==null)throw new Error(`no crypto module found for ${s}`);return e.log("encrypting outbound connection to %p using %p",r),{...await o.secureOutbound(this.components.peerId,i,r),protocol:s}}catch(i){throw new S(String(i),F.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,r){let n=Array.from(r.keys());e.log("outbound selecting muxer %s",n);try{e.log.trace("selecting stream muxer from %s",n);let{stream:i,protocol:s}=await ns(e,n,{log:e.log,yieldBytes:!0});e.log("selected %s as muxer protocol",s);let o=r.get(s);return{stream:i,muxerFactory:o}}catch(i){throw e.log.error("error multiplexing outbound connection",i),new S(String(i),F.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,r){let n=Array.from(r.keys());e.log("inbound handling muxers %s",n);try{let{stream:i,protocol:s}=await is(e,n,{log:e.log}),o=r.get(s);return{stream:i,muxerFactory:o}}catch(i){throw e.log.error("error multiplexing inbound connection",i),new S(String(i),F.ERR_MUXER_UNAVAILABLE)}}};var Gm="1.0.8-93890c8f9",Wm="libp2p";var Vl=class extends wi{peerId;peerStore;contentRouting;peerRouting;metrics;services;logger;status;components;log;constructor(e){super(),this.status="stopped";let r=new wi,n=r.dispatchEvent.bind(r);r.dispatchEvent=a=>{let c=n(a),u=this.dispatchEvent(new Ka(a.type,{detail:a.detail}));return c||u},pt(1/0,r),this.peerId=e.peerId,this.logger=e.logger??Qs(),this.log=this.logger.forComponent("libp2p"),this.services={};let i=this.components=Jd({peerId:e.peerId,nodeInfo:e.nodeInfo??{name:Wm,version:Gm},logger:this.logger,events:r,datastore:e.datastore??new So,connectionGater:up(e.connectionGater)});this.peerStore=this.configureComponent("peerStore",new Eo(i,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...e.peerStore})),e.metrics!=null&&(this.metrics=this.configureComponent("metrics",e.metrics(this.components))),i.events.addEventListener("peer:update",a=>{if(a.detail.previous==null){let c={id:a.detail.peer.id,multiaddrs:a.detail.peer.addresses.map(u=>u.multiaddr)};i.events.safeDispatchEvent("peer:discovery",{detail:c})}}),e.connectionProtector!=null&&this.configureComponent("connectionProtector",e.connectionProtector(i)),this.components.upgrader=new fa(this.components,{connectionEncryption:(e.connectionEncryption??[]).map((a,c)=>this.configureComponent(`connection-encryption-${c}`,a(this.components))),muxers:(e.streamMuxers??[]).map((a,c)=>this.configureComponent(`stream-muxers-${c}`,a(this.components))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.configureComponent("transportManager",new ia(this.components,e.transportManager)),this.configureComponent("connectionManager",new Xo(this.components,e.connectionManager)),this.configureComponent("registrar",new na(this.components)),this.configureComponent("addressManager",new Ao(this.components,e.addresses));let s=(e.peerRouters??[]).map((a,c)=>this.configureComponent(`peer-router-${c}`,a(this.components)));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new ra(this.components,{routers:s}));let o=(e.contentRouters??[]).map((a,c)=>this.configureComponent(`content-router-${c}`,a(this.components)));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new ta(this.components,{routers:o})),(e.peerDiscovery??[]).forEach((a,c)=>{this.configureComponent(`peer-discovery-${c}`,a(this.components)).addEventListener("peer",l=>{this.#e(l)})}),e.transports?.forEach((a,c)=>{this.components.transportManager.add(this.configureComponent(`transport-${c}`,a(this.components)))}),e.services!=null)for(let a of Object.keys(e.services)){let c=e.services[a],u=c(this.components);if(u==null){this.log.error("service factory %s returned null or undefined instance",a);continue}this.services[a]=u,this.configureComponent(a,u),u[ka]!=null&&(this.log("registering service %s for content routing",a),o.push(u[ka])),u[Ua]!=null&&(this.log("registering service %s for peer routing",a),s.push(u[Ua])),u[Oa]!=null&&(this.log("registering service %s for peer discovery",a),u[Oa].addEventListener("peer",l=>{this.#e(l)}))}}configureComponent(e,r){return r==null&&this.log.error("component %s was null or undefined",e),this.components[e]=r,r}async start(){if(this.status==="stopped"){this.status="starting",this.log("libp2p is starting");try{await this.components.beforeStart?.(),await this.components.start(),await this.components.afterStart?.(),this.status="started",this.safeDispatchEvent("start",{detail:this}),this.log("libp2p has started")}catch(e){throw this.log.error("An error occurred starting libp2p",e),this.status="started",await this.stop(),e}}}async stop(){this.status==="started"&&(this.log("libp2p is stopping"),this.status="stopping",await this.components.beforeStop?.(),await this.components.stop(),await this.components.afterStop?.(),this.status="stopped",this.safeDispatchEvent("stop",{detail:this}),this.log("libp2p has stopped"))}getConnections(e){return this.components.connectionManager.getConnections(e)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){let e=new fn;for(let r of this.components.connectionManager.getConnections())e.add(r.remotePeer);return Array.from(e)}async dial(e,r={}){return this.components.connectionManager.openConnection(e,r)}async dialProtocol(e,r,n={}){if(r==null)throw new S("no protocols were provided to open a stream",F.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(r=Array.isArray(r)?r:[r],r.length===0)throw new S("no protocols were provided to open a stream",F.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this.dial(e,n)).newStream(r,n)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(e,r={}){Nr(e)&&(e=ce(e.getPeerId()??"")),await this.components.connectionManager.closeConnections(e,r)}async getPublicKey(e,r={}){if(this.log("getPublicKey %p",e),e.publicKey!=null)return e.publicKey;let n=await this.peerStore.get(e);if(n.id.publicKey!=null)return n.id.publicKey;let i=Te([Q("/pk/"),e.multihash.digest]),s=await this.contentRouting.get(i,r);return Mi(s),await this.peerStore.patch(e,{publicKey:s}),s}async handle(e,r,n){Array.isArray(e)||(e=[e]),await Promise.all(e.map(async i=>{await this.components.registrar.handle(i,r,n)}))}async unhandle(e){Array.isArray(e)||(e=[e]),await Promise.all(e.map(async r=>{await this.components.registrar.unhandle(r)}))}async register(e,r){return this.components.registrar.register(e,r)}unregister(e){this.components.registrar.unregister(e)}#e(e){let{detail:r}=e;if(r.id.toString()===this.peerId.toString()){this.log.error(new Error(F.ERR_DISCOVERED_SELF));return}this.components.peerStore.merge(r.id,{multiaddrs:r.multiaddrs}).catch(n=>{this.log.error(n)})}};async function Ym(t={}){return t.peerId??=await id(),new Vl(Np(t))}async function Rv(t={}){let e=await Ym(t);return t.start!==!1&&await e.start(),e}return cy(Cv);})();
62
62
  /*! Bundled license information:
63
63
 
64
64
  @noble/hashes/esm/utils.js:
@@ -66,7 +66,7 @@ export interface Libp2pInit<T extends ServiceMap = {
66
66
  /**
67
67
  * An array that must include at least 1 compliant transport
68
68
  */
69
- transports: Array<(components: Components) => Transport>;
69
+ transports?: Array<(components: Components) => Transport>;
70
70
  streamMuxers?: Array<(components: Components) => StreamMuxerFactory>;
71
71
  connectionEncryption?: Array<(components: Components) => ConnectionEncrypter>;
72
72
  peerDiscovery?: Array<(components: Components) => PeerDiscovery>;
@@ -137,5 +137,5 @@ export type Libp2pOptions<T extends ServiceMap = Record<string, unknown>> = Recu
137
137
  */
138
138
  export declare function createLibp2p<T extends ServiceMap = {
139
139
  x: Record<string, unknown>;
140
- }>(options: Libp2pOptions<T>): Promise<Libp2p<T>>;
140
+ }>(options?: Libp2pOptions<T>): Promise<Libp2p<T>>;
141
141
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,QAAQ,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC/P,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KAC1F,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,KAAK,CAAC,CAAC,QAAQ,C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,CAAC,CAAC,UAAU,EAAE,UAAU,KAAK,cAAc,CAAC,CAAA;IAElE;;OAEG;IACH,OAAO,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAA;IAEzC;;OAEG;IACH,mBAAmB,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,mBAAmB,CAAA;IAEjE;;OAEG;IACH,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAA;IAE9B;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,EAAE,eAAe,CAAA;CACzB;AAED,YAAY,EAAE,MAAM,EAAE,CAAA;AAEtB,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAEjI;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAAE,CAAC,SAAS,UAAU,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EAAG,OAAO,GAAE,aAAa,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAQ9I"}
package/dist/src/index.js CHANGED
@@ -40,7 +40,7 @@ import { createLibp2pNode } from './libp2p.js';
40
40
  * const libp2p = await createLibp2p(options)
41
41
  * ```
42
42
  */
43
- export async function createLibp2p(options) {
43
+ export async function createLibp2p(options = {}) {
44
44
  const node = await createLibp2pNode(options);
45
45
  if (options.start !== false) {
46
46
  await node.start();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AA8G9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAA0D,OAAyB;IACnH,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAE5C,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;QAC5B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AA8G9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAA0D,UAA4B,EAAE;IACxH,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAE5C,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;QAC5B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -47,5 +47,5 @@ export declare class Libp2pNode<T extends ServiceMap = Record<string, unknown>>
47
47
  * Returns a new Libp2pNode instance - this exposes more of the internals than the
48
48
  * libp2p interface and is useful for testing and debugging.
49
49
  */
50
- export declare function createLibp2pNode<T extends ServiceMap = Record<string, unknown>>(options: Libp2pOptions<T>): Promise<Libp2pNode<T>>;
50
+ export declare function createLibp2pNode<T extends ServiceMap = Record<string, unknown>>(options?: Libp2pOptions<T>): Promise<Libp2pNode<T>>;
51
51
  //# sourceMappingURL=libp2p.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"libp2p.d.ts","sourceRoot":"","sources":["../../src/libp2p.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,iBAAiB,EAAwE,MAAM,mBAAmB,CAAA;AAM5J,OAAO,EAAe,KAAK,SA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C,CAAC,CAAC,CAAC,CAI/I"}
@@ -115,7 +115,7 @@ export class Libp2pNode extends TypedEventEmitter {
115
115
  });
116
116
  });
117
117
  // Transport modules
118
- init.transports.forEach((fn, index) => {
118
+ init.transports?.forEach((fn, index) => {
119
119
  this.components.transportManager.add(this.configureComponent(`transport-${index}`, fn(this.components)));
120
120
  });
121
121
  // User defined modules
@@ -300,7 +300,7 @@ export class Libp2pNode extends TypedEventEmitter {
300
300
  * Returns a new Libp2pNode instance - this exposes more of the internals than the
301
301
  * libp2p interface and is useful for testing and debugging.
302
302
  */
303
- export async function createLibp2pNode(options) {
303
+ export async function createLibp2pNode(options = {}) {
304
304
  options.peerId ??= await createEd25519PeerId();
305
305
  return new Libp2pNode(validateConfig(options));
306
306
  }
@@ -1 +1 @@
1
- {"version":3,"file":"libp2p.js","sourceRoot":"","sources":["../../src/libp2p.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC5J,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAkB,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,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AM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;QAE5B,IAAI,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;YAClD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAA;YACpD,OAAM;QACR,CAAC;QAED,KAAK,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE;YAC5C,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;aACC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;IAC1C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAmD,UAA4B,EAAE;IACrH,OAAO,CAAC,MAAM,KAAK,MAAM,mBAAmB,EAAE,CAAA;IAE9C,OAAO,IAAI,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;AAChD,CAAC"}
@@ -1,3 +1,3 @@
1
- export declare const version = "1.0.7";
1
+ export declare const version = "1.0.8-93890c8f9";
2
2
  export declare const name = "libp2p";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAA;AAC9B,eAAO,MAAM,IAAI,WAAW,CAAA"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,oBAAoB,CAAA;AACxC,eAAO,MAAM,IAAI,WAAW,CAAA"}
@@ -1,3 +1,3 @@
1
- export const version = '1.0.7';
1
+ export const version = '1.0.8-93890c8f9';
2
2
  export const name = 'libp2p';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA;AAC9B,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAA"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAA;AACxC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libp2p",
3
- "version": "1.0.7",
3
+ "version": "1.0.8-93890c8f9",
4
4
  "description": "JavaScript implementation of libp2p, a modular peer to peer network stack",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/libp2p#readme",
@@ -84,16 +84,16 @@
84
84
  "test:webkit": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" -- --browser webkit"
85
85
  },
86
86
  "dependencies": {
87
- "@libp2p/crypto": "^3.0.1",
88
- "@libp2p/interface": "^1.0.1",
89
- "@libp2p/interface-internal": "^1.0.1",
90
- "@libp2p/logger": "^4.0.1",
91
- "@libp2p/multistream-select": "^5.0.1",
92
- "@libp2p/peer-collections": "^5.0.0",
93
- "@libp2p/peer-id": "^4.0.1",
94
- "@libp2p/peer-id-factory": "^4.0.0",
95
- "@libp2p/peer-store": "^10.0.0",
96
- "@libp2p/utils": "^5.0.2",
87
+ "@libp2p/crypto": "3.0.1-93890c8f9",
88
+ "@libp2p/interface": "1.0.1-93890c8f9",
89
+ "@libp2p/interface-internal": "1.0.1-93890c8f9",
90
+ "@libp2p/logger": "4.0.1-93890c8f9",
91
+ "@libp2p/multistream-select": "5.0.1-93890c8f9",
92
+ "@libp2p/peer-collections": "5.0.0-93890c8f9",
93
+ "@libp2p/peer-id": "4.0.1-93890c8f9",
94
+ "@libp2p/peer-id-factory": "4.0.0-93890c8f9",
95
+ "@libp2p/peer-store": "10.0.0-93890c8f9",
96
+ "@libp2p/utils": "5.0.2-93890c8f9",
97
97
  "@multiformats/mafmt": "^12.1.6",
98
98
  "@multiformats/multiaddr": "^12.1.10",
99
99
  "@multiformats/multiaddr-matcher": "^1.1.0",
@@ -121,16 +121,16 @@
121
121
  "devDependencies": {
122
122
  "@chainsafe/libp2p-noise": "^14.0.0",
123
123
  "@chainsafe/libp2p-yamux": "^6.0.1",
124
- "@libp2p/bootstrap": "^10.0.5",
125
- "@libp2p/circuit-relay-v2": "^1.0.5",
126
- "@libp2p/identify": "^1.0.4",
127
- "@libp2p/interface-compliance-tests": "^5.0.5",
128
- "@libp2p/kad-dht": "^11.0.5",
129
- "@libp2p/mdns": "^10.0.5",
130
- "@libp2p/mplex": "^10.0.5",
131
- "@libp2p/plaintext": "^1.0.5",
132
- "@libp2p/tcp": "^9.0.5",
133
- "@libp2p/websockets": "^8.0.5",
124
+ "@libp2p/bootstrap": "10.0.5-93890c8f9",
125
+ "@libp2p/circuit-relay-v2": "1.0.5-93890c8f9",
126
+ "@libp2p/identify": "1.0.4-93890c8f9",
127
+ "@libp2p/interface-compliance-tests": "5.0.5-93890c8f9",
128
+ "@libp2p/kad-dht": "11.0.5-93890c8f9",
129
+ "@libp2p/mdns": "10.0.5-93890c8f9",
130
+ "@libp2p/mplex": "10.0.5-93890c8f9",
131
+ "@libp2p/plaintext": "1.0.5-93890c8f9",
132
+ "@libp2p/tcp": "9.0.5-93890c8f9",
133
+ "@libp2p/websockets": "8.0.5-93890c8f9",
134
134
  "aegir": "^41.0.2",
135
135
  "it-pushable": "^3.2.1",
136
136
  "p-event": "^6.0.0",
package/src/index.ts CHANGED
@@ -76,7 +76,7 @@ export interface Libp2pInit<T extends ServiceMap = { x: Record<string, unknown>
76
76
  /**
77
77
  * An array that must include at least 1 compliant transport
78
78
  */
79
- transports: Array<(components: Components) => Transport>
79
+ transports?: Array<(components: Components) => Transport>
80
80
  streamMuxers?: Array<(components: Components) => StreamMuxerFactory>
81
81
  connectionEncryption?: Array<(components: Components) => ConnectionEncrypter>
82
82
  peerDiscovery?: Array<(components: Components) => PeerDiscovery>
@@ -150,7 +150,7 @@ export type Libp2pOptions<T extends ServiceMap = Record<string, unknown>> = Recu
150
150
  * const libp2p = await createLibp2p(options)
151
151
  * ```
152
152
  */
153
- export async function createLibp2p <T extends ServiceMap = { x: Record<string, unknown> }> (options: Libp2pOptions<T>): Promise<Libp2p<T>> {
153
+ export async function createLibp2p <T extends ServiceMap = { x: Record<string, unknown> }> (options: Libp2pOptions<T> = {}): Promise<Libp2p<T>> {
154
154
  const node = await createLibp2pNode(options)
155
155
 
156
156
  if (options.start !== false) {
package/src/libp2p.ts CHANGED
@@ -145,7 +145,7 @@ export class Libp2pNode<T extends ServiceMap = Record<string, unknown>> extends
145
145
  })
146
146
 
147
147
  // Transport modules
148
- init.transports.forEach((fn, index) => {
148
+ init.transports?.forEach((fn, index) => {
149
149
  this.components.transportManager.add(this.configureComponent(`transport-${index}`, fn(this.components)))
150
150
  })
151
151
 
@@ -385,7 +385,7 @@ export class Libp2pNode<T extends ServiceMap = Record<string, unknown>> extends
385
385
  * Returns a new Libp2pNode instance - this exposes more of the internals than the
386
386
  * libp2p interface and is useful for testing and debugging.
387
387
  */
388
- export async function createLibp2pNode <T extends ServiceMap = Record<string, unknown>> (options: Libp2pOptions<T>): Promise<Libp2pNode<T>> {
388
+ export async function createLibp2pNode <T extends ServiceMap = Record<string, unknown>> (options: Libp2pOptions<T> = {}): Promise<Libp2pNode<T>> {
389
389
  options.peerId ??= await createEd25519PeerId()
390
390
 
391
391
  return new Libp2pNode(validateConfig(options))
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const version = '1.0.7'
1
+ export const version = '1.0.8-93890c8f9'
2
2
  export const name = 'libp2p'
@@ -1,10 +0,0 @@
1
- {
2
- "Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.Libp2pInit.html",
3
- ".:Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.Libp2pInit.html",
4
- "Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.Libp2pOptions.html",
5
- ".:Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.Libp2pOptions.html",
6
- "ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.ServiceFactoryMap.html",
7
- ".:ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.ServiceFactoryMap.html",
8
- "createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.createLibp2p.html",
9
- ".:createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.createLibp2p.html"
10
- }