@decentnetwork/lan 0.1.105 → 0.1.106

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.
Binary file
Binary file
Binary file
Binary file
@@ -119,16 +119,26 @@ export class DoraIntegration {
119
119
  record = await this.tryRegister(myUserid, myAddress, this.opts.preferredIp);
120
120
  }
121
121
  catch (err) {
122
- // Common case: the preferred IP from config.yaml collides
123
- // with another peer's reservation (every fresh `agentnet
124
- // init` defaults to 10.86.1.10, so the second peer to
125
- // register always loses the race). Retry once without
126
- // requestedIp so dora picks any free slot. Errors that
127
- // aren't IP-collision flavored fall through to the outer
128
- // catch and trigger the fallback path.
122
+ // Two recoverable cases, both fixed by retrying without a preferred
123
+ // IP so dora assigns any free in-segment slot:
124
+ // 1. Collision the preferred IP from config.yaml is already taken
125
+ // (every fresh `agentnet init` defaults to 10.86.1.10, so the
126
+ // second peer to register loses the race).
127
+ // 2. Out-of-range the preferred IP belongs to a federated
128
+ // registry's segment whose dora is currently DOWN, so only
129
+ // sibling registries answered and they reject the IP. The dora
130
+ // client already walks siblings to find the owning registry when
131
+ // it IS up (keeping our stable IP); this branch only triggers
132
+ // when the owner is unreachable. Without it we'd fall back to the
133
+ // UNREGISTERED config IP and drop every packet to peers we never
134
+ // learned from the roster (the observed CCTV outage). A temp
135
+ // in-segment IP that's actually registered beats a stable IP
136
+ // that isn't.
137
+ // Anything else (e.g. malformed request) falls through to the outer
138
+ // catch and the config-IP fallback.
129
139
  const msg = err instanceof Error ? err.message : String(err);
130
- const looksLikeIpCollision = /held by|in use|already taken|already in use/i.test(msg);
131
- if (!looksLikeIpCollision)
140
+ const retryWithoutPreferredIp = /held by|in use|already taken|already in use|out of range/i.test(msg);
141
+ if (!retryWithoutPreferredIp)
132
142
  throw err;
133
143
  this.logger.warn(`Preferred IP ${this.opts.preferredIp} not available (${msg}) — requesting any free IP`);
134
144
  record = await this.tryRegister(myUserid, myAddress);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.105",
3
+ "version": "0.1.106",
4
4
  "description": "Private virtual LAN for self-hosted services and AI agents, built on Elastos Carrier. NAT-traversal, name service, ACL, all over a peer-to-peer mesh — no public IP required.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -78,7 +78,7 @@
78
78
  "build:console": "node scripts/build-console.mjs"
79
79
  },
80
80
  "dependencies": {
81
- "@decentnetwork/dora": "^0.1.6",
81
+ "@decentnetwork/dora": "^0.1.11",
82
82
  "@decentnetwork/peer": "^0.1.46",
83
83
  "ink": "^5.2.1",
84
84
  "js-yaml": "^4.1.0",