libp2p 0.45.1 → 0.45.2
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/dist/index.min.js +1 -1
- package/dist/src/autonat/index.js +27 -27
- package/dist/src/autonat/index.js.map +1 -1
- package/dist/src/libp2p.d.ts.map +1 -1
- package/dist/src/libp2p.js +2 -0
- package/dist/src/libp2p.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +2 -2
- package/src/autonat/index.ts +27 -27
- package/src/libp2p.ts +3 -0
- package/src/version.ts +1 -1
package/dist/index.min.js
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
(?::(?:(?::${Le}){0,5}:${kt}|(?::${Le}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
47
47
|
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
48
48
|
`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),jE=new RegExp(`(?:^${kt}$)|(?:^${Qo}$)`),JE=new RegExp(`^${kt}$`),eb=new RegExp(`^${Qo}$`),ol=t=>t&&t.exact?jE:new RegExp(`(?:${Fr(t)}${kt}${Fr(t)})|(?:${Fr(t)}${Qo}${Fr(t)})`,"g");ol.v4=t=>t&&t.exact?JE:new RegExp(`${Fr(t)}${kt}${Fr(t)}`,"g");ol.v6=t=>t&&t.exact?eb:new RegExp(`${Fr(t)}${Qo}${Fr(t)}`,"g");var xm=ol;var _m=V(vm(),1),{isValid:tb,parse:rb}=_m.default,nb=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],ib=nb.map(t=>new bm.Netmask(t));function sb(t){for(let e of ib)if(e.contains(t))return!0;return!1}function Em(t){return/^::$/.test(t)||/^::1$/.test(t)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(t)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(t)||/^ff([0-9a-fA-F]{2,2}):/i.test(t)}var Sm=t=>{if(tb(t)){let e=rb(t);if(e.kind()==="ipv4")return sb(e.toNormalizedString());if(e.kind()==="ipv6")return Em(t)}else if(ni(t)&&xm.v6().test(t))return Em(t)};var Zo=Sm;function Am(t={}){return{denyDialPeer:async()=>!1,denyDialMultiaddr:async e=>{let r=e.stringTuples();return r[0][0]===4||r[0][0]===41?!!Zo(`${r[0][1]}`):!1},denyInboundConnection:async()=>!1,denyOutboundConnection:async()=>!1,denyInboundEncryptedConnection:async()=>!1,denyOutboundEncryptedConnection:async()=>!1,denyInboundUpgradedConnection:async()=>!1,denyOutboundUpgradedConnection:async()=>!1,filterMultiaddrForPeer:async()=>!0,...t}}var c3=Symbol.for("@libp2p/transport");var Ur;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(Ur||(Ur={}));function al(t){try{let{address:e}=t.nodeAddress();return!!Zo(e)}catch{return!0}}function ui(t,e){let r=al(t.multiaddr),n=al(e.multiaddr);return r&&!n?1:!r&&n||t.isCertified&&!e.isCertified?-1:!t.isCertified&&e.isCertified?1:0}var ul=V(hu(),1),ll=V(Cm(),1);var Tm=globalThis.fetch,Bm=globalThis.Headers,m3=globalThis.Request,y3=globalThis.Response;function jo(t,e,r){return`${t}?name=${e}&type=${r}`}async function Pm(t,e){return await(await Tm(t,{headers:new Bm({accept:"application/dns-json"}),signal:e})).json()}function gn(t,e){return`${e}_${t}`}var cl=Object.assign((0,ul.default)("dns-over-http-resolver"),{error:(0,ul.default)("dns-over-http-resolver:error")}),fl=class{constructor(e={}){this._cache=new ll.default({max:e?.maxCache??100}),this._TXTcache=new ll.default({max:e?.maxCache??100}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"],this._request=e.request??Pm,this._abortControllers=[]}cancel(){this._abortControllers.forEach(e=>e.abort())}getServers(){return this._servers}_getShuffledServers(){let e=[...this._servers];for(let r=e.length-1;r>0;r--){let n=Math.floor(Math.random()*r),i=e[r];e[r]=e[n],e[n]=i}return e}setServers(e){this._servers=e}async resolve(e,r="A"){switch(r){case"A":return await this.resolve4(e);case"AAAA":return await this.resolve6(e);case"TXT":return await this.resolveTxt(e);default:throw new Error(`${r} is not supported`)}}async resolve4(e){let r="A",n=this._cache.get(gn(e,r));if(n!=null)return n;let i=!1;for(let s of this._getShuffledServers()){let o=new AbortController;this._abortControllers.push(o);try{let a=await this._request(jo(s,e,r),o.signal),c=a.Answer.map(l=>l.data),u=Math.min(...a.Answer.map(l=>l.TTL));return this._cache.set(gn(e,r),c,{ttl:u}),c}catch{o.signal.aborted&&(i=!0),cl.error(`${s} could not resolve ${e} record ${r}`)}finally{this._abortControllers=this._abortControllers.filter(a=>a!==o)}}throw i?Object.assign(new Error("queryA ECANCELLED"),{code:"ECANCELLED"}):new Error(`Could not resolve ${e} record ${r}`)}async resolve6(e){let r="AAAA",n=this._cache.get(gn(e,r));if(n!=null)return n;let i=!1;for(let s of this._getShuffledServers()){let o=new AbortController;this._abortControllers.push(o);try{let a=await this._request(jo(s,e,r),o.signal),c=a.Answer.map(l=>l.data),u=Math.min(...a.Answer.map(l=>l.TTL));return this._cache.set(gn(e,r),c,{ttl:u}),c}catch{o.signal.aborted&&(i=!0),cl.error(`${s} could not resolve ${e} record ${r}`)}finally{this._abortControllers=this._abortControllers.filter(a=>a!==o)}}throw i?Object.assign(new Error("queryAaaa ECANCELLED"),{code:"ECANCELLED"}):new Error(`Could not resolve ${e} record ${r}`)}async resolveTxt(e){let r="TXT",n=this._TXTcache.get(gn(e,r));if(n!=null)return n;let i=!1;for(let s of this._getShuffledServers()){let o=new AbortController;this._abortControllers.push(o);try{let a=await this._request(jo(s,e,r),o.signal),c=a.Answer.map(l=>[l.data.replace(/['"]+/g,"")]),u=Math.min(...a.Answer.map(l=>l.TTL));return this._TXTcache.set(gn(e,r),c,{ttl:u}),c}catch{o.signal.aborted&&(i=!0),cl.error(`${s} could not resolve ${e} record ${r}`)}finally{this._abortControllers=this._abortControllers.filter(a=>a!==o)}}throw i?Object.assign(new Error("queryTxt ECANCELLED"),{code:"ECANCELLED"}):new Error(`Could not resolve ${e} record ${r}`)}clearCache(){this._cache.clear(),this._TXTcache.clear()}},Lm=fl;var Dm=Lm;var{code:lb}=ce("dnsaddr");async function li(t,e={}){let r=new Dm;e.signal!=null&&e.signal.addEventListener("abort",()=>{r.cancel()});let n=t.getPeerId(),[,i]=t.stringTuples().find(([a])=>a===lb)??[];if(i==null)throw new Error("No hostname found in multiaddr");let o=(await r.resolveTxt(`_dnsaddr.${i}`)).flat().map(a=>a.split("=")[1]).filter(Boolean);return n!=null&&(o=o.filter(a=>a.includes(n))),o}var Zt;(function(t){t.NOT_STARTED_YET="The libp2p node is not started yet",t.DHT_DISABLED="DHT is not available",t.PUBSUB_DISABLED="PubSub is not available",t.CONN_ENCRYPTION_REQUIRED="At least one connection encryption module is required",t.ERR_TRANSPORTS_REQUIRED="At least one transport module is required",t.ERR_PROTECTOR_REQUIRED="Private network is enforced, but no protector was provided",t.NOT_FOUND="Not found"})(Zt||(Zt={}));var N;(function(t){t.DHT_DISABLED="ERR_DHT_DISABLED",t.ERR_PUBSUB_DISABLED="ERR_PUBSUB_DISABLED",t.PUBSUB_NOT_STARTED="ERR_PUBSUB_NOT_STARTED",t.DHT_NOT_STARTED="ERR_DHT_NOT_STARTED",t.CONN_ENCRYPTION_REQUIRED="ERR_CONN_ENCRYPTION_REQUIRED",t.ERR_TRANSPORTS_REQUIRED="ERR_TRANSPORTS_REQUIRED",t.ERR_PROTECTOR_REQUIRED="ERR_PROTECTOR_REQUIRED",t.ERR_PEER_DIAL_INTERCEPTED="ERR_PEER_DIAL_INTERCEPTED",t.ERR_CONNECTION_INTERCEPTED="ERR_CONNECTION_INTERCEPTED",t.ERR_INVALID_PROTOCOLS_FOR_STREAM="ERR_INVALID_PROTOCOLS_FOR_STREAM",t.ERR_CONNECTION_ENDED="ERR_CONNECTION_ENDED",t.ERR_CONNECTION_FAILED="ERR_CONNECTION_FAILED",t.ERR_NODE_NOT_STARTED="ERR_NODE_NOT_STARTED",t.ERR_ALREADY_ABORTED="ERR_ALREADY_ABORTED",t.ERR_TOO_MANY_ADDRESSES="ERR_TOO_MANY_ADDRESSES",t.ERR_NO_VALID_ADDRESSES="ERR_NO_VALID_ADDRESSES",t.ERR_RELAYED_DIAL="ERR_RELAYED_DIAL",t.ERR_DIALED_SELF="ERR_DIALED_SELF",t.ERR_DISCOVERED_SELF="ERR_DISCOVERED_SELF",t.ERR_DUPLICATE_TRANSPORT="ERR_DUPLICATE_TRANSPORT",t.ERR_ENCRYPTION_FAILED="ERR_ENCRYPTION_FAILED",t.ERR_HOP_REQUEST_FAILED="ERR_HOP_REQUEST_FAILED",t.ERR_INVALID_KEY="ERR_INVALID_KEY",t.ERR_INVALID_MESSAGE="ERR_INVALID_MESSAGE",t.ERR_INVALID_PARAMETERS="ERR_INVALID_PARAMETERS",t.ERR_INVALID_PEER="ERR_INVALID_PEER",t.ERR_MUXER_UNAVAILABLE="ERR_MUXER_UNAVAILABLE",t.ERR_NOT_FOUND="ERR_NOT_FOUND",t.ERR_TIMEOUT="ERR_TIMEOUT",t.ERR_TRANSPORT_UNAVAILABLE="ERR_TRANSPORT_UNAVAILABLE",t.ERR_TRANSPORT_DIAL_FAILED="ERR_TRANSPORT_DIAL_FAILED",t.ERR_UNSUPPORTED_PROTOCOL="ERR_UNSUPPORTED_PROTOCOL",t.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED="ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED",t.ERR_INVALID_MULTIADDR="ERR_INVALID_MULTIADDR",t.ERR_SIGNATURE_NOT_VALID="ERR_SIGNATURE_NOT_VALID",t.ERR_FIND_SELF="ERR_FIND_SELF",t.ERR_NO_ROUTERS_AVAILABLE="ERR_NO_ROUTERS_AVAILABLE",t.ERR_CONNECTION_NOT_MULTIPLEXED="ERR_CONNECTION_NOT_MULTIPLEXED",t.ERR_NO_DIAL_TOKENS="ERR_NO_DIAL_TOKENS",t.ERR_KEYCHAIN_REQUIRED="ERR_KEYCHAIN_REQUIRED",t.ERR_INVALID_CMS="ERR_INVALID_CMS",t.ERR_MISSING_KEYS="ERR_MISSING_KEYS",t.ERR_NO_KEY="ERR_NO_KEY",t.ERR_INVALID_KEY_NAME="ERR_INVALID_KEY_NAME",t.ERR_INVALID_KEY_TYPE="ERR_INVALID_KEY_TYPE",t.ERR_KEY_ALREADY_EXISTS="ERR_KEY_ALREADY_EXISTS",t.ERR_INVALID_KEY_SIZE="ERR_INVALID_KEY_SIZE",t.ERR_KEY_NOT_FOUND="ERR_KEY_NOT_FOUND",t.ERR_OLD_KEY_NAME_INVALID="ERR_OLD_KEY_NAME_INVALID",t.ERR_NEW_KEY_NAME_INVALID="ERR_NEW_KEY_NAME_INVALID",t.ERR_PASSWORD_REQUIRED="ERR_PASSWORD_REQUIRED",t.ERR_PEM_REQUIRED="ERR_PEM_REQUIRED",t.ERR_CANNOT_READ_KEY="ERR_CANNOT_READ_KEY",t.ERR_MISSING_PRIVATE_KEY="ERR_MISSING_PRIVATE_KEY",t.ERR_MISSING_PUBLIC_KEY="ERR_MISSING_PUBLIC_KEY",t.ERR_INVALID_OLD_PASS_TYPE="ERR_INVALID_OLD_PASS_TYPE",t.ERR_INVALID_NEW_PASS_TYPE="ERR_INVALID_NEW_PASS_TYPE",t.ERR_INVALID_PASS_LENGTH="ERR_INVALID_PASS_LENGTH",t.ERR_NOT_IMPLEMENTED="ERR_NOT_IMPLEMENTED",t.ERR_WRONG_PING_ACK="ERR_WRONG_PING_ACK",t.ERR_INVALID_RECORD="ERR_INVALID_RECORD",t.ERR_ALREADY_SUCCEEDED="ERR_ALREADY_SUCCEEDED",t.ERR_NO_HANDLER_FOR_PROTOCOL="ERR_NO_HANDLER_FOR_PROTOCOL",t.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS",t.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS",t.ERR_CONNECTION_DENIED="ERR_CONNECTION_DENIED",t.ERR_TRANSFER_LIMIT_EXCEEDED="ERR_TRANSFER_LIMIT_EXCEEDED"})(N||(N={}));var fb={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:t=>t},connectionManager:{resolvers:{dnsaddr:li},addressSorter:ui},transportManager:{faultTolerance:Ur.FATAL_ALL}};function Nm(t){let e=Lr(fb,t);if(e.transports==null||e.transports.length<1)throw new E(Zt.ERR_TRANSPORTS_REQUIRED,N.ERR_TRANSPORTS_REQUIRED);if(e.connectionProtector===null&&globalThis.process?.env?.LIBP2P_FORCE_PNET!=null)throw new E(Zt.ERR_PROTECTOR_REQUIRED,N.ERR_PROTECTOR_REQUIRED);return e}var km="keep-alive";var Ny=V(By(),1);var Yb=G("libp2p:get-peer");function ea(t){if(vo(t))return{peerId:t,multiaddrs:[]};Array.isArray(t)||(t=[t]);let e;if(t.length>0){let r=t[0].getPeerId();e=r==null?void 0:ie(r),t.forEach(n=>{if(!pn(n))throw Yb.error("multiaddr %s was invalid",n),new E("Invalid Multiaddr",N.ERR_INVALID_MULTIADDR);let i=n.getPeerId();if(i==null){if(e!=null)throw new E("Multiaddrs must all have the same peer id or have no peer id",N.ERR_INVALID_PARAMETERS)}else{let s=ie(i);if(e==null||!e.equals(s))throw new E("Multiaddrs must all have the same peer id or have no peer id",N.ERR_INVALID_PARAMETERS)}})}return{peerId:e,multiaddrs:t}}var jt=G("libp2p:connection-manager:auto-dial"),ta={minConnections:50,autoDialConcurrency:25,autoDialPriority:0,autoDialInterval:5e3},ra=class{connectionManager;peerStore;queue;minConnections;autoDialPriority;autoDialIntervalMs;autoDialInterval;started;constructor(e,r){this.connectionManager=e.connectionManager,this.peerStore=e.peerStore,this.minConnections=r.minConnections??ta.minConnections,this.autoDialPriority=r.autoDialPriority??ta.autoDialPriority,this.autoDialIntervalMs=r.autoDialInterval??ta.autoDialInterval,this.started=!1,this.queue=new Dt({concurrency:r.autoDialConcurrency??ta.autoDialConcurrency}),this.queue.addListener("error",n=>{jt.error("error during auto-dial",n)}),e.events.addEventListener("connection:close",()=>{this.autoDial().catch(n=>{jt.error(n)})})}isStarted(){return this.started}start(){this.autoDialInterval=setInterval(()=>{this.autoDial().catch(e=>{jt.error("error while autodialing",e)})},this.autoDialIntervalMs),this.started=!0}afterStart(){this.autoDial().catch(e=>{jt.error("error while autodialing",e)})}stop(){this.queue.clear(),clearInterval(this.autoDialInterval),this.started=!1}async autoDial(){if(!this.started)return;let e=this.connectionManager.getConnectionsMap(),r=e.size,n=new Bt(this.connectionManager.getDialQueue().map(u=>u.peerId).filter(Boolean));if(r>=this.minConnections){jt.trace("have enough connections %d/%d",r,this.minConnections);return}jt("not enough connections %d/%d - will dial peers to increase the number of connections",r,this.minConnections);let i=await this.peerStore.all(),o=i.filter(u=>!(u.addresses.length===0||e.has(u.id)||n.has(u.id))).sort(()=>Math.random()>.5?1:-1),a=new lr;for(let u of o)a.has(u.id)||a.set(u.id,[...u.tags.values()].reduce((l,f)=>l+f.value,0));let c=o.sort((u,l)=>{let f=a.get(u.id)??0,h=a.get(l.id)??0;return f>h?-1:f<h?1:0});jt("selected %d/%d peers to dial",c.length,i.length);for(let u of c)this.queue.add(async()=>{let l=this.connectionManager.getConnectionsMap().size;if(l>=this.minConnections){jt("got enough connections now %d/%d",l,this.minConnections),this.queue.clear();return}jt("connecting to a peerStore stored peer %p",u.id),await this.connectionManager.openConnection(u.id,{priority:this.autoDialPriority})}).catch(l=>{jt.error("could not connect to peerStore stored peer",l)})}};var mi=G("libp2p:connection-manager:connection-pruner"),Py={maxConnections:300,allow:[]},na=class{maxConnections;connectionManager;peerStore;allow;events;constructor(e,r={}){this.maxConnections=r.maxConnections??Py.maxConnections,this.allow=r.allow??Py.allow,this.connectionManager=e.connectionManager,this.peerStore=e.peerStore,this.events=e.events,e.events.addEventListener("connection:open",()=>{this.maybePruneConnections().catch(n=>{mi.error(n)})})}async maybePruneConnections(){let e=this.connectionManager.getConnections(),r=e.length,n=Math.max(r-this.maxConnections,0);if(mi("checking max connections limit %d/%d",r,this.maxConnections),r<=this.maxConnections)return;mi("max connections limit exceeded %d/%d, pruning %d connection(s)",r,this.maxConnections,n);let i=new lr;for(let a of e){let c=a.remotePeer;if(!i.has(c)){i.set(c,0);try{let u=await this.peerStore.get(c);i.set(c,[...u.tags.values()].reduce((l,f)=>l+f.value,0))}catch(u){u.code!=="ERR_NOT_FOUND"&&mi.error("error loading peer tags",u)}}}let s=e.sort((a,c)=>{let u=i.get(a.remotePeer)??0,l=i.get(c.remotePeer)??0;if(u>l)return 1;if(u<l)return-1;let f=a.stat.timeline.open,h=c.stat.timeline.open;return f<h?1:f>h?-1:0}),o=[];for(let a of s)if(mi("too many connections open - closing a connection to %p",a.remotePeer),this.allow.some(u=>a.remoteAddr.toString().startsWith(u.toString()))||o.push(a),o.length===n)break;await Promise.all(o.map(async a=>{try{await a.close()}catch(c){mi.error(c)}})),this.events.safeDispatchEvent("connection:prune",{detail:o})}};var Pl=V(bi(),1);function yi(t){let e=new globalThis.AbortController;function r(){e.abort();for(let s of t)s?.removeEventListener!=null&&s.removeEventListener("abort",r)}for(let s of t){if(s?.aborted===!0){r();break}s?.addEventListener!=null&&s.addEventListener("abort",r)}function n(){for(let s of t)s?.removeEventListener!=null&&s.removeEventListener("abort",r)}let i=e.signal;return i.clear=n,i}function hs(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var Tl=V(bi(),1);var Ly=G("libp2p:connection-manager:utils");async function Bl(t,e){if(!t.protoNames().includes("dnsaddr"))return[t];let n=await Qb(t,e),o=(await Promise.all(n.map(async a=>Bl(a,e)))).flat().reduce((a,c)=>(a.find(u=>u.equals(c))==null&&a.push(c),a),[]);return Ly("resolved %s to",t,o.map(a=>a.toString())),o}async function Qb(t,e){try{return t=Ne(t.toString()),await t.resolve(e)}catch(r){return Ly.error(`multiaddr ${t.toString()} could not be resolved`,r),[]}}function Dy(...t){let e=[];for(let n of t)if(n!=null){try{(0,Tl.setMaxListeners)?.(1/0,n)}catch{}e.push(n)}let r=yi(e);try{(0,Tl.setMaxListeners)?.(1/0,r)}catch{}return r}var Ye=G("libp2p:connection-manager:dial-queue"),ds={addressSorter:ui,maxParallelDials:100,maxPeerAddrsToDial:25,maxParallelDialsPerPeer:10,dialTimeout:3e4,resolvers:{dnsaddr:li}},ia=class{pendingDials;queue;peerId;peerStore;connectionGater;transportManager;addressSorter;maxPeerAddrsToDial;maxParallelDialsPerPeer;dialTimeout;inProgressDialCount;pendingDialCount;shutDownController;constructor(e,r={}){this.addressSorter=r.addressSorter??ds.addressSorter,this.maxPeerAddrsToDial=r.maxPeerAddrsToDial??ds.maxPeerAddrsToDial,this.maxParallelDialsPerPeer=r.maxParallelDialsPerPeer??ds.maxParallelDialsPerPeer,this.dialTimeout=r.dialTimeout??ds.dialTimeout,this.peerId=e.peerId,this.peerStore=e.peerStore,this.connectionGater=e.connectionGater,this.transportManager=e.transportManager,this.shutDownController=new AbortController;try{(0,Pl.setMaxListeners)?.(1/0,this.shutDownController.signal)}catch{}this.pendingDialCount=e.metrics?.registerMetric("libp2p_dialler_pending_dials"),this.inProgressDialCount=e.metrics?.registerMetric("libp2p_dialler_in_progress_dials"),this.pendingDials=[];for(let[n,i]of Object.entries(r.resolvers??{}))Du.set(n,i);this.queue=new Dt({concurrency:r.maxParallelDials??ds.maxParallelDials}),this.queue.on("add",()=>{this.pendingDialCount?.update(this.queue.size),this.inProgressDialCount?.update(this.queue.pending)}),this.queue.on("active",()=>{this.pendingDialCount?.update(this.queue.size),this.inProgressDialCount?.update(this.queue.pending)}),this.queue.on("completed",()=>{this.pendingDialCount?.update(this.queue.size),this.inProgressDialCount?.update(this.queue.pending)}),this.queue.on("error",n=>{Ye.error("error in dial queue",n),this.pendingDialCount?.update(this.queue.size),this.inProgressDialCount?.update(this.queue.pending)}),this.queue.on("empty",()=>{this.pendingDialCount?.update(this.queue.size),this.inProgressDialCount?.update(this.queue.pending)}),this.queue.on("idle",()=>{this.pendingDialCount?.update(this.queue.size),this.inProgressDialCount?.update(this.queue.pending)})}stop(){this.shutDownController.abort()}async dial(e,r={}){let{peerId:n,multiaddrs:i}=ea(e),s=i.map(l=>({multiaddr:l,isCertified:!1})),o=this.createDialAbortControllers(r.signal),a;try{a=await this.calculateMultiaddrs(n,s,{...r,signal:o})}catch(l){throw o.clear(),l}let c=this.pendingDials.find(l=>!!(l.peerId!=null&&n!=null&&l.peerId.equals(n)||a.map(({multiaddr:f})=>f.toString()).join()===l.multiaddrs.map(f=>f.toString()).join()));if(c!=null)return Ye("joining existing dial target for %p",n),o.clear(),c.promise;Ye("creating dial target for",a.map(({multiaddr:l})=>l.toString()));let u={id:Zb(),status:"queued",peerId:n,multiaddrs:a.map(({multiaddr:l})=>l)};return u.promise=this.performDial(u,{...r,signal:o}).finally(()=>{this.pendingDials=this.pendingDials.filter(l=>l.id!==u.id),o.clear()}).catch(l=>{throw Ye.error("dial failed to %s",u.multiaddrs.map(f=>f.toString()).join(", "),l),o.aborted?new E(l.message,N.ERR_TIMEOUT):l}),this.pendingDials.push(u),u.promise}createDialAbortControllers(e){let r=yi([AbortSignal.timeout(this.dialTimeout),this.shutDownController.signal,e]);try{(0,Pl.setMaxListeners)?.(1/0,r)}catch{}return r}async calculateMultiaddrs(e,r=[],n={}){if(e!=null){if(this.peerId.equals(e))throw new E("Tried to dial self",N.ERR_DIALED_SELF);if(await this.connectionGater.denyDialPeer?.(e)===!0)throw new E("The dial request is blocked by gater.allowDialPeer",N.ERR_PEER_DIAL_INTERCEPTED);if(r.length===0){Ye("loading multiaddrs for %p",e);try{let l=await this.peerStore.get(e);r.push(...l.addresses),Ye("loaded multiaddrs for %p",e,r.map(({multiaddr:f})=>f.toString()))}catch(l){if(l.code!==N.ERR_NOT_FOUND)throw l}}}let i=(await Promise.all(r.map(async l=>{let f=await Bl(l.multiaddr,n);return f.length===1&&f[0].equals(l.multiaddr)?l:f.map(h=>({multiaddr:h,isCertified:!1}))}))).flat(),s=i.filter(l=>!!this.transportManager.transportForMultiaddr(l.multiaddr)),o=new Map;for(let l of s){let f=l.multiaddr.toString(),h=o.get(f);if(h!=null){h.isCertified=h.isCertified||l.isCertified||!1;continue}o.set(f,l)}let a=[...o.values()];if((a.length===0||a.length>this.maxPeerAddrsToDial)&&(Ye("addresses for %p before filtering",e??"unknown peer",i.map(({multiaddr:l})=>l.toString())),Ye("addresses for %p after filtering",e??"unknown peer",a.map(({multiaddr:l})=>l.toString()))),a.length===0)throw new E("The dial request has no valid addresses",N.ERR_NO_VALID_ADDRESSES);if(a.length>this.maxPeerAddrsToDial)throw new E("dial with more addresses than allowed",N.ERR_TOO_MANY_ADDRESSES);if(e!=null){let l=`/p2p/${e.toString()}`;a=a.map(f=>{let h=f.multiaddr.getPeerId();return f.multiaddr.protos().pop()?.path===!0?f:h!==e.toString()?{multiaddr:f.multiaddr.encapsulate(l),isCertified:f.isCertified}:f})}let c=[];for(let l of a)this.connectionGater.denyDialMultiaddr!=null&&await this.connectionGater.denyDialMultiaddr(l.multiaddr)||c.push(l);let u=c.sort(this.addressSorter);if(u.length===0)throw new E("The connection gater denied all addresses in the dial request",N.ERR_NO_VALID_ADDRESSES);return u}async performDial(e,r={}){let n=e.multiaddrs.map(()=>new AbortController);try{let i=new Dt({concurrency:this.maxParallelDialsPerPeer});i.on("error",o=>{Ye.error("error dialling",o)});let s=await Promise.any(e.multiaddrs.map(async(o,a)=>{let c=n[a];if(c==null)throw new E("dialAction did not come with an AbortController",N.ERR_INVALID_PARAMETERS);let u=Dy(c.signal,r.signal);u.addEventListener("abort",()=>{Ye("dial to %s aborted",o)});let l=hs();return await i.add(async()=>{if(u.aborted){Ye("dial to %s was aborted before reaching the head of the peer dial queue",o),l.reject(new xr);return}await this.queue.add(async()=>{try{if(u.aborted){Ye("dial to %s was aborted before reaching the head of the dial queue",o),l.reject(new xr);return}e.status="active";let f=await this.transportManager.dial(o,{...r,signal:u});if(c.signal.aborted){Ye("multiple dials succeeded, closing superfluous connection"),f.close().catch(h=>{Ye.error("error closing superfluous connection",h)}),l.reject(new xr);return}n[a]=void 0,n.forEach(h=>{h!==void 0&&h.abort()}),Ye("dial to %s succeeded",o),l.resolve(f)}catch(f){Ye.error("error during dial of %s",o,f),l.reject(f)}},{...r,signal:u}).catch(f=>{l.reject(f)})},{signal:u}).catch(f=>{l.reject(f)}).finally(()=>{u.clear()}),l.promise}));if(s==null)throw new E("successful dial led to empty object returned from peer dial queue",N.ERR_TRANSPORT_DIAL_FAILED);return e.status="success",s}catch(i){throw e.status="error",e.multiaddrs.length===1&&i.name==="AggregateError"?i.errors[0]:i}}};function Zb(){return`${parseInt(String(Math.random()*1e9),10).toString()}${Date.now()}`}var pt=G("libp2p:connection-manager"),e_=50,gi={minConnections:50,maxConnections:300,inboundConnectionThreshold:5,maxIncomingPendingConnections:10,autoDialConcurrency:25,autoDialPriority:0},sa=class{started;connections;allow;deny;maxIncomingPendingConnections;incomingPendingConnections;maxConnections;dialQueue;autoDial;connectionPruner;inboundConnectionRateLimiter;peerStore;metrics;events;constructor(e,r={}){this.maxConnections=r.maxConnections??gi.maxConnections;let n=r.minConnections??gi.minConnections;if(this.maxConnections<n)throw new E("Connection Manager maxConnections must be greater than minConnections",N.ERR_INVALID_PARAMETERS);this.connections=new lr,this.started=!1,this.peerStore=e.peerStore,this.metrics=e.metrics,this.events=e.events,this.onConnect=this.onConnect.bind(this),this.onDisconnect=this.onDisconnect.bind(this),this.events.addEventListener("connection:open",this.onConnect),this.events.addEventListener("connection:close",this.onDisconnect),this.allow=(r.allow??[]).map(i=>Ne(i)),this.deny=(r.deny??[]).map(i=>Ne(i)),this.incomingPendingConnections=0,this.maxIncomingPendingConnections=r.maxIncomingPendingConnections??gi.maxIncomingPendingConnections,this.inboundConnectionRateLimiter=new Ny.RateLimiterMemory({points:r.inboundConnectionThreshold??gi.inboundConnectionThreshold,duration:1}),this.autoDial=new ra({connectionManager:this,peerStore:e.peerStore,events:e.events},{minConnections:n,autoDialConcurrency:r.autoDialConcurrency??gi.autoDialConcurrency,autoDialPriority:r.autoDialPriority??gi.autoDialPriority}),this.connectionPruner=new na({connectionManager:this,peerStore:e.peerStore,events:e.events},{maxConnections:this.maxConnections,allow:this.allow}),this.dialQueue=new ia({peerId:e.peerId,metrics:e.metrics,peerStore:e.peerStore,transportManager:e.transportManager,connectionGater:e.connectionGater},{addressSorter:r.addressSorter??ui,maxParallelDials:r.maxParallelDials??100,maxPeerAddrsToDial:r.maxPeerAddrsToDial??25,dialTimeout:r.dialTimeout??3e4,resolvers:r.resolvers??{dnsaddr:li}})}isStarted(){return this.started}async start(){this.metrics?.registerMetricGroup("libp2p_connection_manager_connections",{calculate:()=>{let e={inbound:0,outbound:0};for(let r of this.connections.values())for(let n of r)n.stat.direction==="inbound"?e.inbound++:e.outbound++;return e}}),this.metrics?.registerMetricGroup("libp2p_protocol_streams_total",{label:"protocol",calculate:()=>{let e={};for(let r of this.connections.values())for(let n of r)for(let i of n.streams){let s=`${i.stat.direction} ${i.stat.protocol??"unnegotiated"}`;e[s]=(e[s]??0)+1}return e}}),this.metrics?.registerMetricGroup("libp2p_connection_manager_protocol_streams_per_connection_90th_percentile",{label:"protocol",calculate:()=>{let e={};for(let n of this.connections.values())for(let i of n){let s={};for(let o of i.streams){let a=`${o.stat.direction} ${o.stat.protocol??"unnegotiated"}`;s[a]=(s[a]??0)+1}for(let[o,a]of Object.entries(s))e[o]=e[o]??[],e[o].push(a)}let r={};for(let[n,i]of Object.entries(e)){i=i.sort((o,a)=>o-a);let s=Math.floor(i.length*.9);r[n]=i[s]}return r}}),this.autoDial.start(),this.started=!0,pt("started")}async afterStart(){Promise.resolve().then(async()=>{let e=[];for(let r of await this.peerStore.all())r.tags.has(km)&&e.push(r.id);await Promise.all(e.map(async r=>{await this.openConnection(r).catch(n=>{pt.error(n)})}))}).catch(e=>{pt.error(e)}),this.autoDial.afterStart()}async stop(){this.dialQueue.stop(),this.autoDial.stop();let e=[];for(let r of this.connections.values())for(let n of r)e.push((async()=>{try{await n.close()}catch(i){pt.error(i)}})());pt("closing %d connections",e.length),await Promise.all(e),this.connections.clear(),pt("stopped")}onConnect(e){this._onConnect(e).catch(r=>{pt.error(r)})}async _onConnect(e){let{detail:r}=e;if(!this.started){await r.close();return}let n=r.remotePeer,i=this.connections.get(n),s=!1;i!=null?i.push(r):(s=!0,this.connections.set(n,[r])),n.publicKey!=null&&n.type==="RSA"&&await this.peerStore.patch(n,{publicKey:n.publicKey}),s&&this.events.safeDispatchEvent("peer:connect",{detail:r.remotePeer})}onDisconnect(e){let{detail:r}=e;if(!this.started)return;let n=r.remotePeer,i=this.connections.get(n);i!=null&&i.length>1?(i=i.filter(s=>s.id!==r.id),this.connections.set(n,i)):i!=null&&(this.connections.delete(n),this.events.safeDispatchEvent("peer:disconnect",{detail:r.remotePeer}))}getConnections(e){if(e!=null)return this.connections.get(e)??[];let r=[];for(let n of this.connections.values())r=r.concat(n);return r}getConnectionsMap(){return this.connections}async openConnection(e,r={}){if(!this.isStarted())throw new E("Not started",N.ERR_NODE_NOT_STARTED);let{peerId:n}=ea(e);if(n!=null){pt("dial %p",n);let a=this.getConnections(n);if(a.length>0)return pt("had an existing connection to %p",n),a[0]}let i=await this.dialQueue.dial(e,{...r,priority:r.priority??e_}),s=this.connections.get(i.remotePeer);s==null&&(s=[],this.connections.set(i.remotePeer,s));let o=!1;for(let a of s)a.id===i.id&&(o=!0);return o||s.push(i),i}async closeConnections(e){let r=this.connections.get(e)??[];await Promise.all(r.map(async n=>{await n.close()}))}async acceptIncomingConnection(e){if(this.deny.some(i=>e.remoteAddr.toString().startsWith(i.toString())))return pt("connection from %s refused - connection remote address was in deny list",e.remoteAddr),!1;if(this.allow.some(i=>e.remoteAddr.toString().startsWith(i.toString())))return this.incomingPendingConnections++,!0;if(this.incomingPendingConnections===this.maxIncomingPendingConnections)return pt("connection from %s refused - incomingPendingConnections exceeded by peer %s",e.remoteAddr),!1;if(e.remoteAddr.isThinWaistAddress()){let i=e.remoteAddr.nodeAddress().address;try{await this.inboundConnectionRateLimiter.consume(i,1)}catch{return pt("connection from %s refused - inboundConnectionThreshold exceeded by host %s",i,e.remoteAddr),!1}}return this.getConnections().length<this.maxConnections?(this.incomingPendingConnections++,!0):(pt("connection from %s refused - maxConnections exceeded",e.remoteAddr),!1)}afterUpgradeInbound(){this.incomingPendingConnections--}getDialQueue(){return this.dialQueue.pendingDials}};var oa=class{constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},xi=class{constructor(e={}){this.hwm=e.splitLimit??16,this.head=new oa(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new oa(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};function xn(t={}){return t_(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function t_(t,e){e=e??{};let r=e.onEnd,n=new xi,i,s,o,a=async()=>n.isEmpty()?o?{done:!0}:await new Promise((m,y)=>{s=g=>{s=null,n.push(g);try{m(t(n))}catch(w){y(w)}return i}}):t(n),c=m=>s!=null?s(m):(n.push(m),i),u=m=>(n=new xi,s!=null?s({error:m}):(n.push({error:m}),i)),l=m=>{if(o)return i;if(e?.objectMode!==!0&&m?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return c({done:!1,value:m})},f=m=>o?i:(o=!0,m!=null?u(m):c({done:!0})),h=()=>(n=new xi,f(),{done:!0}),d=m=>(f(m),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:a,return:h,throw:d,push:l,end:f,get readableLength(){return n.size}},r==null)return i;let p=i;return i={[Symbol.asyncIterator](){return this},next(){return p.next()},throw(m){return p.throw(m),r!=null&&(r(m),r=void 0),{done:!0}},return(){return p.return(),r!=null&&(r(),r=void 0),{done:!0}},push:l,end(m){return p.end(m),r!=null&&(r(m),r=void 0),i},get readableLength(){return p.readableLength}},i}function r_(t){return t[Symbol.asyncIterator]!=null}function n_(...t){let e=[];for(let r of t)r_(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=xn({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(t.map(async n=>{for await(let i of n)r.push(i)})),r.end()}catch(n){r.end(n)}}),yield*r}()}var Vr=n_;function wn(t,...e){if(t==null)throw new Error("Empty pipeline");if(kl(t)){let n=t;t=()=>n.source}else if(Oy(t)||ky(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&kl(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let n=1;n<r.length-1;n++)kl(r[n])&&(r[n]=s_(r[n]));return i_(...r)}var i_=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},ky=t=>t?.[Symbol.asyncIterator]!=null,Oy=t=>t?.[Symbol.iterator]!=null,kl=t=>t==null?!1:t.sink!=null&&t.source!=null,s_=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=xn({objectMode:!0});r.then(()=>{n.end()},o=>{n.end(o)});let i,s=t.source;if(ky(s))i=async function*(){yield*s,n.end()};else if(Oy(s))i=function*(){yield*s,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Vr(n,i())}return t.source};function o_(t){return t[Symbol.asyncIterator]!=null}function a_(t,e){if(o_(t))return async function*(){for await(let a of t)yield e(a)}();let r=Ho(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let s=e(n);if(typeof s.then=="function")return async function*(){yield await s;for await(let a of r)yield e(a)}();let o=e;return function*(){yield s;for(let a of r)yield o(a)}()}var My=a_;async function*ps(t,e){yield*My(t,async r=>(await e.merge(r.id,{multiaddrs:r.multiaddrs}),r))}function aa(t){let e=new Set;return Nt(t,r=>e.has(r.id.toString())?!1:(e.add(r.id.toString()),!0))}async function*ca(t,e=1){let r=0;for await(let n of t)r++,yield n;if(r<e)throw new E(`more peers required, seen: ${r} min: ${e}`,"NOT_FOUND")}var ua=class{routers;started;components;constructor(e,r){this.routers=r.routers??[],this.started=!1,this.components=e}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1}async*findProviders(e,r={}){if(this.routers.length===0)throw new E("No content routers available",N.ERR_NO_ROUTERS_AVAILABLE);yield*wn(Vr(...this.routers.map(n=>n.findProviders(e,r))),n=>ps(n,this.components.peerStore),n=>aa(n),n=>ca(n))}async provide(e,r={}){if(this.routers.length===0)throw new E("No content routers available",N.ERR_NO_ROUTERS_AVAILABLE);await Promise.all(this.routers.map(async n=>{await n.provide(e,r)}))}async put(e,r,n){if(!this.isStarted())throw new E(Zt.NOT_STARTED_YET,N.DHT_NOT_STARTED);await Promise.all(this.routers.map(async i=>{await i.put(e,r,n)}))}async get(e,r){if(!this.isStarted())throw new E(Zt.NOT_STARTED_YET,N.DHT_NOT_STARTED);return Promise.any(this.routers.map(async n=>n.get(e,r)))}};function c_(t){return t[Symbol.asyncIterator]!=null}function u_(t){if(c_(t))return(async()=>{for await(let e of t)return e})();for(let e of t)return e}var la=u_;var l_=G("libp2p:peer-routing"),fa=class{components;routers;constructor(e,r){this.components=e,this.routers=r.routers??[]}async findPeer(e,r){if(this.routers.length===0)throw new E("No peer routers available",N.ERR_NO_ROUTERS_AVAILABLE);if(e.toString()===this.components.peerId.toString())throw new E("Should not try to find self",N.ERR_FIND_SELF);let n=await wn(Vr(...this.routers.map(i=>async function*(){try{yield await i.findPeer(e,r)}catch(s){l_.error(s)}}())),i=>Nt(i,Boolean),i=>ps(i,this.components.peerStore),async i=>la(i));if(n!=null)return n;throw new E(Zt.NOT_FOUND,N.ERR_NOT_FOUND)}async*getClosestPeers(e,r){if(this.routers.length===0)throw new E("No peer routers available",N.ERR_NO_ROUTERS_AVAILABLE);yield*wn(Vr(...this.routers.map(n=>n.getClosestPeers(e,r))),n=>ps(n,this.components.peerStore),n=>aa(n),n=>ca(n))}};var f_=Symbol.for("@libp2p/topology");function Fy(t){return t!=null&&!!t[f_]}var Ol=G("libp2p:registrar"),Ml=32,Fl=64,ha=class{topologies;handlers;components;constructor(e){this.topologies=new Map,this.handlers=new Map,this.components=e,this._onDisconnect=this._onDisconnect.bind(this),this._onPeerUpdate=this._onPeerUpdate.bind(this),this._onConnect=this._onConnect.bind(this),this.components.events.addEventListener("connection:close",this._onDisconnect),this.components.events.addEventListener("connection:open",this._onConnect),this.components.events.addEventListener("peer:update",this._onPeerUpdate)}getProtocols(){return Array.from(new Set([...this.handlers.keys()])).sort()}getHandler(e){let r=this.handlers.get(e);if(r==null)throw new E(`No handler registered for protocol ${e}`,N.ERR_NO_HANDLER_FOR_PROTOCOL);return r}getTopologies(e){let r=this.topologies.get(e);return r==null?[]:[...r.values()]}async handle(e,r,n){if(this.handlers.has(e))throw new E(`Handler already registered for protocol ${e}`,N.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);let i=Lr.bind({ignoreUndefined:!0})({maxInboundStreams:Ml,maxOutboundStreams:Fl},n);this.handlers.set(e,{handler:r,options:i}),await this.components.peerStore.merge(this.components.peerId,{protocols:[e]})}async unhandle(e){let r=Array.isArray(e)?e:[e];r.forEach(n=>{this.handlers.delete(n)}),await this.components.peerStore.patch(this.components.peerId,{protocols:r})}async register(e,r){if(!Fy(r))throw Ol.error("topology must be an instance of interfaces/topology"),new E("topology must be an instance of interfaces/topology",N.ERR_INVALID_PARAMETERS);let n=`${(Math.random()*1e9).toString(36)}${Date.now()}`,i=this.topologies.get(e);return i==null&&(i=new Map,this.topologies.set(e,i)),i.set(n,r),await r.setRegistrar(this),n}unregister(e){for(let[r,n]of this.topologies.entries())n.has(e)&&(n.delete(e),n.size===0&&this.topologies.delete(r))}_onDisconnect(e){let r=e.detail;this.components.peerStore.get(r.remotePeer).then(n=>{for(let i of n.protocols){let s=this.topologies.get(i);if(s!=null)for(let o of s.values())o.onDisconnect(r.remotePeer)}}).catch(n=>{Ol.error("could not inform topologies of disconnecting peer %p",r.remotePeer,n)})}_onConnect(e){let r=e.detail;this.components.peerStore.get(r.remotePeer).then(n=>{for(let i of n.protocols){let s=this.topologies.get(i);if(s!=null)for(let o of s.values())o.onConnect(r.remotePeer,r)}}).catch(n=>{Ol.error("could not inform topologies of connecting peer %p",r.remotePeer,n)})}_onPeerUpdate(e){let{peer:r,previous:n}=e.detail,i=(n?.protocols??[]).filter(o=>!r.protocols.includes(o)),s=r.protocols.filter(o=>!(n?.protocols??[]).includes(o));for(let o of i){let a=this.topologies.get(o);if(a!=null)for(let c of a.values())c.onDisconnect(r.id)}for(let o of s){let a=this.topologies.get(o);if(a!=null)for(let c of a.values()){let u=this.components.connectionManager.getConnections(r.id)[0];u!=null&&c.onConnect(r.id,u)}}}};var Ul=class extends Map{constructor(e){super();let{name:r,metrics:n}=e;this.metric=n.registerMetric(r),this.updateComponentMetric()}set(e,r){return super.set(e,r),this.updateComponentMetric(),this}delete(e){let r=super.delete(e);return this.updateComponentMetric(),r}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function Uy(t){let{name:e,metrics:r}=t,n;return r!=null?n=new Ul({name:e,metrics:r}):n=new Map,n}var vn=G("libp2p:transports"),da=class{components;transports;listeners;faultTolerance;started;constructor(e,r={}){this.components=e,this.started=!1,this.transports=new Map,this.listeners=Uy({name:"libp2p_transport_manager_listeners",metrics:this.components.metrics}),this.faultTolerance=r.faultTolerance??Ur.FATAL_ALL}add(e){let r=e[Symbol.toStringTag];if(r==null)throw new E("Transport must have a valid tag",N.ERR_INVALID_KEY);if(this.transports.has(r))throw new E(`There is already a transport with the tag ${r}`,N.ERR_DUPLICATE_TRANSPORT);vn("adding transport %s",r),this.transports.set(r,e),this.listeners.has(r)||this.listeners.set(r,[])}isStarted(){return this.started}start(){this.started=!0}async afterStart(){let e=this.components.addressManager.getListenAddrs();await this.listen(e)}async stop(){let e=[];for(let[r,n]of this.listeners)for(vn("closing listeners for %s",r);n.length>0;){let i=n.pop();i!=null&&e.push(i.close())}await Promise.all(e),vn("all listeners closed");for(let r of this.listeners.keys())this.listeners.set(r,[]);this.started=!1}async dial(e,r){let n=this.transportForMultiaddr(e);if(n==null)throw new E(`No transport available for address ${String(e)}`,N.ERR_TRANSPORT_UNAVAILABLE);try{return await n.dial(e,{...r,upgrader:this.components.upgrader})}catch(i){throw i.code==null&&(i.code=N.ERR_TRANSPORT_DIAL_FAILED),i}}getAddrs(){let e=[];for(let r of this.listeners.values())for(let n of r)e=[...e,...n.getAddrs()];return e}getTransports(){return Array.of(...this.transports.values())}getListeners(){return Array.of(...this.listeners.values()).flat()}transportForMultiaddr(e){for(let r of this.transports.values())if(r.filter([e]).length>0)return r}async listen(e){if(e==null||e.length===0){vn("no addresses were provided for listening, this node is dial only");return}let r=[];for(let[n,i]of this.transports.entries()){let s=i.filter(e),o=[];for(let u of s){vn("creating listener for %s on %s",n,u);let l=i.createListener({upgrader:this.components.upgrader}),f=this.listeners.get(n)??[];f==null&&(f=[],this.listeners.set(n,f)),f.push(l),l.addEventListener("listening",()=>{this.components.events.safeDispatchEvent("transport:listening",{detail:l})}),l.addEventListener("close",()=>{let h=f.findIndex(d=>d===l);f.splice(h,1),this.components.events.safeDispatchEvent("transport:close",{detail:l})}),o.push(l.listen(u))}if(o.length===0){r.push(n);continue}if((await Promise.allSettled(o)).find(u=>u.status==="fulfilled")==null&&this.faultTolerance!==Ur.NO_FATAL)throw new E(`Transport (${n}) could not listen on any available address`,N.ERR_NO_VALID_ADDRESSES)}if(r.length===this.transports.size){let n=`no valid addresses were provided for transports [${r.join(", ")}]`;if(this.faultTolerance===Ur.FATAL_ALL)throw new E(n,N.ERR_NO_VALID_ADDRESSES);vn(`libp2p in dial mode only: ${n}`)}}async remove(e){vn("removing %s",e);for(let r of this.listeners.get(e)??[])await r.close();this.transports.delete(e),this.listeners.delete(e)}async removeAll(){let e=[];for(let r of this.transports.keys())e.push(this.remove(r));await Promise.all(e)}};var zl=V(bi(),1);var dr="/multistream/1.0.0";function pa(t){return t[Symbol.asyncIterator]!=null}var ma=t=>{let e=Pt.encodingLength(t),r=St(e);return Pt.encode(t,r),ma.bytes=e,r};ma.bytes=0;function ya(t,e){e=e??{};let r=e.lengthEncoder??ma;function*n(i){let s=r(i.byteLength);s instanceof Uint8Array?yield s:yield*s,i instanceof Uint8Array?yield i:yield*i}return pa(t)?async function*(){for await(let i of t)yield*n(i)}():function*(){for(let i of t)yield*n(i)}()}ya.single=(t,e)=>{e=e??{};let r=e.lengthEncoder??ma;return new Ae(r(t.byteLength),t)};var wi=V(nl(),1);var h_=8,d_=1024*1024*4,En;(function(t){t[t.LENGTH=0]="LENGTH",t[t.DATA=1]="DATA"})(En||(En={}));var Kl=t=>{let e=Pt.decode(t);return Kl.bytes=Pt.encodingLength(e),e};Kl.bytes=0;function ms(t,e){let r=new Ae,n=En.LENGTH,i=-1,s=e?.lengthDecoder??Kl,o=e?.maxLengthLength??h_,a=e?.maxDataLength??d_;function*c(){for(;r.byteLength>0;){if(n===En.LENGTH)try{if(i=s(r),i<0)throw(0,wi.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>a)throw(0,wi.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let u=s.bytes;r.consume(u),e?.onLength!=null&&e.onLength(i),n=En.DATA}catch(u){if(u instanceof RangeError){if(r.byteLength>o)throw(0,wi.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw u}if(n===En.DATA){if(r.byteLength<i)break;let u=r.sublist(0,i);r.consume(i),e?.onData!=null&&e.onData(u),yield u,n=En.LENGTH}}}return pa(t)?async function*(){for await(let u of t)r.append(u),yield*c();if(r.byteLength>0)throw(0,wi.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let u of t)r.append(u),yield*c();if(r.byteLength>0)throw(0,wi.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}ms.fromReader=(t,e)=>{let r=1,n=async function*(){for(;;)try{let{done:s,value:o}=await t.next(r);if(s===!0)return;o!=null&&(yield o)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{r=1}}();return ms(n,{...e??{},onLength:s=>{r=s}})};var ys=class extends Error{constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function Ky(t){if(t!=null){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}function ga(t,e,r){let n=r??{},i=Ky(t);async function*s(){let o,a=()=>{o?.()};for(e.addEventListener("abort",a);;){let c;try{if(e.aborted){let{abortMessage:l,abortCode:f}=n;throw new ys(l,f)}let u=new Promise((l,f)=>{o=()=>{let{abortMessage:h,abortCode:d}=n;f(new ys(h,d))}});c=await Promise.race([u,i.next()]),o=null}catch(u){e.removeEventListener("abort",a);let l=u.type==="aborted"&&e.aborted;if(l&&n.onAbort!=null&&n.onAbort(t),typeof i.return=="function")try{let f=i.return();f instanceof Promise&&f.catch(h=>{n.onReturnError!=null&&n.onReturnError(h)})}catch(f){n.onReturnError!=null&&n.onReturnError(f)}if(l&&n.returnOnAbort===!0)return;throw u}if(c.done===!0)break;yield c.value}e.removeEventListener("abort",a)}return s()}function m_(t,e,r){return n=>t(ga(n,e,r))}function Vy(t,e,r){return{sink:m_(t.sink,e,{...r,onAbort:void 0}),source:ga(t.source,e,r)}}var g_=G("libp2p:mss"),qy=U(`
|
|
49
|
-
`);function gs(t){let e=new Ae(t,qy);return ya.single(e)}function bn(t,e,r={}){let n=gs(e);r.writeBytes===!0?t.push(n.subarray()):t.push(n)}function $y(t,e,r={}){let n=new Ae;for(let i of e)n.append(gs(i));r.writeBytes===!0?t.push(n.subarray()):t.push(n)}async function x_(t,e){let r=1,n={[Symbol.asyncIterator]:()=>n,next:async()=>await t.next(r)},i=n;e?.signal!=null&&(i=ga(n,e.signal));let s=a=>{r=a},o=await wn(i,a=>ms(a,{onLength:s,maxDataLength:1024}),async a=>await la(a));if(o==null||o.length===0)throw new E("no buffer returned","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");if(o.get(o.byteLength-1)!==qy[0])throw g_.error("Invalid mss message - missing newline - %s",o.subarray()),new E("missing newline","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return o.sublist(0,-1)}async function vi(t,e){let r=await x_(t,e);return $(r.subarray())}function Vl(t){let e=async function*(){let r=yield,n=new Ae;for await(let i of t){if(r==null){n.append(i),r=yield n,n=new Ae;continue}for(n.append(i);n.length>=r;){let s=n.sublist(0,r);if(n.consume(r),r=yield s,r==null){n.length>0&&(r=yield n,n=new Ae);break}}}if(r!=null)throw Object.assign(new Error(`stream ended before ${r} bytes became available`),{code:"ERR_UNDER_READ",buffer:n})}();return e.next(),e}function xa(t){let e=xn(),r=Vl(t.source),n=hs(),i,s=t.sink(async function*(){yield*e,yield*await n.promise}());return s.catch(a=>{i=a}),{reader:r,writer:e,stream:{sink:async a=>{if(i!=null){await Promise.reject(i);return}n.resolve(a),await s},source:r},rest:()=>e.end(),write:e.push,read:async()=>{let a=await r.next();if(a.value!=null)return a.value}}}var xs=G("libp2p:mss:select");async function ws(t,e,r={}){e=Array.isArray(e)?[...e]:[e];let{reader:n,writer:i,rest:s,stream:o}=xa(t),a=e.shift();if(a==null)throw new Error("At least one protocol must be specified");xs.trace('select: write ["%s", "%s"]',dr,a);let c=U(dr),u=U(a);$y(i,[c,u],r);let l=await vi(n,r);if(xs.trace('select: read "%s"',l),l===dr&&(l=await vi(n,r),xs.trace('select: read "%s"',l)),l===a)return s(),{stream:o,protocol:a};for(let f of e){xs.trace('select: write "%s"',f),bn(i,U(f),r);let h=await vi(n,r);if(xs.trace('select: read "%s" for "%s"',h,f),h===f)return s(),{stream:o,protocol:f}}throw s(),new E("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}var vs=G("libp2p:mss:handle");async function Es(t,e,r){e=Array.isArray(e)?e:[e];let{writer:n,reader:i,rest:s,stream:o}=xa(t);for(;;){let a=await vi(i,r);if(vs.trace('read "%s"',a),a===dr){vs.trace('respond with "%s" for "%s"',dr,a),bn(n,U(dr),r);continue}if(e.includes(a))return bn(n,U(a),r),vs.trace('respond with "%s" for "%s"',a,a),s(),{stream:o,protocol:a};if(a==="ls"){bn(n,new Ae(...e.map(c=>gs(U(c)))),r),vs.trace('respond with "%s" for %s',e,a);continue}bn(n,U("na"),r),vs('respond with "na" for "%s"',a)}}var Hy=Symbol.for("@libp2p/connection");var Gy="OPEN",ql="CLOSING",wa="CLOSED";var v_=G("libp2p:connection"),$l=class{id;remoteAddr;remotePeer;stat;tags;_newStream;_close;_getStreams;_closing;constructor(e){let{remoteAddr:r,remotePeer:n,newStream:i,close:s,getStreams:o,stat:a}=e;this.id=`${parseInt(String(Math.random()*1e9)).toString(36)}${Date.now()}`,this.remoteAddr=r,this.remotePeer=n,this.stat={...a,status:Gy},this._newStream=i,this._close=s,this._getStreams=o,this.tags=[],this._closing=!1}[Symbol.toStringTag]="Connection";[Hy]=!0;get streams(){return this._getStreams()}async newStream(e,r){if(this.stat.status===ql)throw new E("the connection is being closed","ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===wa)throw new E("the connection is closed","ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);let n=await this._newStream(e,r);return n.stat.direction="outbound",n}addStream(e){e.stat.direction="inbound"}removeStream(e){}async close(){if(!(this.stat.status===wa||this._closing)){this.stat.status=ql;try{this.streams.forEach(e=>{e.close()})}catch(e){v_.error(e)}this._closing=!0,await this._close(),this._closing=!1,this.stat.timeline.close=Date.now(),this.stat.status=wa}}};function Yy(t){return new $l(t)}var we=G("libp2p:upgrader");function b_(t,e){try{let{options:r}=e.getHandler(t);return r.maxInboundStreams}catch(r){if(r.code!==N.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return Ml}function __(t,e){try{let{options:r}=e.getHandler(t);return r.maxOutboundStreams}catch(r){if(r.code!==N.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return Fl}function Wy(t,e,r){let n=0;return r.streams.forEach(i=>{i.stat.direction===e&&i.stat.protocol===t&&n++}),n}var va=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 E(`The multiaddr connection is blocked by gater.${n}`,N.ERR_CONNECTION_INTERCEPTED)}async upgradeInbound(e,r){if(!await this.components.connectionManager.acceptIncomingConnection(e))throw new E("connection denied",N.ERR_CONNECTION_DENIED);let i,s,o,a,c,u=yi([AbortSignal.timeout(this.inboundUpgradeTimeout)]);try{(0,zl.setMaxListeners)?.(1/0,u)}catch{}try{let l=Vy(e,u);if(e.source=l.source,e.sink=l.sink,await this.components.connectionGater.denyInboundConnection?.(e)===!0)throw new E("The multiaddr connection is blocked by gater.acceptConnection",N.ERR_CONNECTION_INTERCEPTED);this.components.metrics?.trackMultiaddrConnection(e),we("starting the inbound connection upgrade");let f=e;if(r?.skipProtection!==!0){let h=this.components.connectionProtector;h!=null&&(we("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 E("inbound connection that skipped encryption must have a peer id",N.ERR_INVALID_MULTIADDR);let d=ie(h);c="native",s=d}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 we.error("Failed to upgrade inbound connection",h),h}return await this.shouldBlockConnection(s,e,"denyInboundUpgradedConnection"),we("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:c,direction:"inbound",maConn:e,upgradedConn:o,muxerFactory:a,remotePeer:s})}finally{this.components.connectionManager.afterUpgradeInbound(),u.clear()}}async upgradeOutbound(e,r){let n=e.remoteAddr.getPeerId(),i;n!=null&&(i=ie(n),await this.shouldBlockConnection(i,e,"denyOutboundConnection"));let s,o,a,c,u;this.components.metrics?.trackMultiaddrConnection(e),we("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 E("Encryption was skipped but no peer id was passed",N.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 we.error("Failed to upgrade outbound connection",f),await e.close(f),f}return await this.shouldBlockConnection(o,e,"denyOutboundUpgradedConnection"),we("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:c,direction:"outbound",maConn:e,upgradedConn:a,muxerFactory:u,remotePeer:o})}_createConnection(e){let{cryptoProtocol:r,direction:n,maConn:i,upgradedConn:s,remotePeer:o,muxerFactory:a}=e,c,u,l;a!=null&&(c=a.createStreamMuxer({direction:n,onIncomingStream:d=>{l!=null&&Promise.resolve().then(async()=>{let p=this.components.registrar.getProtocols(),{stream:m,protocol:y}=await Es(d,p);if(we("%s: incoming stream opened on %s",n,y),l==null)return;let g=b_(y,this.components.registrar);if(Wy(y,"inbound",l)===g){let _=new E(`Too many inbound protocol streams for protocol "${y}" - limit ${g}`,N.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS);throw d.abort(_),_}d.source=m.source,d.sink=m.sink,d.stat.protocol=y,await this.components.peerStore.merge(o,{protocols:[y]}),l.addStream(d),this.components.metrics?.trackProtocolStream(d,l),this._onStream({connection:l,stream:d,protocol:y})}).catch(p=>{we.error(p),d.stat.timeline.close==null&&d.close()})},onStreamEnd:d=>{l?.removeStream(d.id)}}),u=async(d,p={})=>{if(c==null)throw new E("Stream is not multiplexed",N.ERR_MUXER_UNAVAILABLE);we("%s: starting new stream on %s",n,d);let m=await c.newStream();try{if(p.signal==null){we("No abort signal was passed while trying to negotiate protocols %s falling back to default timeout",d),p.signal=AbortSignal.timeout(3e4);try{(0,zl.setMaxListeners)?.(1/0,p.signal)}catch{}}let{stream:y,protocol:g}=await ws(m,d,p),w=__(g,this.components.registrar);if(Wy(g,"outbound",l)===w){let D=new E(`Too many outbound protocol streams for protocol "${g}" - limit ${w}`,N.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw m.abort(D),D}return await this.components.peerStore.merge(o,{protocols:[g]}),m.source=y.source,m.sink=y.sink,m.stat.protocol=g,this.components.metrics?.trackProtocolStream(m,l),m}catch(y){throw we.error("could not create new stream",y),m.stat.timeline.close==null&&m.close(),y.code!=null?y:new E(String(y),N.ERR_UNSUPPORTED_PROTOCOL)}},Promise.all([c.sink(s.source),s.sink(c.source)]).catch(d=>{we.error(d)}));let f=i.timeline;i.timeline=new Proxy(f,{set:(...d)=>(l!=null&&d[1]==="close"&&d[2]!=null&&f.close==null&&(async()=>{try{l.stat.status==="OPEN"&&await l.close()}catch(p){we.error(p)}finally{this.events.safeDispatchEvent("connection:close",{detail:l})}})().catch(p=>{we.error(p)}),Reflect.set(...d))}),i.timeline.upgraded=Date.now();let h=()=>{throw new E("connection is not multiplexed",N.ERR_CONNECTION_NOT_MULTIPLEXED)};return l=Yy({remoteAddr:i.remoteAddr,remotePeer:o,stat:{status:"OPEN",direction:n,timeline:i.timeline,multiplexer:c?.protocol,encryption:r},newStream:u??h,getStreams:()=>c!=null?c.streams:h(),close:async()=>{await i.close(),c?.close()}}),this.events.safeDispatchEvent("connection:open",{detail:l}),l}_onStream(e){let{connection:r,stream:n,protocol:i}=e,{handler:s}=this.components.registrar.getHandler(i);s({connection:r,stream:n})}async _encryptInbound(e){let r=Array.from(this.connectionEncryption.keys());we("handling inbound crypto protocol selection",r);try{let{stream:n,protocol:i}=await Es(e,r,{writeBytes:!0}),s=this.connectionEncryption.get(i);if(s==null)throw new Error(`no crypto module found for ${i}`);return we("encrypting inbound connection..."),{...await s.secureInbound(this.components.peerId,n),protocol:i}}catch(n){throw new E(String(n),N.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,r){let n=Array.from(this.connectionEncryption.keys());we("selecting outbound crypto protocol",n);try{let{stream:i,protocol:s}=await ws(e,n,{writeBytes:!0}),o=this.connectionEncryption.get(s);if(o==null)throw new Error(`no crypto module found for ${s}`);return we("encrypting outbound connection to %p",r),{...await o.secureOutbound(this.components.peerId,i,r),protocol:s}}catch(i){throw new E(String(i),N.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,r){let n=Array.from(r.keys());we("outbound selecting muxer %s",n);try{let{stream:i,protocol:s}=await ws(e,n,{writeBytes:!0});we("%s selected as muxer protocol",s);let o=r.get(s);return{stream:i,muxerFactory:o}}catch(i){throw we.error("error multiplexing outbound stream",i),new E(String(i),N.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,r){let n=Array.from(r.keys());we("inbound handling muxers %s",n);try{let{stream:i,protocol:s}=await Es(e,n,{writeBytes:!0}),o=r.get(s);return{stream:i,muxerFactory:o}}catch(i){throw we.error("error multiplexing inbound stream",i),new E(String(i),N.ERR_MUXER_UNAVAILABLE)}}};var nt=G("libp2p"),Hl=class extends Qi{peerId;peerStore;contentRouting;peerRouting;keychain;metrics;services;components;#e;constructor(e){super();let r=new Qi,n=r.dispatchEvent.bind(r);r.dispatchEvent=c=>{let u=n(c),l=this.dispatchEvent(new lu(c.type,{detail:c.detail}));return u||l};try{(0,Qy.setMaxListeners)?.(1/0,r)}catch{}this.#e=!1,this.peerId=e.peerId,this.services={};let i=this.components=mm({peerId:e.peerId,events:r,datastore:e.datastore??new Yo,connectionGater:Am(e.connectionGater)});this.peerStore=this.configureComponent("peerStore",new zo(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",c=>{c.detail.previous==null&&this.safeDispatchEvent("peer:discovery",{detail:c.detail.peer})}),e.connectionProtector!=null&&this.configureComponent("connectionProtector",e.connectionProtector(i)),this.components.upgrader=new va(this.components,{connectionEncryption:(e.connectionEncryption??[]).map((c,u)=>this.configureComponent(`connection-encryption-${u}`,c(this.components))),muxers:(e.streamMuxers??[]).map((c,u)=>this.configureComponent(`stream-muxers-${u}`,c(this.components))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.configureComponent("transportManager",new da(this.components,e.transportManager)),this.configureComponent("connectionManager",new sa(this.components,e.connectionManager)),this.configureComponent("registrar",new ha(this.components)),this.configureComponent("addressManager",new Wo(this.components,e.addresses));let s=dn.generateOptions();this.keychain=this.configureComponent("keyChain",new dn(this.components,{...s,...e.keychain}));let o=(e.peerRouters??[]).map((c,u)=>this.configureComponent(`peer-router-${u}`,c(this.components)));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new fa(this.components,{routers:o}));let a=(e.contentRouters??[]).map((c,u)=>this.configureComponent(`content-router-${u}`,c(this.components)));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new ua(this.components,{routers:a})),(e.peerDiscovery??[]).forEach((c,u)=>{this.configureComponent(`peer-discovery-${u}`,c(this.components)).addEventListener("peer",f=>{this.#t(f)})}),e.transports.forEach((c,u)=>{this.components.transportManager.add(this.configureComponent(`transport-${u}`,c(this.components)))}),e.services!=null)for(let c of Object.keys(e.services)){let u=e.services[c],l=u(this.components);if(l==null){nt.error("service factory %s returned null or undefined instance",c);continue}this.services[c]=l,this.configureComponent(c,l),l[ou]!=null&&(nt("registering service %s for content routing",c),a.push(l[ou])),l[cu]!=null&&(nt("registering service %s for peer routing",c),o.push(l[cu])),l[au]!=null&&(nt("registering service %s for peer discovery",c),l[au].addEventListener("peer",f=>{this.#t(f)}))}}configureComponent(e,r){return r==null&&nt.error("component %s was null or undefined",e),this.components[e]=r,r}async start(){if(this.#e)return;this.#e=!0,nt("libp2p is starting"),(await this.keychain.listKeys()).find(r=>r.name==="self")==null&&(nt("importing self key into keychain"),await this.keychain.importPeer("self",this.components.peerId));try{await this.components.beforeStart?.(),await this.components.start(),await this.components.afterStart?.(),nt("libp2p has started")}catch(r){throw nt.error("An error occurred starting libp2p",r),await this.stop(),r}}async stop(){this.#e&&(nt("libp2p is stopping"),this.#e=!1,await this.components.beforeStop?.(),await this.components.stop(),await this.components.afterStop?.(),nt("libp2p has stopped"))}isStarted(){return this.#e}getConnections(e){return this.components.connectionManager.getConnections(e)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){let e=new Bt;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 E("no protocols were provided to open a stream",N.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(r=Array.isArray(r)?r:[r],r.length===0)throw new E("no protocols were provided to open a stream",N.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){pn(e)&&(e=ie(e.getPeerId()??"")),await this.components.connectionManager.closeConnections(e)}async getPublicKey(e,r={}){if(nt("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=Ce([U("/pk/"),e.multihash.digest]),s=await this.contentRouting.get(i,r);return cn(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)}#t(e){let{detail:r}=e;if(r.id.toString()===this.peerId.toString()){nt.error(new Error(N.ERR_DISCOVERED_SELF));return}this.components.peerStore.merge(r.id,{multiaddrs:r.multiaddrs,protocols:r.protocols}).catch(n=>{nt.error(n)})}};async function Xy(t){if(t.peerId==null){let e=t.datastore;if(e!=null)try{let r=new dn({datastore:e},Lr(dn.generateOptions(),t.keychain));t.peerId=await r.exportPeerId("self")}catch(r){if(r.code!=="ERR_NOT_FOUND")throw r}}return t.peerId==null&&(t.peerId=await ap()),new Hl(Nm(t))}async function S_(t){let e=await Xy(t);return t.start!==!1&&await e.start(),e}return ng(A_);})();
|
|
49
|
+
`);function gs(t){let e=new Ae(t,qy);return ya.single(e)}function bn(t,e,r={}){let n=gs(e);r.writeBytes===!0?t.push(n.subarray()):t.push(n)}function $y(t,e,r={}){let n=new Ae;for(let i of e)n.append(gs(i));r.writeBytes===!0?t.push(n.subarray()):t.push(n)}async function x_(t,e){let r=1,n={[Symbol.asyncIterator]:()=>n,next:async()=>await t.next(r)},i=n;e?.signal!=null&&(i=ga(n,e.signal));let s=a=>{r=a},o=await wn(i,a=>ms(a,{onLength:s,maxDataLength:1024}),async a=>await la(a));if(o==null||o.length===0)throw new E("no buffer returned","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");if(o.get(o.byteLength-1)!==qy[0])throw g_.error("Invalid mss message - missing newline - %s",o.subarray()),new E("missing newline","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return o.sublist(0,-1)}async function vi(t,e){let r=await x_(t,e);return $(r.subarray())}function Vl(t){let e=async function*(){let r=yield,n=new Ae;for await(let i of t){if(r==null){n.append(i),r=yield n,n=new Ae;continue}for(n.append(i);n.length>=r;){let s=n.sublist(0,r);if(n.consume(r),r=yield s,r==null){n.length>0&&(r=yield n,n=new Ae);break}}}if(r!=null)throw Object.assign(new Error(`stream ended before ${r} bytes became available`),{code:"ERR_UNDER_READ",buffer:n})}();return e.next(),e}function xa(t){let e=xn(),r=Vl(t.source),n=hs(),i,s=t.sink(async function*(){yield*e,yield*await n.promise}());return s.catch(a=>{i=a}),{reader:r,writer:e,stream:{sink:async a=>{if(i!=null){await Promise.reject(i);return}n.resolve(a),await s},source:r},rest:()=>e.end(),write:e.push,read:async()=>{let a=await r.next();if(a.value!=null)return a.value}}}var xs=G("libp2p:mss:select");async function ws(t,e,r={}){e=Array.isArray(e)?[...e]:[e];let{reader:n,writer:i,rest:s,stream:o}=xa(t),a=e.shift();if(a==null)throw new Error("At least one protocol must be specified");xs.trace('select: write ["%s", "%s"]',dr,a);let c=U(dr),u=U(a);$y(i,[c,u],r);let l=await vi(n,r);if(xs.trace('select: read "%s"',l),l===dr&&(l=await vi(n,r),xs.trace('select: read "%s"',l)),l===a)return s(),{stream:o,protocol:a};for(let f of e){xs.trace('select: write "%s"',f),bn(i,U(f),r);let h=await vi(n,r);if(xs.trace('select: read "%s" for "%s"',h,f),h===f)return s(),{stream:o,protocol:f}}throw s(),new E("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}var vs=G("libp2p:mss:handle");async function Es(t,e,r){e=Array.isArray(e)?e:[e];let{writer:n,reader:i,rest:s,stream:o}=xa(t);for(;;){let a=await vi(i,r);if(vs.trace('read "%s"',a),a===dr){vs.trace('respond with "%s" for "%s"',dr,a),bn(n,U(dr),r);continue}if(e.includes(a))return bn(n,U(a),r),vs.trace('respond with "%s" for "%s"',a,a),s(),{stream:o,protocol:a};if(a==="ls"){bn(n,new Ae(...e.map(c=>gs(U(c)))),r),vs.trace('respond with "%s" for %s',e,a);continue}bn(n,U("na"),r),vs('respond with "na" for "%s"',a)}}var Hy=Symbol.for("@libp2p/connection");var Gy="OPEN",ql="CLOSING",wa="CLOSED";var v_=G("libp2p:connection"),$l=class{id;remoteAddr;remotePeer;stat;tags;_newStream;_close;_getStreams;_closing;constructor(e){let{remoteAddr:r,remotePeer:n,newStream:i,close:s,getStreams:o,stat:a}=e;this.id=`${parseInt(String(Math.random()*1e9)).toString(36)}${Date.now()}`,this.remoteAddr=r,this.remotePeer=n,this.stat={...a,status:Gy},this._newStream=i,this._close=s,this._getStreams=o,this.tags=[],this._closing=!1}[Symbol.toStringTag]="Connection";[Hy]=!0;get streams(){return this._getStreams()}async newStream(e,r){if(this.stat.status===ql)throw new E("the connection is being closed","ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===wa)throw new E("the connection is closed","ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);let n=await this._newStream(e,r);return n.stat.direction="outbound",n}addStream(e){e.stat.direction="inbound"}removeStream(e){}async close(){if(!(this.stat.status===wa||this._closing)){this.stat.status=ql;try{this.streams.forEach(e=>{e.close()})}catch(e){v_.error(e)}this._closing=!0,await this._close(),this._closing=!1,this.stat.timeline.close=Date.now(),this.stat.status=wa}}};function Yy(t){return new $l(t)}var we=G("libp2p:upgrader");function b_(t,e){try{let{options:r}=e.getHandler(t);return r.maxInboundStreams}catch(r){if(r.code!==N.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return Ml}function __(t,e){try{let{options:r}=e.getHandler(t);return r.maxOutboundStreams}catch(r){if(r.code!==N.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return Fl}function Wy(t,e,r){let n=0;return r.streams.forEach(i=>{i.stat.direction===e&&i.stat.protocol===t&&n++}),n}var va=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 E(`The multiaddr connection is blocked by gater.${n}`,N.ERR_CONNECTION_INTERCEPTED)}async upgradeInbound(e,r){if(!await this.components.connectionManager.acceptIncomingConnection(e))throw new E("connection denied",N.ERR_CONNECTION_DENIED);let i,s,o,a,c,u=yi([AbortSignal.timeout(this.inboundUpgradeTimeout)]);try{(0,zl.setMaxListeners)?.(1/0,u)}catch{}try{let l=Vy(e,u);if(e.source=l.source,e.sink=l.sink,await this.components.connectionGater.denyInboundConnection?.(e)===!0)throw new E("The multiaddr connection is blocked by gater.acceptConnection",N.ERR_CONNECTION_INTERCEPTED);this.components.metrics?.trackMultiaddrConnection(e),we("starting the inbound connection upgrade");let f=e;if(r?.skipProtection!==!0){let h=this.components.connectionProtector;h!=null&&(we("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 E("inbound connection that skipped encryption must have a peer id",N.ERR_INVALID_MULTIADDR);let d=ie(h);c="native",s=d}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 we.error("Failed to upgrade inbound connection",h),h}return await this.shouldBlockConnection(s,e,"denyInboundUpgradedConnection"),we("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:c,direction:"inbound",maConn:e,upgradedConn:o,muxerFactory:a,remotePeer:s})}finally{this.components.connectionManager.afterUpgradeInbound(),u.clear()}}async upgradeOutbound(e,r){let n=e.remoteAddr.getPeerId(),i;n!=null&&(i=ie(n),await this.shouldBlockConnection(i,e,"denyOutboundConnection"));let s,o,a,c,u;this.components.metrics?.trackMultiaddrConnection(e),we("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 E("Encryption was skipped but no peer id was passed",N.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 we.error("Failed to upgrade outbound connection",f),await e.close(f),f}return await this.shouldBlockConnection(o,e,"denyOutboundUpgradedConnection"),we("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:c,direction:"outbound",maConn:e,upgradedConn:a,muxerFactory:u,remotePeer:o})}_createConnection(e){let{cryptoProtocol:r,direction:n,maConn:i,upgradedConn:s,remotePeer:o,muxerFactory:a}=e,c,u,l;a!=null&&(c=a.createStreamMuxer({direction:n,onIncomingStream:d=>{l!=null&&Promise.resolve().then(async()=>{let p=this.components.registrar.getProtocols(),{stream:m,protocol:y}=await Es(d,p);if(we("%s: incoming stream opened on %s",n,y),l==null)return;let g=b_(y,this.components.registrar);if(Wy(y,"inbound",l)===g){let _=new E(`Too many inbound protocol streams for protocol "${y}" - limit ${g}`,N.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS);throw d.abort(_),_}d.source=m.source,d.sink=m.sink,d.stat.protocol=y,await this.components.peerStore.merge(o,{protocols:[y]}),l.addStream(d),this.components.metrics?.trackProtocolStream(d,l),this._onStream({connection:l,stream:d,protocol:y})}).catch(p=>{we.error(p),d.stat.timeline.close==null&&d.close()})},onStreamEnd:d=>{l?.removeStream(d.id)}}),u=async(d,p={})=>{if(c==null)throw new E("Stream is not multiplexed",N.ERR_MUXER_UNAVAILABLE);we("%s: starting new stream on %s",n,d);let m=await c.newStream();try{if(p.signal==null){we("No abort signal was passed while trying to negotiate protocols %s falling back to default timeout",d),p.signal=AbortSignal.timeout(3e4);try{(0,zl.setMaxListeners)?.(1/0,p.signal)}catch{}}let{stream:y,protocol:g}=await ws(m,d,p),w=__(g,this.components.registrar);if(Wy(g,"outbound",l)===w){let D=new E(`Too many outbound protocol streams for protocol "${g}" - limit ${w}`,N.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw m.abort(D),D}return await this.components.peerStore.merge(o,{protocols:[g]}),m.source=y.source,m.sink=y.sink,m.stat.protocol=g,this.components.metrics?.trackProtocolStream(m,l),m}catch(y){throw we.error("could not create new stream",y),m.stat.timeline.close==null&&m.close(),y.code!=null?y:new E(String(y),N.ERR_UNSUPPORTED_PROTOCOL)}},Promise.all([c.sink(s.source),s.sink(c.source)]).catch(d=>{we.error(d)}));let f=i.timeline;i.timeline=new Proxy(f,{set:(...d)=>(l!=null&&d[1]==="close"&&d[2]!=null&&f.close==null&&(async()=>{try{l.stat.status==="OPEN"&&await l.close()}catch(p){we.error(p)}finally{this.events.safeDispatchEvent("connection:close",{detail:l})}})().catch(p=>{we.error(p)}),Reflect.set(...d))}),i.timeline.upgraded=Date.now();let h=()=>{throw new E("connection is not multiplexed",N.ERR_CONNECTION_NOT_MULTIPLEXED)};return l=Yy({remoteAddr:i.remoteAddr,remotePeer:o,stat:{status:"OPEN",direction:n,timeline:i.timeline,multiplexer:c?.protocol,encryption:r},newStream:u??h,getStreams:()=>c!=null?c.streams:h(),close:async()=>{await i.close(),c?.close()}}),this.events.safeDispatchEvent("connection:open",{detail:l}),l}_onStream(e){let{connection:r,stream:n,protocol:i}=e,{handler:s}=this.components.registrar.getHandler(i);s({connection:r,stream:n})}async _encryptInbound(e){let r=Array.from(this.connectionEncryption.keys());we("handling inbound crypto protocol selection",r);try{let{stream:n,protocol:i}=await Es(e,r,{writeBytes:!0}),s=this.connectionEncryption.get(i);if(s==null)throw new Error(`no crypto module found for ${i}`);return we("encrypting inbound connection..."),{...await s.secureInbound(this.components.peerId,n),protocol:i}}catch(n){throw new E(String(n),N.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,r){let n=Array.from(this.connectionEncryption.keys());we("selecting outbound crypto protocol",n);try{let{stream:i,protocol:s}=await ws(e,n,{writeBytes:!0}),o=this.connectionEncryption.get(s);if(o==null)throw new Error(`no crypto module found for ${s}`);return we("encrypting outbound connection to %p",r),{...await o.secureOutbound(this.components.peerId,i,r),protocol:s}}catch(i){throw new E(String(i),N.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,r){let n=Array.from(r.keys());we("outbound selecting muxer %s",n);try{let{stream:i,protocol:s}=await ws(e,n,{writeBytes:!0});we("%s selected as muxer protocol",s);let o=r.get(s);return{stream:i,muxerFactory:o}}catch(i){throw we.error("error multiplexing outbound stream",i),new E(String(i),N.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,r){let n=Array.from(r.keys());we("inbound handling muxers %s",n);try{let{stream:i,protocol:s}=await Es(e,n,{writeBytes:!0}),o=r.get(s);return{stream:i,muxerFactory:o}}catch(i){throw we.error("error multiplexing inbound stream",i),new E(String(i),N.ERR_MUXER_UNAVAILABLE)}}};var nt=G("libp2p"),Hl=class extends Qi{peerId;peerStore;contentRouting;peerRouting;keychain;metrics;services;components;#e;constructor(e){super();let r=new Qi,n=r.dispatchEvent.bind(r);r.dispatchEvent=c=>{let u=n(c),l=this.dispatchEvent(new lu(c.type,{detail:c.detail}));return u||l};try{(0,Qy.setMaxListeners)?.(1/0,r)}catch{}this.#e=!1,this.peerId=e.peerId,this.services={};let i=this.components=mm({peerId:e.peerId,events:r,datastore:e.datastore??new Yo,connectionGater:Am(e.connectionGater)});this.peerStore=this.configureComponent("peerStore",new zo(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",c=>{c.detail.previous==null&&this.safeDispatchEvent("peer:discovery",{detail:c.detail.peer})}),e.connectionProtector!=null&&this.configureComponent("connectionProtector",e.connectionProtector(i)),this.components.upgrader=new va(this.components,{connectionEncryption:(e.connectionEncryption??[]).map((c,u)=>this.configureComponent(`connection-encryption-${u}`,c(this.components))),muxers:(e.streamMuxers??[]).map((c,u)=>this.configureComponent(`stream-muxers-${u}`,c(this.components))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.configureComponent("transportManager",new da(this.components,e.transportManager)),this.configureComponent("connectionManager",new sa(this.components,e.connectionManager)),this.configureComponent("registrar",new ha(this.components)),this.configureComponent("addressManager",new Wo(this.components,e.addresses));let s=dn.generateOptions();this.keychain=this.configureComponent("keyChain",new dn(this.components,{...s,...e.keychain}));let o=(e.peerRouters??[]).map((c,u)=>this.configureComponent(`peer-router-${u}`,c(this.components)));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new fa(this.components,{routers:o}));let a=(e.contentRouters??[]).map((c,u)=>this.configureComponent(`content-router-${u}`,c(this.components)));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new ua(this.components,{routers:a})),(e.peerDiscovery??[]).forEach((c,u)=>{this.configureComponent(`peer-discovery-${u}`,c(this.components)).addEventListener("peer",f=>{this.#t(f)})}),e.transports.forEach((c,u)=>{this.components.transportManager.add(this.configureComponent(`transport-${u}`,c(this.components)))}),e.services!=null)for(let c of Object.keys(e.services)){let u=e.services[c],l=u(this.components);if(l==null){nt.error("service factory %s returned null or undefined instance",c);continue}this.services[c]=l,this.configureComponent(c,l),l[ou]!=null&&(nt("registering service %s for content routing",c),a.push(l[ou])),l[cu]!=null&&(nt("registering service %s for peer routing",c),o.push(l[cu])),l[au]!=null&&(nt("registering service %s for peer discovery",c),l[au].addEventListener("peer",f=>{this.#t(f)}))}}configureComponent(e,r){return r==null&&nt.error("component %s was null or undefined",e),this.components[e]=r,r}async start(){if(this.#e)return;this.#e=!0,nt("libp2p is starting"),(await this.keychain.listKeys()).find(r=>r.name==="self")==null&&(nt("importing self key into keychain"),await this.keychain.importPeer("self",this.components.peerId));try{await this.components.beforeStart?.(),await this.components.start(),await this.components.afterStart?.(),this.safeDispatchEvent("start",{detail:this}),nt("libp2p has started")}catch(r){throw nt.error("An error occurred starting libp2p",r),await this.stop(),r}}async stop(){this.#e&&(nt("libp2p is stopping"),this.#e=!1,await this.components.beforeStop?.(),await this.components.stop(),await this.components.afterStop?.(),this.safeDispatchEvent("stop",{detail:this}),nt("libp2p has stopped"))}isStarted(){return this.#e}getConnections(e){return this.components.connectionManager.getConnections(e)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){let e=new Bt;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 E("no protocols were provided to open a stream",N.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(r=Array.isArray(r)?r:[r],r.length===0)throw new E("no protocols were provided to open a stream",N.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){pn(e)&&(e=ie(e.getPeerId()??"")),await this.components.connectionManager.closeConnections(e)}async getPublicKey(e,r={}){if(nt("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=Ce([U("/pk/"),e.multihash.digest]),s=await this.contentRouting.get(i,r);return cn(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)}#t(e){let{detail:r}=e;if(r.id.toString()===this.peerId.toString()){nt.error(new Error(N.ERR_DISCOVERED_SELF));return}this.components.peerStore.merge(r.id,{multiaddrs:r.multiaddrs,protocols:r.protocols}).catch(n=>{nt.error(n)})}};async function Xy(t){if(t.peerId==null){let e=t.datastore;if(e!=null)try{let r=new dn({datastore:e},Lr(dn.generateOptions(),t.keychain));t.peerId=await r.exportPeerId("self")}catch(r){if(r.code!=="ERR_NOT_FOUND")throw r}}return t.peerId==null&&(t.peerId=await ap()),new Hl(Nm(t))}async function S_(t){let e=await Xy(t);return t.start!==!1&&await e.start(),e}return ng(A_);})();
|
|
50
50
|
/*! Bundled license information:
|
|
51
51
|
|
|
52
52
|
@noble/ed25519/lib/esm/index.js:
|
|
@@ -49,7 +49,7 @@ class DefaultAutoNATService {
|
|
|
49
49
|
await this.components.registrar.handle(this.protocol, (data) => {
|
|
50
50
|
void this.handleIncomingAutonatStream(data)
|
|
51
51
|
.catch(err => {
|
|
52
|
-
log.error(err);
|
|
52
|
+
log.error('error handling incoming autonat stream', err);
|
|
53
53
|
});
|
|
54
54
|
}, {
|
|
55
55
|
maxInboundStreams: this.maxInboundStreams,
|
|
@@ -83,7 +83,7 @@ class DefaultAutoNATService {
|
|
|
83
83
|
await pipe(source, (source) => lp.decode(source), async function* (stream) {
|
|
84
84
|
const buf = await first(stream);
|
|
85
85
|
if (buf == null) {
|
|
86
|
-
log('
|
|
86
|
+
log('no message received');
|
|
87
87
|
yield Message.encode({
|
|
88
88
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
89
89
|
dialResponse: {
|
|
@@ -98,7 +98,7 @@ class DefaultAutoNATService {
|
|
|
98
98
|
request = Message.decode(buf);
|
|
99
99
|
}
|
|
100
100
|
catch (err) {
|
|
101
|
-
log.error('
|
|
101
|
+
log.error('could not decode message', err);
|
|
102
102
|
yield Message.encode({
|
|
103
103
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
104
104
|
dialResponse: {
|
|
@@ -110,7 +110,7 @@ class DefaultAutoNATService {
|
|
|
110
110
|
}
|
|
111
111
|
const dialRequest = request.dial;
|
|
112
112
|
if (dialRequest == null) {
|
|
113
|
-
log.error('
|
|
113
|
+
log.error('dial was missing from message');
|
|
114
114
|
yield Message.encode({
|
|
115
115
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
116
116
|
dialResponse: {
|
|
@@ -137,7 +137,7 @@ class DefaultAutoNATService {
|
|
|
137
137
|
peerId = peerIdFromBytes(peer.id);
|
|
138
138
|
}
|
|
139
139
|
catch (err) {
|
|
140
|
-
log.error('
|
|
140
|
+
log.error('invalid PeerId', err);
|
|
141
141
|
yield Message.encode({
|
|
142
142
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
143
143
|
dialResponse: {
|
|
@@ -147,10 +147,10 @@ class DefaultAutoNATService {
|
|
|
147
147
|
});
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
log('
|
|
150
|
+
log('incoming request from %p', peerId);
|
|
151
151
|
// reject any dial requests that arrive via relays
|
|
152
152
|
if (!data.connection.remotePeer.equals(peerId)) {
|
|
153
|
-
log('
|
|
153
|
+
log('target peer %p did not equal sending peer %p', peerId, data.connection.remotePeer);
|
|
154
154
|
yield Message.encode({
|
|
155
155
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
156
156
|
dialResponse: {
|
|
@@ -165,27 +165,27 @@ class DefaultAutoNATService {
|
|
|
165
165
|
.map(buf => multiaddr(buf))
|
|
166
166
|
.filter(ma => {
|
|
167
167
|
const isFromSameHost = ma.toOptions().host === data.connection.remoteAddr.toOptions().host;
|
|
168
|
-
log.trace('
|
|
168
|
+
log.trace('request to dial %s was sent from %s is same host %s', ma, data.connection.remoteAddr, isFromSameHost);
|
|
169
169
|
// skip any Multiaddrs where the target node's IP does not match the sending node's IP
|
|
170
170
|
return isFromSameHost;
|
|
171
171
|
})
|
|
172
172
|
.filter(ma => {
|
|
173
173
|
const host = ma.toOptions().host;
|
|
174
174
|
const isPublicIp = !(isPrivateIp(host) ?? false);
|
|
175
|
-
log.trace('
|
|
175
|
+
log.trace('host %s was public %s', host, isPublicIp);
|
|
176
176
|
// don't try to dial private addresses
|
|
177
177
|
return isPublicIp;
|
|
178
178
|
})
|
|
179
179
|
.filter(ma => {
|
|
180
180
|
const host = ma.toOptions().host;
|
|
181
181
|
const isNotOurHost = !ourHosts.includes(host);
|
|
182
|
-
log.trace('
|
|
182
|
+
log.trace('host %s was not our host %s', host, isNotOurHost);
|
|
183
183
|
// don't try to dial nodes on the same host as us
|
|
184
184
|
return isNotOurHost;
|
|
185
185
|
})
|
|
186
186
|
.filter(ma => {
|
|
187
187
|
const isSupportedTransport = Boolean(self.components.transportManager.transportForMultiaddr(ma));
|
|
188
|
-
log.trace('
|
|
188
|
+
log.trace('transport for %s is supported %s', ma, isSupportedTransport);
|
|
189
189
|
// skip any Multiaddrs that have transports we do not support
|
|
190
190
|
return isSupportedTransport;
|
|
191
191
|
})
|
|
@@ -198,7 +198,7 @@ class DefaultAutoNATService {
|
|
|
198
198
|
});
|
|
199
199
|
// make sure we have something to dial
|
|
200
200
|
if (multiaddrs.length === 0) {
|
|
201
|
-
log('
|
|
201
|
+
log('no valid multiaddrs for %p in message', peerId);
|
|
202
202
|
yield Message.encode({
|
|
203
203
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
204
204
|
dialResponse: {
|
|
@@ -208,7 +208,7 @@ class DefaultAutoNATService {
|
|
|
208
208
|
});
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
|
-
log('
|
|
211
|
+
log('dial multiaddrs %s for peer %p', multiaddrs.map(ma => ma.toString()).join(', '), peerId);
|
|
212
212
|
let errorMessage = '';
|
|
213
213
|
let lastMultiaddr = multiaddrs[0];
|
|
214
214
|
for await (const multiaddr of multiaddrs) {
|
|
@@ -219,7 +219,7 @@ class DefaultAutoNATService {
|
|
|
219
219
|
signal
|
|
220
220
|
});
|
|
221
221
|
if (!connection.remoteAddr.equals(multiaddr)) {
|
|
222
|
-
log.error('
|
|
222
|
+
log.error('tried to dial %s but dialed %s', multiaddr, connection.remoteAddr);
|
|
223
223
|
throw new Error('Unexpected remote address');
|
|
224
224
|
}
|
|
225
225
|
log('Success %p', peerId);
|
|
@@ -233,7 +233,7 @@ class DefaultAutoNATService {
|
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
235
|
catch (err) {
|
|
236
|
-
log('
|
|
236
|
+
log('could not dial %p', peerId, err);
|
|
237
237
|
errorMessage = err.message;
|
|
238
238
|
}
|
|
239
239
|
finally {
|
|
@@ -256,7 +256,7 @@ class DefaultAutoNATService {
|
|
|
256
256
|
data.stream);
|
|
257
257
|
}
|
|
258
258
|
catch (err) {
|
|
259
|
-
log.error(err);
|
|
259
|
+
log.error('error handling incoming autonat stream', err);
|
|
260
260
|
}
|
|
261
261
|
finally {
|
|
262
262
|
signal.clear();
|
|
@@ -265,7 +265,7 @@ class DefaultAutoNATService {
|
|
|
265
265
|
_verifyExternalAddresses() {
|
|
266
266
|
void this.verifyExternalAddresses()
|
|
267
267
|
.catch(err => {
|
|
268
|
-
log.error(err);
|
|
268
|
+
log.error('error verifying external address', err);
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
@@ -284,7 +284,7 @@ class DefaultAutoNATService {
|
|
|
284
284
|
return !(isPrivateIp(options.host) ?? false);
|
|
285
285
|
});
|
|
286
286
|
if (multiaddrs.length === 0) {
|
|
287
|
-
log('
|
|
287
|
+
log('no public addresses found, not requesting verification');
|
|
288
288
|
this.verifyAddressTimeout = setTimeout(this._verifyExternalAddresses, this.refreshInterval);
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
@@ -315,7 +315,7 @@ class DefaultAutoNATService {
|
|
|
315
315
|
const networkSegments = [];
|
|
316
316
|
const verifyAddress = async (peer) => {
|
|
317
317
|
try {
|
|
318
|
-
log('
|
|
318
|
+
log('asking %p to verify multiaddr', peer.id);
|
|
319
319
|
const connection = await self.components.connectionManager.openConnection(peer.id, {
|
|
320
320
|
signal
|
|
321
321
|
});
|
|
@@ -325,12 +325,12 @@ class DefaultAutoNATService {
|
|
|
325
325
|
const source = abortableDuplex(stream, signal);
|
|
326
326
|
const buf = await pipe([request], (source) => lp.encode(source), source, (source) => lp.decode(source), async (stream) => first(stream));
|
|
327
327
|
if (buf == null) {
|
|
328
|
-
log('
|
|
328
|
+
log('no response received from %p', connection.remotePeer);
|
|
329
329
|
return undefined;
|
|
330
330
|
}
|
|
331
331
|
const response = Message.decode(buf);
|
|
332
332
|
if (response.type !== Message.MessageType.DIAL_RESPONSE || response.dialResponse == null) {
|
|
333
|
-
log('
|
|
333
|
+
log('invalid autonat response from %p', connection.remotePeer);
|
|
334
334
|
return undefined;
|
|
335
335
|
}
|
|
336
336
|
if (response.dialResponse.status === Message.ResponseStatus.OK) {
|
|
@@ -346,11 +346,11 @@ class DefaultAutoNATService {
|
|
|
346
346
|
segment = octets[0];
|
|
347
347
|
}
|
|
348
348
|
else {
|
|
349
|
-
log('
|
|
349
|
+
log('remote address "%s" was not IP4 or IP6?', options.host);
|
|
350
350
|
return undefined;
|
|
351
351
|
}
|
|
352
352
|
if (networkSegments.includes(segment)) {
|
|
353
|
-
log('
|
|
353
|
+
log('already have response from network segment %d - %s', segment, options.host);
|
|
354
354
|
return undefined;
|
|
355
355
|
}
|
|
356
356
|
networkSegments.push(segment);
|
|
@@ -358,7 +358,7 @@ class DefaultAutoNATService {
|
|
|
358
358
|
return response.dialResponse;
|
|
359
359
|
}
|
|
360
360
|
catch (err) {
|
|
361
|
-
log.error(err);
|
|
361
|
+
log.error('error asking remote to verify multiaddr', err);
|
|
362
362
|
}
|
|
363
363
|
};
|
|
364
364
|
for await (const dialResponse of parallel(map(this.components.peerRouting.getClosestPeers(randomCid, {
|
|
@@ -372,7 +372,7 @@ class DefaultAutoNATService {
|
|
|
372
372
|
}
|
|
373
373
|
// they either told us which address worked/didn't work, or we only sent them one address
|
|
374
374
|
const addr = dialResponse.addr == null ? multiaddrs[0] : multiaddr(dialResponse.addr);
|
|
375
|
-
log('
|
|
375
|
+
log('autonat response for %s is %s', addr, dialResponse.status);
|
|
376
376
|
if (dialResponse.status === Message.ResponseStatus.E_BAD_REQUEST) {
|
|
377
377
|
// the remote could not parse our request
|
|
378
378
|
continue;
|
|
@@ -386,7 +386,7 @@ class DefaultAutoNATService {
|
|
|
386
386
|
continue;
|
|
387
387
|
}
|
|
388
388
|
if (!multiaddrs.some(ma => ma.equals(addr))) {
|
|
389
|
-
log('
|
|
389
|
+
log('peer reported %s as %s but it was not in our observed address list', addr, dialResponse.status);
|
|
390
390
|
continue;
|
|
391
391
|
}
|
|
392
392
|
const addrStr = addr.toString();
|
|
@@ -413,7 +413,7 @@ class DefaultAutoNATService {
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
catch (err) {
|
|
416
|
-
log.error('
|
|
416
|
+
log.error('could not verify external address', err);
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/autonat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,SAA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M,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;IAI9F,YAAY,CAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBtI,aAAa,IAAK,SAAS,EAAE;IAI7B,YAAY,IAAK,MAAM,EAAE;IAInB,MAAM,CAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD;;OAEG;IACG,YAAY,CAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;IA8B5E,MAAM,CAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAY5G,QAAQ,CAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYtD,QAAQ,CAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAItE,UAAU,CAAE,EAAE,EAAE,MAAM,GAAG,IAAI;CAsB9B;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAE,CAAC,SAAS,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CA0B1I"}
|
package/dist/src/libp2p.js
CHANGED
|
@@ -175,6 +175,7 @@ export class Libp2pNode extends EventEmitter {
|
|
|
175
175
|
await this.components.beforeStart?.();
|
|
176
176
|
await this.components.start();
|
|
177
177
|
await this.components.afterStart?.();
|
|
178
|
+
this.safeDispatchEvent('start', { detail: this });
|
|
178
179
|
log('libp2p has started');
|
|
179
180
|
}
|
|
180
181
|
catch (err) {
|
|
@@ -195,6 +196,7 @@ export class Libp2pNode extends EventEmitter {
|
|
|
195
196
|
await this.components.beforeStop?.();
|
|
196
197
|
await this.components.stop();
|
|
197
198
|
await this.components.afterStop?.();
|
|
199
|
+
this.safeDispatchEvent('stop', { detail: this });
|
|
198
200
|
log('libp2p has stopped');
|
|
199
201
|
}
|
|
200
202
|
isStarted() {
|
package/dist/src/libp2p.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libp2p.js","sourceRoot":"","sources":["../../src/libp2p.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAuB,cAAc,EAAE,MAAM,mCAAmC,CAAA;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAChE,OAAO,EAAoB,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,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,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cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;AAChD,CAAC"}
|
package/dist/src/version.d.ts
CHANGED
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libp2p",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.2",
|
|
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#readme",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"@libp2p/interface-connection-manager": "^3.0.0",
|
|
129
129
|
"@libp2p/interface-content-routing": "^2.1.0",
|
|
130
130
|
"@libp2p/interface-keychain": "^2.0.4",
|
|
131
|
-
"@libp2p/interface-libp2p": "^3.
|
|
131
|
+
"@libp2p/interface-libp2p": "^3.2.0",
|
|
132
132
|
"@libp2p/interface-metrics": "^4.0.0",
|
|
133
133
|
"@libp2p/interface-peer-discovery": "^2.0.0",
|
|
134
134
|
"@libp2p/interface-peer-id": "^2.0.1",
|
package/src/autonat/index.ts
CHANGED
|
@@ -110,7 +110,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
110
110
|
await this.components.registrar.handle(this.protocol, (data) => {
|
|
111
111
|
void this.handleIncomingAutonatStream(data)
|
|
112
112
|
.catch(err => {
|
|
113
|
-
log.error(err)
|
|
113
|
+
log.error('error handling incoming autonat stream', err)
|
|
114
114
|
})
|
|
115
115
|
}, {
|
|
116
116
|
maxInboundStreams: this.maxInboundStreams,
|
|
@@ -156,7 +156,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
156
156
|
const buf = await first(stream)
|
|
157
157
|
|
|
158
158
|
if (buf == null) {
|
|
159
|
-
log('
|
|
159
|
+
log('no message received')
|
|
160
160
|
yield Message.encode({
|
|
161
161
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
162
162
|
dialResponse: {
|
|
@@ -173,7 +173,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
173
173
|
try {
|
|
174
174
|
request = Message.decode(buf)
|
|
175
175
|
} catch (err) {
|
|
176
|
-
log.error('
|
|
176
|
+
log.error('could not decode message', err)
|
|
177
177
|
|
|
178
178
|
yield Message.encode({
|
|
179
179
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
@@ -189,7 +189,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
189
189
|
const dialRequest = request.dial
|
|
190
190
|
|
|
191
191
|
if (dialRequest == null) {
|
|
192
|
-
log.error('
|
|
192
|
+
log.error('dial was missing from message')
|
|
193
193
|
|
|
194
194
|
yield Message.encode({
|
|
195
195
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
@@ -222,7 +222,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
222
222
|
try {
|
|
223
223
|
peerId = peerIdFromBytes(peer.id)
|
|
224
224
|
} catch (err) {
|
|
225
|
-
log.error('
|
|
225
|
+
log.error('invalid PeerId', err)
|
|
226
226
|
|
|
227
227
|
yield Message.encode({
|
|
228
228
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
@@ -235,11 +235,11 @@ class DefaultAutoNATService implements Startable {
|
|
|
235
235
|
return
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
log('
|
|
238
|
+
log('incoming request from %p', peerId)
|
|
239
239
|
|
|
240
240
|
// reject any dial requests that arrive via relays
|
|
241
241
|
if (!data.connection.remotePeer.equals(peerId)) {
|
|
242
|
-
log('
|
|
242
|
+
log('target peer %p did not equal sending peer %p', peerId, data.connection.remotePeer)
|
|
243
243
|
|
|
244
244
|
yield Message.encode({
|
|
245
245
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
@@ -258,7 +258,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
258
258
|
.filter(ma => {
|
|
259
259
|
const isFromSameHost = ma.toOptions().host === data.connection.remoteAddr.toOptions().host
|
|
260
260
|
|
|
261
|
-
log.trace('
|
|
261
|
+
log.trace('request to dial %s was sent from %s is same host %s', ma, data.connection.remoteAddr, isFromSameHost)
|
|
262
262
|
// skip any Multiaddrs where the target node's IP does not match the sending node's IP
|
|
263
263
|
return isFromSameHost
|
|
264
264
|
})
|
|
@@ -266,7 +266,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
266
266
|
const host = ma.toOptions().host
|
|
267
267
|
const isPublicIp = !(isPrivateIp(host) ?? false)
|
|
268
268
|
|
|
269
|
-
log.trace('
|
|
269
|
+
log.trace('host %s was public %s', host, isPublicIp)
|
|
270
270
|
// don't try to dial private addresses
|
|
271
271
|
return isPublicIp
|
|
272
272
|
})
|
|
@@ -274,14 +274,14 @@ class DefaultAutoNATService implements Startable {
|
|
|
274
274
|
const host = ma.toOptions().host
|
|
275
275
|
const isNotOurHost = !ourHosts.includes(host)
|
|
276
276
|
|
|
277
|
-
log.trace('
|
|
277
|
+
log.trace('host %s was not our host %s', host, isNotOurHost)
|
|
278
278
|
// don't try to dial nodes on the same host as us
|
|
279
279
|
return isNotOurHost
|
|
280
280
|
})
|
|
281
281
|
.filter(ma => {
|
|
282
282
|
const isSupportedTransport = Boolean(self.components.transportManager.transportForMultiaddr(ma))
|
|
283
283
|
|
|
284
|
-
log.trace('
|
|
284
|
+
log.trace('transport for %s is supported %s', ma, isSupportedTransport)
|
|
285
285
|
// skip any Multiaddrs that have transports we do not support
|
|
286
286
|
return isSupportedTransport
|
|
287
287
|
})
|
|
@@ -296,7 +296,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
296
296
|
|
|
297
297
|
// make sure we have something to dial
|
|
298
298
|
if (multiaddrs.length === 0) {
|
|
299
|
-
log('
|
|
299
|
+
log('no valid multiaddrs for %p in message', peerId)
|
|
300
300
|
|
|
301
301
|
yield Message.encode({
|
|
302
302
|
type: Message.MessageType.DIAL_RESPONSE,
|
|
@@ -309,7 +309,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
309
309
|
return
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
log('
|
|
312
|
+
log('dial multiaddrs %s for peer %p', multiaddrs.map(ma => ma.toString()).join(', '), peerId)
|
|
313
313
|
|
|
314
314
|
let errorMessage = ''
|
|
315
315
|
let lastMultiaddr = multiaddrs[0]
|
|
@@ -324,7 +324,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
324
324
|
})
|
|
325
325
|
|
|
326
326
|
if (!connection.remoteAddr.equals(multiaddr)) {
|
|
327
|
-
log.error('
|
|
327
|
+
log.error('tried to dial %s but dialed %s', multiaddr, connection.remoteAddr)
|
|
328
328
|
throw new Error('Unexpected remote address')
|
|
329
329
|
}
|
|
330
330
|
|
|
@@ -340,7 +340,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
340
340
|
|
|
341
341
|
return
|
|
342
342
|
} catch (err: any) {
|
|
343
|
-
log('
|
|
343
|
+
log('could not dial %p', peerId, err)
|
|
344
344
|
errorMessage = err.message
|
|
345
345
|
} finally {
|
|
346
346
|
if (connection != null) {
|
|
@@ -364,7 +364,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
364
364
|
data.stream
|
|
365
365
|
)
|
|
366
366
|
} catch (err) {
|
|
367
|
-
log.error(err)
|
|
367
|
+
log.error('error handling incoming autonat stream', err)
|
|
368
368
|
} finally {
|
|
369
369
|
signal.clear()
|
|
370
370
|
}
|
|
@@ -373,7 +373,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
373
373
|
_verifyExternalAddresses (): void {
|
|
374
374
|
void this.verifyExternalAddresses()
|
|
375
375
|
.catch(err => {
|
|
376
|
-
log.error(err)
|
|
376
|
+
log.error('error verifying external address', err)
|
|
377
377
|
})
|
|
378
378
|
}
|
|
379
379
|
|
|
@@ -398,7 +398,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
398
398
|
})
|
|
399
399
|
|
|
400
400
|
if (multiaddrs.length === 0) {
|
|
401
|
-
log('
|
|
401
|
+
log('no public addresses found, not requesting verification')
|
|
402
402
|
this.verifyAddressTimeout = setTimeout(this._verifyExternalAddresses, this.refreshInterval)
|
|
403
403
|
|
|
404
404
|
return
|
|
@@ -436,7 +436,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
436
436
|
|
|
437
437
|
const verifyAddress = async (peer: PeerInfo): Promise<Message.DialResponse | undefined> => {
|
|
438
438
|
try {
|
|
439
|
-
log('
|
|
439
|
+
log('asking %p to verify multiaddr', peer.id)
|
|
440
440
|
|
|
441
441
|
const connection = await self.components.connectionManager.openConnection(peer.id, {
|
|
442
442
|
signal
|
|
@@ -455,13 +455,13 @@ class DefaultAutoNATService implements Startable {
|
|
|
455
455
|
async (stream) => first(stream)
|
|
456
456
|
)
|
|
457
457
|
if (buf == null) {
|
|
458
|
-
log('
|
|
458
|
+
log('no response received from %p', connection.remotePeer)
|
|
459
459
|
return undefined
|
|
460
460
|
}
|
|
461
461
|
const response = Message.decode(buf)
|
|
462
462
|
|
|
463
463
|
if (response.type !== Message.MessageType.DIAL_RESPONSE || response.dialResponse == null) {
|
|
464
|
-
log('
|
|
464
|
+
log('invalid autonat response from %p', connection.remotePeer)
|
|
465
465
|
return undefined
|
|
466
466
|
}
|
|
467
467
|
|
|
@@ -477,12 +477,12 @@ class DefaultAutoNATService implements Startable {
|
|
|
477
477
|
const octets = options.host.split(':')
|
|
478
478
|
segment = octets[0]
|
|
479
479
|
} else {
|
|
480
|
-
log('
|
|
480
|
+
log('remote address "%s" was not IP4 or IP6?', options.host)
|
|
481
481
|
return undefined
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
if (networkSegments.includes(segment)) {
|
|
485
|
-
log('
|
|
485
|
+
log('already have response from network segment %d - %s', segment, options.host)
|
|
486
486
|
return undefined
|
|
487
487
|
}
|
|
488
488
|
|
|
@@ -491,7 +491,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
491
491
|
|
|
492
492
|
return response.dialResponse
|
|
493
493
|
} catch (err) {
|
|
494
|
-
log.error(err)
|
|
494
|
+
log.error('error asking remote to verify multiaddr', err)
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
|
|
@@ -508,7 +508,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
508
508
|
// they either told us which address worked/didn't work, or we only sent them one address
|
|
509
509
|
const addr = dialResponse.addr == null ? multiaddrs[0] : multiaddr(dialResponse.addr)
|
|
510
510
|
|
|
511
|
-
log('
|
|
511
|
+
log('autonat response for %s is %s', addr, dialResponse.status)
|
|
512
512
|
|
|
513
513
|
if (dialResponse.status === Message.ResponseStatus.E_BAD_REQUEST) {
|
|
514
514
|
// the remote could not parse our request
|
|
@@ -526,7 +526,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
if (!multiaddrs.some(ma => ma.equals(addr))) {
|
|
529
|
-
log('
|
|
529
|
+
log('peer reported %s as %s but it was not in our observed address list', addr, dialResponse.status)
|
|
530
530
|
continue
|
|
531
531
|
}
|
|
532
532
|
|
|
@@ -556,7 +556,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
556
556
|
return
|
|
557
557
|
}
|
|
558
558
|
} catch (err) {
|
|
559
|
-
log.error('
|
|
559
|
+
log.error('could not verify external address', err)
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
} finally {
|
package/src/libp2p.ts
CHANGED
|
@@ -227,6 +227,8 @@ export class Libp2pNode<T extends ServiceMap = Record<string, unknown>> extends
|
|
|
227
227
|
await this.components.beforeStart?.()
|
|
228
228
|
await this.components.start()
|
|
229
229
|
await this.components.afterStart?.()
|
|
230
|
+
|
|
231
|
+
this.safeDispatchEvent('start', { detail: this })
|
|
230
232
|
log('libp2p has started')
|
|
231
233
|
} catch (err: any) {
|
|
232
234
|
log.error('An error occurred starting libp2p', err)
|
|
@@ -251,6 +253,7 @@ export class Libp2pNode<T extends ServiceMap = Record<string, unknown>> extends
|
|
|
251
253
|
await this.components.stop()
|
|
252
254
|
await this.components.afterStop?.()
|
|
253
255
|
|
|
256
|
+
this.safeDispatchEvent('stop', { detail: this })
|
|
254
257
|
log('libp2p has stopped')
|
|
255
258
|
}
|
|
256
259
|
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '0.45.
|
|
1
|
+
export const version = '0.45.2'
|
|
2
2
|
export const name = 'libp2p'
|