apertodns 1.0.1 → 1.2.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.
Files changed (4) hide show
  1. package/README.md +190 -9
  2. package/index.js +817 -206
  3. package/package.json +58 -49
  4. package/utils.js +151 -14
package/README.md CHANGED
@@ -1,31 +1,61 @@
1
- # ApertoDNS
1
+ # ApertoDNS CLI
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/apertodns.svg)](https://www.npmjs.com/package/apertodns)
4
- [![license](https://img.shields.io/npm/l/apertodns.svg)](https://github.com/apertonetwork/apertodns/blob/main/LICENSE)
4
+ [![npm downloads](https://img.shields.io/npm/dm/apertodns.svg)](https://www.npmjs.com/package/apertodns)
5
+ [![license](https://img.shields.io/npm/l/apertodns.svg)](https://github.com/1r0n3d3v3l0per/apertodns/blob/main/LICENSE)
5
6
  [![node](https://img.shields.io/node/v/apertodns.svg)](https://nodejs.org)
6
7
 
7
- **Dynamic DNS management from your terminal.** Manage domains, tokens, and DNS updates with style.
8
+ **Dynamic DNS management from your terminal.** Manage domains, tokens, API keys, and DNS updates with style.
8
9
 
9
- ApertoDNS is a free Dynamic DNS service that lets you point a subdomain to your dynamic IP address. Perfect for home servers, IoT devices, game servers, and remote access.
10
+ ApertoDNS is a free Dynamic DNS service that lets you point a subdomain to your dynamic IP address. Perfect for home servers, IoT devices, game servers, NAS systems, and remote access.
11
+
12
+ ## Why ApertoDNS?
13
+
14
+ | Feature | ApertoDNS | No-IP | DuckDNS | Dynu |
15
+ |---------|-----------|-------|---------|------|
16
+ | Free subdomains | Unlimited | 1 (free) | 5 | 4 |
17
+ | API Keys with scopes | Yes | No | No | Limited |
18
+ | CLI tool | Yes | No | No | No |
19
+ | IPv6 support | Yes | Paid | Yes | Yes |
20
+ | No forced renewal | Yes | 30 days | Yes | Yes |
21
+ | DynDNS2 compatible | Yes | Yes | No | Yes |
22
+ | Webhooks | Yes | No | No | No |
23
+ | Team sharing | Yes | No | No | No |
10
24
 
11
25
  ## Features
12
26
 
13
27
  - **Easy Setup** - Login or register directly from CLI
14
28
  - **Multiple Domains** - Manage unlimited subdomains
15
- - **Auto Updates** - Set up cron for automatic IP updates
29
+ - **API Keys** - Create and manage API keys with granular scopes
30
+ - **Auto Updates** - Set up cron or daemon mode for automatic IP updates
16
31
  - **Interactive Mode** - Beautiful terminal UI with menus
32
+ - **JSON Output** - Machine-readable output for scripting
17
33
  - **IPv4 & IPv6** - Full dual-stack support
18
34
  - **Real-time Stats** - View usage statistics and logs
35
+ - **Router/NAS Compatible** - Works with Synology, QNAP, and DynDNS2-compatible routers
19
36
 
20
37
  ## Requirements
21
38
 
22
39
  - Node.js 18.0.0 or higher
23
- - An ApertoDNS account ([register free](https://apertodns.com))
40
+ - An ApertoDNS account ([register free](https://apertodns.com/register))
24
41
 
25
42
  ## Installation
26
43
 
27
44
  ```bash
45
+ # npm
28
46
  npm install -g apertodns
47
+
48
+ # yarn
49
+ yarn global add apertodns
50
+
51
+ # pnpm
52
+ pnpm add -g apertodns
53
+ ```
54
+
55
+ Or use without installing:
56
+
57
+ ```bash
58
+ npx apertodns --help
29
59
  ```
30
60
 
31
61
  ## Quick Start
@@ -55,6 +85,7 @@ apertodns --force
55
85
  | `--tokens` | List all your tokens |
56
86
  | `--stats` | Statistics and metrics |
57
87
  | `--logs` | Recent activity logs |
88
+ | `--my-ip` | Show your current public IP |
58
89
 
59
90
  ### Domain Management
60
91
 
@@ -73,14 +104,42 @@ apertodns --force
73
104
  | `--toggle <id>` | Toggle token state |
74
105
  | `--verify` | Verify token validity |
75
106
 
107
+ ### API Keys
108
+
109
+ | Command | Description |
110
+ |---------|-------------|
111
+ | `--api-keys` | List all API keys |
112
+ | `--create-api-key <name>` | Create new API key |
113
+ | `--delete-api-key <id>` | Delete an API key |
114
+ | `--scopes` | Show available scopes |
115
+ | `--api-key <key>` | Use API key for authentication |
116
+
76
117
  ### Configuration
77
118
 
78
119
  | Command | Description |
79
120
  |---------|-------------|
80
121
  | `--setup` | Guided setup (login/register) |
81
122
  | `--status` | Show current status and IP |
123
+ | `--config` | Edit configuration |
124
+ | `--logout` | Remove local configuration |
82
125
  | `--force` | Force DNS update now |
126
+
127
+ ### Daemon Mode
128
+
129
+ | Command | Description |
130
+ |---------|-------------|
131
+ | `--daemon` | Start daemon mode (continuous updates) |
132
+ | `--interval <sec>` | Update interval (default: 300s) |
133
+
134
+ ### Options
135
+
136
+ | Option | Description |
137
+ |--------|-------------|
83
138
  | `--cron` | Silent mode for cron jobs |
139
+ | `--quiet` | Hide banner |
140
+ | `--json` | JSON output (machine-readable) |
141
+ | `-v, --version` | Show version |
142
+ | `-h, --help` | Show help |
84
143
 
85
144
  ## Interactive Mode
86
145
 
@@ -90,6 +149,41 @@ Run `apertodns` without arguments for an interactive menu with all options.
90
149
  apertodns
91
150
  ```
92
151
 
152
+ ## Authentication Methods
153
+
154
+ You can authenticate in 3 ways:
155
+
156
+ 1. **Interactive Login** - Run `apertodns --setup` (saves JWT to ~/.config/apertodns/)
157
+ 2. **API Key** - Use `--api-key <key>` for single operations
158
+ 3. **Environment Variable** - Set `APERTODNS_API_KEY`
159
+
160
+ ## JSON Output
161
+
162
+ All commands support `--json` flag for machine-readable output:
163
+
164
+ ```bash
165
+ # Get domains as JSON
166
+ apertodns --domains --json
167
+
168
+ # Get your IP as JSON
169
+ apertodns --my-ip --json
170
+
171
+ # Combine with API key for scripting
172
+ apertodns --api-key ak_xxx... --domains --json
173
+ ```
174
+
175
+ ## Daemon Mode
176
+
177
+ Run continuously to keep your DNS updated:
178
+
179
+ ```bash
180
+ # Default interval (5 minutes)
181
+ apertodns --daemon
182
+
183
+ # Custom interval (60 seconds)
184
+ apertodns --daemon --interval 60
185
+ ```
186
+
93
187
  ## Automatic Updates (Cron)
94
188
 
95
189
  Set up automatic IP updates with cron:
@@ -111,22 +205,109 @@ ApertoDNS is compatible with routers that support DynDNS2 protocol:
111
205
  ```
112
206
  Server: api.apertodns.com
113
207
  Protocol: DynDNS2
208
+ Path: /nic/update
114
209
  Username: your-token
115
210
  Password: your-token
116
211
  Hostname: yourdomain.apertodns.com
117
212
  ```
118
213
 
214
+ ### Compatible Devices
215
+
216
+ - **Routers**: ASUS, TP-Link, Netgear, Ubiquiti, pfSense, OPNsense, DD-WRT, OpenWRT
217
+ - **NAS**: Synology DSM, QNAP QTS, TrueNAS
218
+ - **Other**: Any device supporting DynDNS2/DynDNS protocol
219
+
220
+ ## Configuration Storage
221
+
222
+ Configuration is stored in platform-specific locations:
223
+
224
+ - **Linux**: `~/.config/apertodns/` or `~/.apertodns/`
225
+ - **macOS**: `~/.config/apertodns/`
226
+ - **Windows**: `%APPDATA%\apertodns\`
227
+
228
+ ## Troubleshooting
229
+
230
+ ### Common Issues
231
+
232
+ **"Unable to detect IP address"**
233
+ - Check your internet connection
234
+ - Try a different IP detection service: the CLI automatically tries multiple fallbacks
235
+ - If behind a corporate proxy, the detected IP may be the proxy's IP
236
+
237
+ **"Authentication failed"**
238
+ - Run `apertodns --logout` then `apertodns --setup` to re-authenticate
239
+ - If using API key, verify it has the required scopes
240
+ - Check if the token/API key is still active in your dashboard
241
+
242
+ **"DNS not updating"**
243
+ - Use `apertodns --force` to force an immediate update
244
+ - Check `apertodns --status` to see current IP vs DNS IP
245
+ - DNS propagation can take up to 5 minutes
246
+
247
+ **IPv6 not working**
248
+ - IPv6 requires your ISP and network to support it
249
+ - Use `apertodns --my-ip --json` to check if IPv6 is detected
250
+ - Some networks only provide IPv4
251
+
252
+ **Permission denied on Linux**
253
+ - If installed globally, you may need sudo: `sudo npm install -g apertodns`
254
+ - Or use a Node version manager (nvm) to avoid permission issues
255
+
256
+ **Daemon mode exits unexpectedly**
257
+ - Check logs in `/var/log/apertodns.log` if using cron
258
+ - Ensure stable internet connection
259
+ - Consider using a process manager like PM2 or systemd
260
+
261
+ ### Getting Help
262
+
263
+ ```bash
264
+ # Show all commands
265
+ apertodns --help
266
+
267
+ # Check current status
268
+ apertodns --status
269
+
270
+ # Verify authentication
271
+ apertodns --verify
272
+ ```
273
+
274
+ ## Security
275
+
276
+ - Credentials are stored locally, never transmitted except to ApertoDNS servers
277
+ - API keys support granular scopes for least-privilege access
278
+ - All API communication uses HTTPS
279
+ - No cross-account data access - strict user isolation
280
+
281
+ ## Examples
282
+
283
+ ```bash
284
+ # Quick status check
285
+ apertodns --status
286
+
287
+ # Test DNS propagation
288
+ apertodns --test myserver.apertodns.com
289
+
290
+ # Create domain and get token
291
+ apertodns --add-domain newserver.apertodns.com
292
+
293
+ # List domains as JSON
294
+ apertodns --domains --json
295
+
296
+ # Use API key for automation
297
+ APERTODNS_API_KEY=ak_xxx... apertodns --domains --json
298
+ ```
299
+
119
300
  ## Links
120
301
 
121
302
  - **Website**: [apertodns.com](https://apertodns.com)
122
303
  - **Dashboard**: [apertodns.com/dashboard](https://apertodns.com/dashboard)
123
- - **API Docs**: [apertodns.com/docs](https://apertodns.com/docs)
124
- - **Issues**: [GitHub Issues](https://github.com/apertonetwork/apertodns/issues)
304
+ - **Documentation**: [apertodns.com/docs](https://apertodns.com/docs)
305
+ - **Issues**: [GitHub Issues](https://github.com/1r0n3d3v3l0per/apertodns/issues)
125
306
 
126
307
  ## Support
127
308
 
128
309
  Need help?
129
- - Open an issue on [GitHub](https://github.com/apertonetwork/apertodns/issues)
310
+ - Open an issue on [GitHub](https://github.com/1r0n3d3v3l0per/apertodns/issues)
130
311
  - Email: support@apertodns.com
131
312
 
132
313
  ## License