libp2p 1.0.2 → 1.0.3-e7167fe52

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;log;constructor(e,r){this.components=e,this.connectionEncryption=new Map,this.log=e.logger.forComponent("libp2p:upgrader"),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),this.log("starting the inbound connection upgrade");let f=e;if(r?.skipProtection!==!0){let h=this.components.connectionProtector;h!=null&&(this.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 this.log.error("Failed to upgrade inbound connection",h),h}return await this.shouldBlockConnection(s,e,"denyInboundUpgradedConnection"),this.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),this.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 this.log.error("Failed to upgrade outbound connection",f),await e.close(f),f}return await this.shouldBlockConnection(o,e,"denyOutboundUpgradedConnection"),this.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=>{this.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){this.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=>{this.log.error(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){this.log.error(m)}finally{this.events.safeDispatchEvent("connection:close",{detail:f})}})().catch(m=>{this.log.error(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&&(this.log.trace("close muxer"),await u.close(d)),this.log.trace("close maconn"),await i.close(d),this.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());this.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 this.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());this.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());this.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 stream",i),new S(String(i),F.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,r){let n=Array.from(r.keys());this.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 this.log.error("error multiplexing inbound stream",i),new S(String(i),F.ERR_MUXER_UNAVAILABLE)}}};var Gm="1.0.2",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),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.3-e7167fe52",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),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:
@@ -44,7 +44,6 @@ export declare class DefaultUpgrader implements Upgrader {
44
44
  private readonly muxers;
45
45
  private readonly inboundUpgradeTimeout;
46
46
  private readonly events;
47
- private readonly log;
48
47
  constructor(components: DefaultUpgraderComponents, init: UpgraderInit);
49
48
  shouldBlockConnection(remotePeer: PeerId, maConn: MultiaddrConnection, conn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AE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,cAAc,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAUlI;;OAEG;IACG,cAAc,CAAE,MAAM,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IA8G/F;;OAEG;IACG,eAAe,CAAE,MAAM,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IA2FhG;;OAEG;IACH,iBAAiB,CAAE,IAAI,EAAE,uBAAuB,GAAG,UAAU;IAqQ7D;;OAEG;IACH,SAAS,CAAE,IAAI,EAAE,eAAe,GAAG,IAAI;IAWvC;;OAEG;IACG,eAAe,CAAE,UAAU,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IAyB9E;;;OAGG;IACG,gBAAgB,CAAE,UAAU,EAAE,mBAAmB,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAgCtG;;;OAGG;IACG,kBAAkB,CAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,mBAAmB,CAAC;QAAC,YAAY,CAAC,EAAE,kBAAkB,CAAA;KAAE,CAAC;IAwBhL;;;OAGG;IACG,iBAAiB,CAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,mBAAmB,CAAC;QAAC,YAAY,CAAC,EAAE,kBAAkB,CAAA;KAAE,CAAC;CAehL"}
@@ -47,11 +47,9 @@ export class DefaultUpgrader {
47
47
  muxers;
48
48
  inboundUpgradeTimeout;
49
49
  events;
50
- log;
51
50
  constructor(components, init) {
52
51
  this.components = components;
53
52
  this.connectionEncryption = new Map();
54
- this.log = components.logger.forComponent('libp2p:upgrader');
55
53
  init.connectionEncryption.forEach(encrypter => {
56
54
  this.connectionEncryption.set(encrypter.protocol, encrypter);
57
55
  });
@@ -94,13 +92,13 @@ export class DefaultUpgrader {
94
92
  throw new CodeError('The multiaddr connection is blocked by gater.acceptConnection', codes.ERR_CONNECTION_INTERCEPTED);
95
93
  }
96
94
  this.components.metrics?.trackMultiaddrConnection(maConn);
97
- this.log('starting the inbound connection upgrade');
95
+ maConn.log('starting the inbound connection upgrade');
98
96
  // Protect
99
97
  let protectedConn = maConn;
100
98
  if (opts?.skipProtection !== true) {
101
99
  const protector = this.components.connectionProtector;
102
100
  if (protector != null) {
103
- this.log('protecting the inbound connection');
101
+ maConn.log('protecting the inbound connection');
104
102
  protectedConn = await protector.protect(maConn);
105
103
  }
106
104
  }
@@ -143,11 +141,11 @@ export class DefaultUpgrader {
143
141
  }
144
142
  }
145
143
  catch (err) {
146
- this.log.error('Failed to upgrade inbound connection', err);
144
+ maConn.log.error('failed to upgrade inbound connection', err);
147
145
  throw err;
148
146
  }
149
147
  await this.shouldBlockConnection(remotePeer, maConn, 'denyInboundUpgradedConnection');
150
- this.log('successfully upgraded inbound connection');
148
+ maConn.log('successfully upgraded inbound connection');
151
149
  return this._createConnection({
152
150
  cryptoProtocol,
153
151
  direction: 'inbound',
@@ -179,7 +177,7 @@ export class DefaultUpgrader {
179
177
  let cryptoProtocol;
180
178
  let muxerFactory;
181
179
  this.components.metrics?.trackMultiaddrConnection(maConn);
182
- this.log('Starting the outbound connection upgrade');
180
+ maConn.log('starting the outbound connection upgrade');
183
181
  // If the transport natively supports encryption, skip connection
184
182
  // protector and encryption
185
183
  // Protect
@@ -227,12 +225,12 @@ export class DefaultUpgrader {
227
225
  }
228
226
  }
229
227
  catch (err) {
230
- this.log.error('Failed to upgrade outbound connection', err);
228
+ maConn.log.error('failed to upgrade outbound connection', err);
231
229
  await maConn.close(err);
232
230
  throw err;
233
231
  }
234
232
  await this.shouldBlockConnection(remotePeer, maConn, 'denyOutboundUpgradedConnection');
235
- this.log('Successfully upgraded outbound connection');
233
+ maConn.log('successfully upgraded outbound connection');
236
234
  return this._createConnection({
237
235
  cryptoProtocol,
238
236
  direction: 'outbound',
@@ -304,7 +302,7 @@ export class DefaultUpgrader {
304
302
  this._onStream({ connection, stream: muxedStream, protocol });
305
303
  })
306
304
  .catch(async (err) => {
307
- this.log.error('error handling incoming stream id %s', muxedStream.id, err.message, err.code, err.stack);
305
+ connection.log.error('error handling incoming stream id %s', muxedStream.id, err.message, err.code, err.stack);
308
306
  if (muxedStream.timeline.close == null) {
309
307
  await muxedStream.close();
310
308
  }
@@ -320,7 +318,7 @@ export class DefaultUpgrader {
320
318
  connection.log.trace('started new stream %s for protocols %s', muxedStream.id, protocols);
321
319
  try {
322
320
  if (options.signal == null) {
323
- this.log('No abort signal was passed while trying to negotiate protocols %s falling back to default timeout', protocols);
321
+ muxedStream.log('no abort signal was passed while trying to negotiate protocols %s falling back to default timeout', protocols);
324
322
  const signal = AbortSignal.timeout(DEFAULT_PROTOCOL_SELECT_TIMEOUT);
325
323
  setMaxListeners(Infinity, signal);
326
324
  options = {
@@ -383,7 +381,7 @@ export class DefaultUpgrader {
383
381
  muxer.sink(upgradedConn.source),
384
382
  upgradedConn.sink(muxer.source)
385
383
  ]).catch(err => {
386
- this.log.error(err);
384
+ connection.log.error('error piping data through muxer', err);
387
385
  });
388
386
  }
389
387
  const _timeline = maConn.timeline;
@@ -398,7 +396,7 @@ export class DefaultUpgrader {
398
396
  }
399
397
  }
400
398
  catch (err) {
401
- this.log.error(err);
399
+ connection.log.error('error closing connection after timeline close', err);
402
400
  }
403
401
  finally {
404
402
  this.events.safeDispatchEvent('connection:close', {
@@ -406,7 +404,7 @@ export class DefaultUpgrader {
406
404
  });
407
405
  }
408
406
  })().catch(err => {
409
- this.log.error(err);
407
+ connection.log.error('error thrown while dispatching connection:close event', err);
410
408
  });
411
409
  }
412
410
  return Reflect.set(...args);
@@ -437,13 +435,13 @@ export class DefaultUpgrader {
437
435
  close: async (options) => {
438
436
  // Ensure remaining streams are closed gracefully
439
437
  if (muxer != null) {
440
- this.log.trace('close muxer');
438
+ connection.log.trace('close muxer');
441
439
  await muxer.close(options);
442
440
  }
443
- this.log.trace('close maconn');
441
+ connection.log.trace('close maconn');
444
442
  // close the underlying transport
445
443
  await maConn.close(options);
446
- this.log.trace('closed maconn');
444
+ connection.log.trace('closed maconn');
447
445
  },
448
446
  abort: (err) => {
449
447
  maConn.abort(err);
@@ -474,7 +472,7 @@ export class DefaultUpgrader {
474
472
  */
475
473
  async _encryptInbound(connection) {
476
474
  const protocols = Array.from(this.connectionEncryption.keys());
477
- this.log('handling inbound crypto protocol selection', protocols);
475
+ connection.log('handling inbound crypto protocol selection', protocols);
478
476
  try {
479
477
  const { stream, protocol } = await mss.handle(connection, protocols, {
480
478
  log: connection.log
@@ -483,7 +481,7 @@ export class DefaultUpgrader {
483
481
  if (encrypter == null) {
484
482
  throw new Error(`no crypto module found for ${protocol}`);
485
483
  }
486
- this.log('encrypting inbound connection using', protocol);
484
+ connection.log('encrypting inbound connection using', protocol);
487
485
  return {
488
486
  ...await encrypter.secureInbound(this.components.peerId, stream),
489
487
  protocol
@@ -499,7 +497,7 @@ export class DefaultUpgrader {
499
497
  */
500
498
  async _encryptOutbound(connection, remotePeerId) {
501
499
  const protocols = Array.from(this.connectionEncryption.keys());
502
- this.log('selecting outbound crypto protocol', protocols);
500
+ connection.log('selecting outbound crypto protocol', protocols);
503
501
  try {
504
502
  connection.log.trace('selecting encrypter from %s', protocols);
505
503
  const { stream, protocol } = await mss.select(connection, protocols, {
@@ -526,7 +524,7 @@ export class DefaultUpgrader {
526
524
  */
527
525
  async _multiplexOutbound(connection, muxers) {
528
526
  const protocols = Array.from(muxers.keys());
529
- this.log('outbound selecting muxer %s', protocols);
527
+ connection.log('outbound selecting muxer %s', protocols);
530
528
  try {
531
529
  connection.log.trace('selecting stream muxer from %s', protocols);
532
530
  const { stream, protocol } = await mss.select(connection, protocols, {
@@ -538,7 +536,7 @@ export class DefaultUpgrader {
538
536
  return { stream, muxerFactory };
539
537
  }
540
538
  catch (err) {
541
- connection.log.error('error multiplexing outbound stream', err);
539
+ connection.log.error('error multiplexing outbound connection', err);
542
540
  throw new CodeError(String(err), codes.ERR_MUXER_UNAVAILABLE);
543
541
  }
544
542
  }
@@ -548,7 +546,7 @@ export class DefaultUpgrader {
548
546
  */
549
547
  async _multiplexInbound(connection, muxers) {
550
548
  const protocols = Array.from(muxers.keys());
551
- this.log('inbound handling muxers %s', protocols);
549
+ connection.log('inbound handling muxers %s', protocols);
552
550
  try {
553
551
  const { stream, protocol } = await mss.handle(connection, protocols, {
554
552
  log: connection.log
@@ -557,7 +555,7 @@ export class DefaultUpgrader {
557
555
  return { stream, muxerFactory };
558
556
  }
559
557
  catch (err) {
560
- this.log.error('error multiplexing inbound stream', err);
558
+ connection.log.error('error multiplexing inbound connection', err);
561
559
  throw new CodeError(String(err), codes.ERR_MUXER_UNAVAILABLE);
562
560
  }
563
561
  }
@@ -1 +1 @@
1
- {"version":3,"file":"upgrader.js","sourceRoot":"","sources":["../../src/upgrader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC3E,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAI1F,MAAM,+BAA+B,GAAG,KAAK,CAAA;AAiC7C,SAAS,uBAAuB,CAAE,QAAgB,EAAE,SAAoB;IACtE,IAAI,CAAC;Q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B,CAAE,UAA+B,EAAE,MAAuC;QAC/F,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;QAC3C,UAAU,CAAC,GAAG,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAA;QACvD,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE;gBACnE,GAAG,EAAE,UAAU,CAAC,GAAG;aACpB,CAAC,CAAA;YACF,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YAEzC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA;QACjC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,uCAAuC,EAAE,GAAG,CAAC,CAAA;YAClE,MAAM,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAA;QAC/D,CAAC;IACH,CAAC;CACF"}
@@ -1,3 +1,3 @@
1
- export declare const version = "1.0.2";
1
+ export declare const version = "1.0.3-e7167fe52";
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.2';
1
+ export const version = '1.0.3-e7167fe52';
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.2",
3
+ "version": "1.0.3-e7167fe52",
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",
@@ -12,6 +12,7 @@
12
12
  "url": "https://github.com/libp2p/js-libp2p/issues"
13
13
  },
14
14
  "publishConfig": {
15
+ "access": "public",
15
16
  "provenance": true
16
17
  },
17
18
  "keywords": [
@@ -24,6 +25,22 @@
24
25
  ],
25
26
  "type": "module",
26
27
  "types": "./dist/src/index.d.ts",
28
+ "typesVersions": {
29
+ "*": {
30
+ "*": [
31
+ "*",
32
+ "dist/*",
33
+ "dist/src/*",
34
+ "dist/src/*/index"
35
+ ],
36
+ "src/*": [
37
+ "*",
38
+ "dist/*",
39
+ "dist/src/*",
40
+ "dist/src/*/index"
41
+ ]
42
+ }
43
+ },
27
44
  "files": [
28
45
  "src",
29
46
  "dist",
@@ -34,6 +51,10 @@
34
51
  ".": {
35
52
  "types": "./dist/src/index.d.ts",
36
53
  "import": "./dist/src/index.js"
54
+ },
55
+ "./version": {
56
+ "types": "./dist/src/version.d.ts",
57
+ "import": "./dist/src/version.js"
37
58
  }
38
59
  },
39
60
  "eslintConfig": {
@@ -64,16 +85,16 @@
64
85
  "test:interop": "aegir test -t node -f dist/test/interop.js"
65
86
  },
66
87
  "dependencies": {
67
- "@libp2p/crypto": "^3.0.1",
68
- "@libp2p/interface": "^1.0.1",
69
- "@libp2p/interface-internal": "^0.1.11",
70
- "@libp2p/logger": "^4.0.1",
71
- "@libp2p/multistream-select": "^4.0.9",
72
- "@libp2p/peer-collections": "^4.0.10",
73
- "@libp2p/peer-id": "^4.0.1",
74
- "@libp2p/peer-id-factory": "^3.0.10",
75
- "@libp2p/peer-store": "^9.0.11",
76
- "@libp2p/utils": "^5.0.1",
88
+ "@libp2p/crypto": "3.0.1-e7167fe52",
89
+ "@libp2p/interface": "1.0.1-e7167fe52",
90
+ "@libp2p/interface-internal": "0.1.11-e7167fe52",
91
+ "@libp2p/logger": "4.0.1-e7167fe52",
92
+ "@libp2p/multistream-select": "4.0.9-e7167fe52",
93
+ "@libp2p/peer-collections": "4.0.10-e7167fe52",
94
+ "@libp2p/peer-id": "4.0.1-e7167fe52",
95
+ "@libp2p/peer-id-factory": "3.0.10-e7167fe52",
96
+ "@libp2p/peer-store": "9.0.11-e7167fe52",
97
+ "@libp2p/utils": "5.0.1-e7167fe52",
77
98
  "@multiformats/mafmt": "^12.1.6",
78
99
  "@multiformats/multiaddr": "^12.1.10",
79
100
  "@multiformats/multiaddr-matcher": "^1.1.0",
@@ -102,20 +123,20 @@
102
123
  "@chainsafe/libp2p-gossipsub": "^10.0.0",
103
124
  "@chainsafe/libp2p-noise": "^14.0.0",
104
125
  "@chainsafe/libp2p-yamux": "^6.0.1",
105
- "@libp2p/bootstrap": "^10.0.2",
106
- "@libp2p/circuit-relay-v2": "^1.0.2",
126
+ "@libp2p/bootstrap": "10.0.2-e7167fe52",
127
+ "@libp2p/circuit-relay-v2": "1.0.2-e7167fe52",
107
128
  "@libp2p/daemon-client": "^8.0.0",
108
129
  "@libp2p/daemon-server": "^7.0.0",
109
- "@libp2p/floodsub": "^8.0.16",
110
- "@libp2p/identify": "^1.0.1",
111
- "@libp2p/interface-compliance-tests": "^5.0.2",
130
+ "@libp2p/floodsub": "8.0.16-e7167fe52",
131
+ "@libp2p/identify": "1.0.1-e7167fe52",
132
+ "@libp2p/interface-compliance-tests": "5.0.2-e7167fe52",
112
133
  "@libp2p/interop": "^10.0.0",
113
- "@libp2p/kad-dht": "^11.0.2",
114
- "@libp2p/mdns": "^10.0.2",
115
- "@libp2p/mplex": "^10.0.2",
116
- "@libp2p/plaintext": "^1.0.2",
117
- "@libp2p/tcp": "^9.0.2",
118
- "@libp2p/websockets": "^8.0.2",
134
+ "@libp2p/kad-dht": "11.0.2-e7167fe52",
135
+ "@libp2p/mdns": "10.0.2-e7167fe52",
136
+ "@libp2p/mplex": "10.0.2-e7167fe52",
137
+ "@libp2p/plaintext": "1.0.2-e7167fe52",
138
+ "@libp2p/tcp": "9.0.2-e7167fe52",
139
+ "@libp2p/websockets": "8.0.2-e7167fe52",
119
140
  "aegir": "^41.0.2",
120
141
  "execa": "^8.0.1",
121
142
  "go-libp2p": "^1.1.1",
package/src/upgrader.ts CHANGED
@@ -5,7 +5,7 @@ import { createConnection } from './connection/index.js'
5
5
  import { INBOUND_UPGRADE_TIMEOUT } from './connection-manager/constants.js'
6
6
  import { codes } from './errors.js'
7
7
  import { DEFAULT_MAX_INBOUND_STREAMS, DEFAULT_MAX_OUTBOUND_STREAMS } from './registrar.js'
8
- import type { Libp2pEvents, AbortOptions, ComponentLogger, Logger, MultiaddrConnection, Connection, Stream, ConnectionProtector, NewStreamOptions, ConnectionEncrypter, SecuredConnection, ConnectionGater, TypedEventTarget, Metrics, PeerId, PeerStore, StreamMuxer, StreamMuxerFactory, Upgrader, UpgraderOptions } from '@libp2p/interface'
8
+ import type { Libp2pEvents, AbortOptions, ComponentLogger, MultiaddrConnection, Connection, Stream, ConnectionProtector, NewStreamOptions, ConnectionEncrypter, SecuredConnection, ConnectionGater, TypedEventTarget, Metrics, PeerId, PeerStore, StreamMuxer, StreamMuxerFactory, Upgrader, UpgraderOptions } from '@libp2p/interface'
9
9
  import type { ConnectionManager, Registrar } from '@libp2p/interface-internal'
10
10
 
11
11
  const DEFAULT_PROTOCOL_SELECT_TIMEOUT = 30000
@@ -103,12 +103,10 @@ export class DefaultUpgrader implements Upgrader {
103
103
  private readonly muxers: Map<string, StreamMuxerFactory>
104
104
  private readonly inboundUpgradeTimeout: number
105
105
  private readonly events: TypedEventTarget<Libp2pEvents>
106
- private readonly log: Logger
107
106
 
108
107
  constructor (components: DefaultUpgraderComponents, init: UpgraderInit) {
109
108
  this.components = components
110
109
  this.connectionEncryption = new Map()
111
- this.log = components.logger.forComponent('libp2p:upgrader')
112
110
 
113
111
  init.connectionEncryption.forEach(encrypter => {
114
112
  this.connectionEncryption.set(encrypter.protocol, encrypter)
@@ -167,7 +165,7 @@ export class DefaultUpgrader implements Upgrader {
167
165
 
168
166
  this.components.metrics?.trackMultiaddrConnection(maConn)
169
167
 
170
- this.log('starting the inbound connection upgrade')
168
+ maConn.log('starting the inbound connection upgrade')
171
169
 
172
170
  // Protect
173
171
  let protectedConn = maConn
@@ -176,7 +174,7 @@ export class DefaultUpgrader implements Upgrader {
176
174
  const protector = this.components.connectionProtector
177
175
 
178
176
  if (protector != null) {
179
- this.log('protecting the inbound connection')
177
+ maConn.log('protecting the inbound connection')
180
178
  protectedConn = await protector.protect(maConn)
181
179
  }
182
180
  }
@@ -223,13 +221,13 @@ export class DefaultUpgrader implements Upgrader {
223
221
  upgradedConn = multiplexed.stream
224
222
  }
225
223
  } catch (err: any) {
226
- this.log.error('Failed to upgrade inbound connection', err)
224
+ maConn.log.error('failed to upgrade inbound connection', err)
227
225
  throw err
228
226
  }
229
227
 
230
228
  await this.shouldBlockConnection(remotePeer, maConn, 'denyInboundUpgradedConnection')
231
229
 
232
- this.log('successfully upgraded inbound connection')
230
+ maConn.log('successfully upgraded inbound connection')
233
231
 
234
232
  return this._createConnection({
235
233
  cryptoProtocol,
@@ -268,7 +266,7 @@ export class DefaultUpgrader implements Upgrader {
268
266
 
269
267
  this.components.metrics?.trackMultiaddrConnection(maConn)
270
268
 
271
- this.log('Starting the outbound connection upgrade')
269
+ maConn.log('starting the outbound connection upgrade')
272
270
 
273
271
  // If the transport natively supports encryption, skip connection
274
272
  // protector and encryption
@@ -321,14 +319,14 @@ export class DefaultUpgrader implements Upgrader {
321
319
  upgradedConn = multiplexed.stream
322
320
  }
323
321
  } catch (err: any) {
324
- this.log.error('Failed to upgrade outbound connection', err)
322
+ maConn.log.error('failed to upgrade outbound connection', err)
325
323
  await maConn.close(err)
326
324
  throw err
327
325
  }
328
326
 
329
327
  await this.shouldBlockConnection(remotePeer, maConn, 'denyOutboundUpgradedConnection')
330
328
 
331
- this.log('Successfully upgraded outbound connection')
329
+ maConn.log('successfully upgraded outbound connection')
332
330
 
333
331
  return this._createConnection({
334
332
  cryptoProtocol,
@@ -425,7 +423,7 @@ export class DefaultUpgrader implements Upgrader {
425
423
  this._onStream({ connection, stream: muxedStream, protocol })
426
424
  })
427
425
  .catch(async err => {
428
- this.log.error('error handling incoming stream id %s', muxedStream.id, err.message, err.code, err.stack)
426
+ connection.log.error('error handling incoming stream id %s', muxedStream.id, err.message, err.code, err.stack)
429
427
 
430
428
  if (muxedStream.timeline.close == null) {
431
429
  await muxedStream.close()
@@ -445,7 +443,7 @@ export class DefaultUpgrader implements Upgrader {
445
443
 
446
444
  try {
447
445
  if (options.signal == null) {
448
- this.log('No abort signal was passed while trying to negotiate protocols %s falling back to default timeout', protocols)
446
+ muxedStream.log('no abort signal was passed while trying to negotiate protocols %s falling back to default timeout', protocols)
449
447
 
450
448
  const signal = AbortSignal.timeout(DEFAULT_PROTOCOL_SELECT_TIMEOUT)
451
449
  setMaxListeners(Infinity, signal)
@@ -529,7 +527,7 @@ export class DefaultUpgrader implements Upgrader {
529
527
  muxer.sink(upgradedConn.source),
530
528
  upgradedConn.sink(muxer.source)
531
529
  ]).catch(err => {
532
- this.log.error(err)
530
+ connection.log.error('error piping data through muxer', err)
533
531
  })
534
532
  }
535
533
 
@@ -544,14 +542,14 @@ export class DefaultUpgrader implements Upgrader {
544
542
  await connection.close()
545
543
  }
546
544
  } catch (err: any) {
547
- this.log.error(err)
545
+ connection.log.error('error closing connection after timeline close', err)
548
546
  } finally {
549
547
  this.events.safeDispatchEvent('connection:close', {
550
548
  detail: connection
551
549
  })
552
550
  }
553
551
  })().catch(err => {
554
- this.log.error(err)
552
+ connection.log.error('error thrown while dispatching connection:close event', err)
555
553
  })
556
554
  }
557
555
 
@@ -580,14 +578,14 @@ export class DefaultUpgrader implements Upgrader {
580
578
  close: async (options?: AbortOptions) => {
581
579
  // Ensure remaining streams are closed gracefully
582
580
  if (muxer != null) {
583
- this.log.trace('close muxer')
581
+ connection.log.trace('close muxer')
584
582
  await muxer.close(options)
585
583
  }
586
584
 
587
- this.log.trace('close maconn')
585
+ connection.log.trace('close maconn')
588
586
  // close the underlying transport
589
587
  await maConn.close(options)
590
- this.log.trace('closed maconn')
588
+ connection.log.trace('closed maconn')
591
589
  },
592
590
  abort: (err) => {
593
591
  maConn.abort(err)
@@ -624,7 +622,7 @@ export class DefaultUpgrader implements Upgrader {
624
622
  */
625
623
  async _encryptInbound (connection: MultiaddrConnection): Promise<CryptoResult> {
626
624
  const protocols = Array.from(this.connectionEncryption.keys())
627
- this.log('handling inbound crypto protocol selection', protocols)
625
+ connection.log('handling inbound crypto protocol selection', protocols)
628
626
 
629
627
  try {
630
628
  const { stream, protocol } = await mss.handle(connection, protocols, {
@@ -636,7 +634,7 @@ export class DefaultUpgrader implements Upgrader {
636
634
  throw new Error(`no crypto module found for ${protocol}`)
637
635
  }
638
636
 
639
- this.log('encrypting inbound connection using', protocol)
637
+ connection.log('encrypting inbound connection using', protocol)
640
638
 
641
639
  return {
642
640
  ...await encrypter.secureInbound(this.components.peerId, stream),
@@ -653,7 +651,7 @@ export class DefaultUpgrader implements Upgrader {
653
651
  */
654
652
  async _encryptOutbound (connection: MultiaddrConnection, remotePeerId?: PeerId): Promise<CryptoResult> {
655
653
  const protocols = Array.from(this.connectionEncryption.keys())
656
- this.log('selecting outbound crypto protocol', protocols)
654
+ connection.log('selecting outbound crypto protocol', protocols)
657
655
 
658
656
  try {
659
657
  connection.log.trace('selecting encrypter from %s', protocols)
@@ -689,7 +687,7 @@ export class DefaultUpgrader implements Upgrader {
689
687
  */
690
688
  async _multiplexOutbound (connection: MultiaddrConnection, muxers: Map<string, StreamMuxerFactory>): Promise<{ stream: MultiaddrConnection, muxerFactory?: StreamMuxerFactory }> {
691
689
  const protocols = Array.from(muxers.keys())
692
- this.log('outbound selecting muxer %s', protocols)
690
+ connection.log('outbound selecting muxer %s', protocols)
693
691
  try {
694
692
  connection.log.trace('selecting stream muxer from %s', protocols)
695
693
 
@@ -706,7 +704,7 @@ export class DefaultUpgrader implements Upgrader {
706
704
 
707
705
  return { stream, muxerFactory }
708
706
  } catch (err: any) {
709
- connection.log.error('error multiplexing outbound stream', err)
707
+ connection.log.error('error multiplexing outbound connection', err)
710
708
  throw new CodeError(String(err), codes.ERR_MUXER_UNAVAILABLE)
711
709
  }
712
710
  }
@@ -717,7 +715,7 @@ export class DefaultUpgrader implements Upgrader {
717
715
  */
718
716
  async _multiplexInbound (connection: MultiaddrConnection, muxers: Map<string, StreamMuxerFactory>): Promise<{ stream: MultiaddrConnection, muxerFactory?: StreamMuxerFactory }> {
719
717
  const protocols = Array.from(muxers.keys())
720
- this.log('inbound handling muxers %s', protocols)
718
+ connection.log('inbound handling muxers %s', protocols)
721
719
  try {
722
720
  const { stream, protocol } = await mss.handle(connection, protocols, {
723
721
  log: connection.log
@@ -726,7 +724,7 @@ export class DefaultUpgrader implements Upgrader {
726
724
 
727
725
  return { stream, muxerFactory }
728
726
  } catch (err: any) {
729
- this.log.error('error multiplexing inbound stream', err)
727
+ connection.log.error('error multiplexing inbound connection', err)
730
728
  throw new CodeError(String(err), codes.ERR_MUXER_UNAVAILABLE)
731
729
  }
732
730
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const version = '1.0.2'
1
+ export const version = '1.0.3-e7167fe52'
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
- }