Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
sdk/js: cite the js-libp2p issues behind the relay workarounds
Antonio Ojea6bed21b58467
diff --git a/sdk/README.md b/sdk/README.mdindex f18855b1..b83d595e 100644--- a/sdk/README.md+++ b/sdk/README.md@@ -92,14 +92,18 @@ pinned by a test:- js-libp2p reserves a relay slot when it starts listening on`<relay>/p2p-circuit`, and a router refuses that before the authhandshake. The JS SDK starts the listener after the handshake, through the- transport manager, which is not on the public `Libp2p` interface.+ transport manager, which is not on the public `Libp2p` interface+ ([libp2p/js-libp2p#3645](https://github.com/libp2p/js-libp2p/issues/3645)).- go-libp2p's relay grants a reservation for one hour and drops it whenthat passes, and with the connection it was made on; a member that stilladvertises the relayed address is then unreachable (`NO_RESERVATION`).js-libp2p's listener renews on its own, but only on a connection the- router still holds the admission of; the JS SDK runs the handshake again- on every new connection to a router and, when the relayed address is- gone, authenticates and reserves again within thirty seconds. The Python+ router still holds the admission of, and does not reserve again on a+ static relay after the connection dropped+ ([libp2p/js-libp2p#3601](https://github.com/libp2p/js-libp2p/issues/3601));+ the JS SDK runs the handshake again on every new connection to a router+ and, when the relayed address is gone, authenticates and reserves again+ within thirty seconds. The PythonSDK renews two minutes before the expiry the router returned, and withinthirty seconds of the connection to that router going, running the authhandshake again first.diff --git a/sdk/js/src/host.ts b/sdk/js/src/host.tsindex c33cd357..32693947 100644--- a/sdk/js/src/host.ts+++ b/sdk/js/src/host.ts@@ -105,6 +105,8 @@ export interface RelayListener {* restarts or trims the connection drops it, and js-libp2p does not ask a* configured relay again. Calling `listen` on the returned listener does,* without registering a second listener.+ *+ * Upstream: libp2p/js-libp2p#3645 (listen after start), #3601 (re-reserve).*/export async function listenThroughRelay(node: Libp2p, relayAddr: Multiaddr): Promise<RelayListener> {const internals = node as unknown as { components: { transportManager: { listen(addrs: Multiaddr[]): Promise<void>; getListeners(): RelayListener[] } } };diff --git a/sdk/js/src/session.ts b/sdk/js/src/session.tsindex 5274fbb1..cae0437e 100644--- a/sdk/js/src/session.ts+++ b/sdk/js/src/session.ts@@ -251,7 +251,7 @@ export class MeshSession {* tried in order, each dialed and authenticated again first, since the* router forgot the admission with the connection. Runs on* relayCheckIntervalMs; exposed so a caller can force it. Concurrent- * calls share one attempt.+ * calls share one attempt. Upstream: libp2p/js-libp2p#3601.*/keepRelay(): Promise<void> {this.#keepingRelay ??= this.#keepRelayOnce().finally(() => {