@decentnetwork/peer 0.1.62 → 0.1.63

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.
Files changed (2) hide show
  1. package/dist/peer.js +8 -1
  2. package/package.json +1 -1
package/dist/peer.js CHANGED
@@ -3476,7 +3476,14 @@ export class Peer {
3476
3476
  // upgrading the path to direct UDP in both directions with no new
3477
3477
  // handshake. If UDP never works, the periodic offer re-punches.
3478
3478
  const haveRealUdp = session.remote && !session.remote.host?.startsWith("tcp:") && session.remote.port !== 0;
3479
- if (!haveRealUdp) {
3479
+ // NEVER point the session at the public srflx when we know a same-LAN
3480
+ // candidate for this peer: the physical LAN is strictly better, and letting
3481
+ // the srflx win here caused a LAN↔public FLAP (the LAN block above set
3482
+ // remote=LAN, then this overwrote it with the Tailscale-exit public IP),
3483
+ // so the direct LAN path never stabilised and udpRecv never confirmed.
3484
+ const haveLanCandidate = (session.endpointCandidates ?? []).some((c) => isPrivateAddress(c.host) && !isCgnatAddress(c.host) &&
3485
+ getPhysicalLanSubnets().some((s) => isInIpv4Subnet(c.host, s)));
3486
+ if (!haveRealUdp && !haveLanCandidate) {
3480
3487
  session.remote = { host, port };
3481
3488
  }
3482
3489
  // Nudge a keepalive out immediately so the upgrade doesn't wait for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/peer",
3
- "version": "0.1.62",
3
+ "version": "0.1.63",
4
4
  "description": "Pure TypeScript port of Elastos Carrier (toxcore-derived) P2P messaging. DHT, onion routing, TCP relay, FlatBuffers app payloads, Express offline relay. Wire-compatible with iOS Beagle and the Carrier C SDK.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",