@decentnetwork/lan 0.1.23 → 0.1.24
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.
- package/bin/tun-helper-darwin-amd64 +0 -0
- package/bin/tun-helper-darwin-arm64 +0 -0
- package/bin/tun-helper-linux-amd64 +0 -0
- package/bin/tun-helper-linux-arm64 +0 -0
- package/dist/carrier/peer-manager.d.ts +11 -0
- package/dist/carrier/peer-manager.js +14 -0
- package/dist/daemon/server.js +7 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Manages Carrier peer identity and connections
|
|
3
3
|
* Wraps @decentnetwork/peer SDK
|
|
4
4
|
*/
|
|
5
|
+
import { Peer } from "@decentnetwork/peer";
|
|
5
6
|
import { EventEmitter } from "events";
|
|
6
7
|
import { PacketSession } from "./packet-session.js";
|
|
7
8
|
import type { PeerIdentity, RemotePeer } from "./types.js";
|
|
@@ -62,6 +63,16 @@ export declare class PeerManager extends EventEmitter {
|
|
|
62
63
|
getHexPubkey(): string;
|
|
63
64
|
getAddress(): string;
|
|
64
65
|
getFriends(): RemotePeer[];
|
|
66
|
+
/**
|
|
67
|
+
* Snapshot of the underlying net_crypto session — UDP-direct vs
|
|
68
|
+
* TCP-relay vs not-yet-established. Surfaces what's behind a
|
|
69
|
+
* "friend.status === online" so an operator can see whether
|
|
70
|
+
* latency is going via a fast direct UDP path or via a TCP relay.
|
|
71
|
+
* Returns null if the SDK has no session record for the pubkey
|
|
72
|
+
* yet (i.e. handshake hasn't happened). See peer.ts for the
|
|
73
|
+
* Status shape.
|
|
74
|
+
*/
|
|
75
|
+
getSessionStatus(pubkey: string): ReturnType<Peer["sessionStatus"]> | null;
|
|
65
76
|
/**
|
|
66
77
|
* Check if a specific friend is currently online (direct UDP path established).
|
|
67
78
|
* Returns false for unknown pubkeys.
|
|
@@ -183,6 +183,20 @@ export class PeerManager extends EventEmitter {
|
|
|
183
183
|
};
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Snapshot of the underlying net_crypto session — UDP-direct vs
|
|
188
|
+
* TCP-relay vs not-yet-established. Surfaces what's behind a
|
|
189
|
+
* "friend.status === online" so an operator can see whether
|
|
190
|
+
* latency is going via a fast direct UDP path or via a TCP relay.
|
|
191
|
+
* Returns null if the SDK has no session record for the pubkey
|
|
192
|
+
* yet (i.e. handshake hasn't happened). See peer.ts for the
|
|
193
|
+
* Status shape.
|
|
194
|
+
*/
|
|
195
|
+
getSessionStatus(pubkey) {
|
|
196
|
+
if (!this.peer)
|
|
197
|
+
return null;
|
|
198
|
+
return this.peer.sessionStatus(pubkey);
|
|
199
|
+
}
|
|
186
200
|
/**
|
|
187
201
|
* Check if a specific friend is currently online (direct UDP path established).
|
|
188
202
|
* Returns false for unknown pubkeys.
|
package/dist/daemon/server.js
CHANGED
|
@@ -202,6 +202,13 @@ export class DaemonServer {
|
|
|
202
202
|
status: f.status,
|
|
203
203
|
address: f.address,
|
|
204
204
|
acceptedAt: f.acceptedAt,
|
|
205
|
+
// Transport state of the underlying net_crypto session.
|
|
206
|
+
// Surface this so operators can tell "online via direct UDP
|
|
207
|
+
// (~80ms RTT)" from "online via TCP relay (~500ms+ RTT)" —
|
|
208
|
+
// the difference matters a lot and `status: online` hides it.
|
|
209
|
+
// Null when no session record exists yet (handshake hasn't
|
|
210
|
+
// happened).
|
|
211
|
+
session: this.peerManager?.getSessionStatus(f.pubkey) ?? null,
|
|
205
212
|
})),
|
|
206
213
|
ipam: ipamPeers,
|
|
207
214
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/lan",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
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",
|