@decentnetwork/lan 0.1.0
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/LICENSE +31 -0
- package/README.md +296 -0
- 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/acl/acl-engine.d.ts +43 -0
- package/dist/acl/acl-engine.js +189 -0
- package/dist/acl/audit.d.ts +70 -0
- package/dist/acl/audit.js +144 -0
- package/dist/acl/index.d.ts +4 -0
- package/dist/acl/index.js +3 -0
- package/dist/acl/policy.d.ts +31 -0
- package/dist/acl/policy.js +102 -0
- package/dist/acl/types.d.ts +18 -0
- package/dist/acl/types.js +4 -0
- package/dist/carrier/frame.d.ts +18 -0
- package/dist/carrier/frame.js +66 -0
- package/dist/carrier/index.d.ts +5 -0
- package/dist/carrier/index.js +4 -0
- package/dist/carrier/packet-session.d.ts +32 -0
- package/dist/carrier/packet-session.js +151 -0
- package/dist/carrier/peer-manager.d.ts +113 -0
- package/dist/carrier/peer-manager.js +392 -0
- package/dist/carrier/types.d.ts +10 -0
- package/dist/carrier/types.js +11 -0
- package/dist/cli/commands.d.ts +223 -0
- package/dist/cli/commands.js +932 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +196 -0
- package/dist/config/loader.d.ts +10 -0
- package/dist/config/loader.js +152 -0
- package/dist/daemon/index.d.ts +1 -0
- package/dist/daemon/index.js +1 -0
- package/dist/daemon/ipc.d.ts +60 -0
- package/dist/daemon/ipc.js +144 -0
- package/dist/daemon/server.d.ts +63 -0
- package/dist/daemon/server.js +510 -0
- package/dist/dns/index.d.ts +1 -0
- package/dist/dns/index.js +1 -0
- package/dist/dns/resolver.d.ts +44 -0
- package/dist/dns/resolver.js +82 -0
- package/dist/dns/server.d.ts +70 -0
- package/dist/dns/server.js +393 -0
- package/dist/dora/dora-integration.d.ts +90 -0
- package/dist/dora/dora-integration.js +325 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +15 -0
- package/dist/ipam/index.d.ts +1 -0
- package/dist/ipam/index.js +1 -0
- package/dist/ipam/ipam.d.ts +99 -0
- package/dist/ipam/ipam.js +254 -0
- package/dist/proxy/connect-proxy.d.ts +78 -0
- package/dist/proxy/connect-proxy.js +204 -0
- package/dist/router/index.d.ts +5 -0
- package/dist/router/index.js +4 -0
- package/dist/router/ip-parser.d.ts +36 -0
- package/dist/router/ip-parser.js +127 -0
- package/dist/router/packet-router.d.ts +49 -0
- package/dist/router/packet-router.js +251 -0
- package/dist/router/session-manager.d.ts +50 -0
- package/dist/router/session-manager.js +138 -0
- package/dist/router/types.d.ts +21 -0
- package/dist/router/types.js +6 -0
- package/dist/tun/index.d.ts +3 -0
- package/dist/tun/index.js +2 -0
- package/dist/tun/route-manager.d.ts +59 -0
- package/dist/tun/route-manager.js +353 -0
- package/dist/tun/tun-device.d.ts +45 -0
- package/dist/tun/tun-device.js +265 -0
- package/dist/tun/types.d.ts +28 -0
- package/dist/tun/types.js +4 -0
- package/dist/types.d.ts +176 -0
- package/dist/types.js +4 -0
- package/dist/utils/logger.d.ts +20 -0
- package/dist/utils/logger.js +43 -0
- package/docs/CONFIGURATION.md +197 -0
- package/docs/INSTALL.md +145 -0
- package/package.json +93 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command handlers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Initialize ~/.agentnet directory and config
|
|
6
|
+
*/
|
|
7
|
+
export declare function cmdInit(args: {
|
|
8
|
+
name?: string;
|
|
9
|
+
configDir?: string;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Show identity information.
|
|
13
|
+
* Loads (or creates) keypair without joining network — fast and offline.
|
|
14
|
+
*/
|
|
15
|
+
export declare function cmdIdentityShow(args: {
|
|
16
|
+
configDir?: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* List peers from IPAM
|
|
20
|
+
*/
|
|
21
|
+
export declare function cmdPeersList(args: {
|
|
22
|
+
configDir?: string;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Assign a virtual IP to a Carrier ID
|
|
26
|
+
*/
|
|
27
|
+
export declare function cmdIpamAssign(args: {
|
|
28
|
+
peer: string;
|
|
29
|
+
ip?: string;
|
|
30
|
+
name: string;
|
|
31
|
+
services?: string[];
|
|
32
|
+
configDir?: string;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Grant access to a peer.
|
|
36
|
+
* Default direction is "both" so TCP return packets are allowed.
|
|
37
|
+
*/
|
|
38
|
+
export declare function cmdGrant(args: {
|
|
39
|
+
peer: string;
|
|
40
|
+
tcp?: number[];
|
|
41
|
+
udp?: number[];
|
|
42
|
+
expires?: string;
|
|
43
|
+
purpose?: string;
|
|
44
|
+
direction?: "inbound" | "outbound" | "both";
|
|
45
|
+
configDir?: string;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Revoke access from a peer
|
|
49
|
+
*/
|
|
50
|
+
export declare function cmdRevoke(args: {
|
|
51
|
+
peer: string;
|
|
52
|
+
configDir?: string;
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Resolve a hostname to a virtual IP
|
|
56
|
+
*/
|
|
57
|
+
export declare function cmdResolve(args: {
|
|
58
|
+
name: string;
|
|
59
|
+
configDir?: string;
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Show daemon status (must be run while daemon is up — placeholder for now)
|
|
63
|
+
*/
|
|
64
|
+
export declare function cmdStatus(args: {
|
|
65
|
+
configDir?: string;
|
|
66
|
+
}): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Start the daemon (foreground)
|
|
69
|
+
*/
|
|
70
|
+
export declare function cmdUp(args: {
|
|
71
|
+
name?: string;
|
|
72
|
+
configDir?: string;
|
|
73
|
+
realTun?: boolean;
|
|
74
|
+
}): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Send a friend request to another peer's address.
|
|
77
|
+
* Run while daemon is DOWN — opens a temporary peer, sends request, exits.
|
|
78
|
+
* The request is delivered via Carrier express relay (HTTP store-and-forward)
|
|
79
|
+
* AND via onion routing if recipient is announced on the DHT.
|
|
80
|
+
*/
|
|
81
|
+
export declare function cmdFriendRequest(args: {
|
|
82
|
+
address: string;
|
|
83
|
+
hello?: string;
|
|
84
|
+
configDir?: string;
|
|
85
|
+
waitMs?: number;
|
|
86
|
+
}): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Accept a pending friend request.
|
|
89
|
+
* Run while daemon is DOWN — opens a temporary peer, accepts, exits.
|
|
90
|
+
*
|
|
91
|
+
* IMPORTANT: This must be running for the friend request to be delivered
|
|
92
|
+
* via onion routing. The peer must announce itself on the DHT first
|
|
93
|
+
* (this takes ~45s), then wait for the request to arrive.
|
|
94
|
+
*/
|
|
95
|
+
export declare function cmdFriendAccept(args: {
|
|
96
|
+
pubkey?: string;
|
|
97
|
+
waitForRequest?: boolean;
|
|
98
|
+
waitMs?: number;
|
|
99
|
+
configDir?: string;
|
|
100
|
+
}): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* List friends in the friend store.
|
|
103
|
+
*/
|
|
104
|
+
export declare function cmdFriendsList(args: {
|
|
105
|
+
configDir?: string;
|
|
106
|
+
}): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Show audit log
|
|
109
|
+
*/
|
|
110
|
+
export declare function cmdAuditLog(args: {
|
|
111
|
+
tail?: number;
|
|
112
|
+
configDir?: string;
|
|
113
|
+
}): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Enable the built-in CONNECT proxy.
|
|
116
|
+
* Persists `proxy.enabled = true` in config.yaml. Takes effect on next
|
|
117
|
+
* `agentnet up`. If port is provided, updates the listener port.
|
|
118
|
+
*/
|
|
119
|
+
export declare function cmdProxyEnable(args: {
|
|
120
|
+
port?: number;
|
|
121
|
+
configDir?: string;
|
|
122
|
+
}): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Disable the built-in CONNECT proxy.
|
|
125
|
+
* Sets `proxy.enabled = false`. Existing tunnels are torn down on next
|
|
126
|
+
* daemon restart.
|
|
127
|
+
*/
|
|
128
|
+
export declare function cmdProxyDisable(args: {
|
|
129
|
+
configDir?: string;
|
|
130
|
+
}): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Show proxy status from config.yaml.
|
|
133
|
+
*/
|
|
134
|
+
export declare function cmdProxyStatus(args: {
|
|
135
|
+
configDir?: string;
|
|
136
|
+
}): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Add a host glob to the proxy allowlist.
|
|
139
|
+
*/
|
|
140
|
+
export declare function cmdProxyAllowHost(args: {
|
|
141
|
+
host: string;
|
|
142
|
+
configDir?: string;
|
|
143
|
+
}): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Remove a host glob from the proxy allowlist.
|
|
146
|
+
*/
|
|
147
|
+
export declare function cmdProxyRevokeHost(args: {
|
|
148
|
+
host: string;
|
|
149
|
+
configDir?: string;
|
|
150
|
+
}): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* List proxy allow-host globs.
|
|
153
|
+
*/
|
|
154
|
+
export declare function cmdProxyListHosts(args: {
|
|
155
|
+
configDir?: string;
|
|
156
|
+
}): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Print the env-var line for a peer to use this node's proxy.
|
|
159
|
+
*/
|
|
160
|
+
export declare function cmdProxyUse(args: {
|
|
161
|
+
peer: string;
|
|
162
|
+
configDir?: string;
|
|
163
|
+
}): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Parse duration string like "1h", "24h", "30m"
|
|
166
|
+
*/
|
|
167
|
+
declare function parseDuration(input: string): number;
|
|
168
|
+
export { parseDuration };
|
|
169
|
+
/**
|
|
170
|
+
* Install (or remove) OS-side resolver config so `<name>.<dnsDomain>`
|
|
171
|
+
* queries get routed to the daemon's DNS server on
|
|
172
|
+
* 127.0.0.1:<dnsPort>. macOS uses /etc/resolver/<domain>; Linux uses
|
|
173
|
+
* systemd-resolved's per-link config via `resolvectl`. Idempotent;
|
|
174
|
+
* `--uninstall` reverses it.
|
|
175
|
+
*
|
|
176
|
+
* Requires root on both platforms (file write to /etc, or root-only
|
|
177
|
+
* resolvectl). The shipped error tells the operator if so.
|
|
178
|
+
*/
|
|
179
|
+
export declare function cmdDnsInstall(args: {
|
|
180
|
+
uninstall?: boolean;
|
|
181
|
+
configDir?: string;
|
|
182
|
+
}): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* Print /etc/hosts entries for the current IPAM contents. Stopgap
|
|
185
|
+
* for OSes / setups where the resolver wiring is awkward — pipe to
|
|
186
|
+
* `sudo tee -a /etc/hosts`.
|
|
187
|
+
*/
|
|
188
|
+
export declare function cmdDnsHosts(args: {
|
|
189
|
+
configDir?: string;
|
|
190
|
+
}): Promise<void>;
|
|
191
|
+
/**
|
|
192
|
+
* Query the running daemon for a JSON-formatted snapshot of its state.
|
|
193
|
+
* Useful when packets aren't moving and you want to see forwarding
|
|
194
|
+
* counters, friend status, and IPAM contents without restarting the
|
|
195
|
+
* daemon with AGENTNET_LOG_LEVEL=debug.
|
|
196
|
+
*/
|
|
197
|
+
export declare function cmdDiag(args: {
|
|
198
|
+
configDir?: string;
|
|
199
|
+
}): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Enable dora integration and add a dora server's userid to the
|
|
202
|
+
* registry list. Subsequent `agentnet up` runs will register with
|
|
203
|
+
* dora to get a virtual IP and fetch the peer roster automatically.
|
|
204
|
+
*/
|
|
205
|
+
export declare function cmdDoraEnable(args: {
|
|
206
|
+
userid: string;
|
|
207
|
+
configDir?: string;
|
|
208
|
+
}): Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Disable dora integration without losing the configured server list.
|
|
211
|
+
* Daemon falls back to manual ipam.yaml mode.
|
|
212
|
+
*/
|
|
213
|
+
export declare function cmdDoraDisable(args: {
|
|
214
|
+
configDir?: string;
|
|
215
|
+
}): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Show dora config. Live runtime state (currently-allocated IP,
|
|
218
|
+
* last roster refresh) would require IPC to the running daemon —
|
|
219
|
+
* not wired yet.
|
|
220
|
+
*/
|
|
221
|
+
export declare function cmdDoraStatus(args: {
|
|
222
|
+
configDir?: string;
|
|
223
|
+
}): Promise<void>;
|