@decentnetwork/lan 0.1.39 → 0.1.41

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
@@ -883,10 +883,24 @@ export async function cmdProxyListHosts(args) {
883
883
  export async function cmdProxyUse(args) {
884
884
  const dir = args.configDir || ConfigLoader.defaultConfigDir();
885
885
  const config = await ConfigLoader.load(resolve(dir, "config.yaml"));
886
- const ipam = await Ipam.loadOrCreate(config.paths.ipamFile, config.node.namespace);
887
- const record = ipam.resolveCarrierId(args.peer) || ipam.getPeers().find((p) => p.name === args.peer);
886
+ const { peers, source } = await fetchLiveIpam(config);
887
+ const stripDomain = (s) => s.replace(/\.[A-Za-z][A-Za-z0-9-]*$/, "");
888
+ const record = peers.find((p) => p.carrierId === args.peer ||
889
+ p.name === args.peer ||
890
+ p.name === stripDomain(args.peer) ||
891
+ p.virtualIp === args.peer);
888
892
  if (!record) {
889
- console.error(`Unknown peer: ${args.peer}. Add it first via 'agentnet ipam assign'.`);
893
+ console.error(`Unknown peer: ${args.peer}.`);
894
+ if (source === "daemon") {
895
+ console.error(`Live peers from daemon:`);
896
+ for (const p of peers) {
897
+ console.error(` ${p.name} (${p.virtualIp})`);
898
+ }
899
+ }
900
+ else {
901
+ console.error(`Daemon is down — start it with 'agentnet up' (dora populates IPAM automatically),`);
902
+ console.error(`or add the peer manually via 'agentnet ipam assign'.`);
903
+ }
890
904
  process.exit(1);
891
905
  }
892
906
  const port = config.proxy?.port ?? 8888;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
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",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@decentnetwork/dora": "^0.1.0",
77
- "@decentnetwork/peer": "^0.1.17",
77
+ "@decentnetwork/peer": "^0.1.18",
78
78
  "js-yaml": "^4.1.0",
79
79
  "yargs": "^17.7.2"
80
80
  },