@decentnetwork/lan 0.1.78 → 0.1.80

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
@@ -26,6 +26,10 @@ export class PeerManager extends EventEmitter {
26
26
  bootstrapNodes: opts.bootstrapNodes,
27
27
  expressNodes: opts.expressNodes,
28
28
  expressControlPlaneOnly: opts.expressControlPlaneOnly,
29
+ // Register our IP channel (163) as the SDK's bulk-data stream so it
30
+ // rides a single transport instead of fanning out over UDP + relay +
31
+ // TCP relay (which delivered 3-4 duplicates of every IP packet).
32
+ bulkDataPacketId: PACKET_ID_DL_IP,
29
33
  });
30
34
  this.setupEventHandlers();
31
35
  this.logger.info("Peer instance created (not yet started)");
@@ -445,10 +449,10 @@ export class PeerManager extends EventEmitter {
445
449
  }
446
450
  this.emit("message", message.pubkey, message.text);
447
451
  });
448
- // decentlan custom packets: IP data (192, lossy), session handshake
449
- // (161, lossless), dora control (162, lossless). Each on its own Carrier
450
- // packet id — a chat message can never be mistaken for an IP packet, and
451
- // no crafted message can inject onto the TUN.
452
+ // decentlan custom packets, all lossless so they traverse relay-only
453
+ // sessions: IP data (163), session handshake (161), dora control (162).
454
+ // Each on its own Carrier packet id — a chat message can never be mistaken
455
+ // for an IP packet, and no crafted message can inject onto the TUN.
452
456
  this.peer.onCustomPacket(({ pubkey, id, data }) => {
453
457
  try {
454
458
  if (id === PACKET_ID_DL_DORA) {
@@ -10,4 +10,4 @@ export declare const FRAME_MAGIC = 170;
10
10
  export declare const FRAME_HEADER_SIZE = 6;
11
11
  export declare const PACKET_ID_DL_SESSION = 161;
12
12
  export declare const PACKET_ID_DL_DORA = 162;
13
- export declare const PACKET_ID_DL_IP = 192;
13
+ export declare const PACKET_ID_DL_IP = 163;
@@ -15,4 +15,13 @@ export const FRAME_HEADER_SIZE = 6; // magic(1) + length(2) + sessionId(2) + opc
15
15
  // so IP traffic can never be confused with a Carrier message.
16
16
  export const PACKET_ID_DL_SESSION = 161; // lossless: session handshake frames (must arrive)
17
17
  export const PACKET_ID_DL_DORA = 162; // lossless: dora control (must arrive)
18
- export const PACKET_ID_DL_IP = 192; // lossy: IP data frames (best-effort; inner TCP retransmits)
18
+ // IP data MUST be lossless (160-191), NOT lossy (192-254). toxcore only carries
19
+ // lossy packets over a live UDP path; on a relay-only session (no direct
20
+ // hole-punch — e.g. any China↔abroad link through the GFW) lossy packets are
21
+ // silently dropped, so IP traffic died while chat/dora (lossless) kept working.
22
+ // Proven in the field: a node behind the GFW registered with the dora over 162
23
+ // (lossless) on the same relay session that dropped every 192 (lossy) IP packet.
24
+ // Lossless rides the reliable buffer and is delivered over UDP *or* TCP relay.
25
+ // The TCP-over-TCP cost on a direct path is the accepted trade — relay delivery
26
+ // is non-negotiable. (The handshake at 161 already exempts IP from chat-64.)
27
+ export const PACKET_ID_DL_IP = 163; // lossless: IP data frames (must traverse relays)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.78",
3
+ "version": "0.1.80",
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",
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "dependencies": {
79
79
  "@decentnetwork/dora": "^0.1.6",
80
- "@decentnetwork/peer": "^0.1.33",
80
+ "@decentnetwork/peer": "^0.1.34",
81
81
  "js-yaml": "^4.1.0",
82
82
  "yargs": "^17.7.2"
83
83
  },