@decentnetwork/peer 0.1.108 → 0.1.109

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 +12 -8
  2. package/package.json +1 -1
package/dist/peer.js CHANGED
@@ -2169,17 +2169,21 @@ export class Peer {
2169
2169
  // syscall (that was the CCTV CPU regression) — safe at CCTV packet
2170
2170
  // rates.
2171
2171
  this.#adoptRemote(state, remote.address, remote.port);
2172
- // A successfully decrypted packet arriving from a private address in
2173
- // one of our physical subnets is stronger LAN proof than an endpoint
2174
- // hint: it demonstrates that this exact host:port already reaches us.
2175
- // Lock it immediately. Without this, duplicate public/relay copies
2176
- // arriving a moment later overwrite `remote`, so file DATA travels on
2177
- // the LAN but ACKs hairpin through the public Internet (observed as
2178
- // ~38KB/s between mac-dev and WSL on the same 10.0.0.0/24).
2172
+ // A successfully decrypted packet arriving from a private address is
2173
+ // stronger proof than an endpoint hint: it demonstrates that this
2174
+ // exact host:port already reaches us. Do not require the address to be
2175
+ // in one of this process' physical subnets. WSL commonly has only a
2176
+ // 172.16/12 vNIC while the real LAN peer is 10.0.0.x via the Windows
2177
+ // host NAT; direct UDP is confirmed, but a strict same-subnet check
2178
+ // leaves file transfer on the conservative public/relay pacer.
2179
+ //
2180
+ // Unverified private candidates still require same-subnet matching at
2181
+ // candidate-learn time. This relaxed lock is only for decrypted UDP,
2182
+ // so it cannot promote a spoofed or merely advertised private host.
2179
2183
  if (!state.lanRemoteHost &&
2180
2184
  isPrivateAddress(remote.address) &&
2181
2185
  !isCgnatAddress(remote.address) &&
2182
- getPhysicalLanSubnets().some((s) => isInIpv4Subnet(remote.address, s))) {
2186
+ !this.#isUnroutableSelfSource(remote.address, remote.port)) {
2183
2187
  state.lanRemoteHost = remote.address;
2184
2188
  this.#rememberEndpointCandidate(state, remote.address, remote.port);
2185
2189
  this.#debugLog(`lan_lock_confirmed friend=${friendId} host=${remote.address}:${remote.port} (decrypted UDP source)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/peer",
3
- "version": "0.1.108",
3
+ "version": "0.1.109",
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",