apertodns 1.0.0 → 1.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.
Files changed (4) hide show
  1. package/README.md +190 -17
  2. package/index.js +817 -206
  3. package/package.json +58 -49
  4. package/utils.js +151 -14
package/README.md CHANGED
@@ -1,6 +1,29 @@
1
1
  # ApertoDNS CLI
2
2
 
3
- Dynamic DNS management from your terminal. Manage domains, tokens, and DNS updates with style.
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/1r0n3d3v3l0per/apertodns/blob/main/LICENSE)
5
+ [![node](https://img.shields.io/node/v/apertodns.svg)](https://nodejs.org)
6
+
7
+ **Dynamic DNS management from your terminal.** Manage domains, tokens, API keys, and DNS updates with style.
8
+
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, NAS systems, and remote access.
10
+
11
+ ## Features
12
+
13
+ - **Easy Setup** - Login or register directly from CLI
14
+ - **Multiple Domains** - Manage unlimited subdomains
15
+ - **API Keys** - Create and manage API keys with granular scopes
16
+ - **Auto Updates** - Set up cron or daemon mode for automatic IP updates
17
+ - **Interactive Mode** - Beautiful terminal UI with menus
18
+ - **JSON Output** - Machine-readable output for scripting
19
+ - **IPv4 & IPv6** - Full dual-stack support
20
+ - **Real-time Stats** - View usage statistics and logs
21
+ - **Router/NAS Compatible** - Works with Synology, QNAP, and DynDNS2-compatible routers
22
+
23
+ ## Requirements
24
+
25
+ - Node.js 18.0.0 or higher
26
+ - An ApertoDNS account ([register free](https://apertodns.com/register))
4
27
 
5
28
  ## Installation
6
29
 
@@ -8,28 +31,32 @@ Dynamic DNS management from your terminal. Manage domains, tokens, and DNS updat
8
31
  npm install -g apertodns
9
32
  ```
10
33
 
34
+ Or use without installing:
35
+
36
+ ```bash
37
+ npx apertodns --help
38
+ ```
39
+
11
40
  ## Quick Start
12
41
 
13
42
  ```bash
14
- # Setup (login or register)
43
+ # 1. Setup (login or register)
15
44
  apertodns --setup
16
45
 
17
- # View dashboard
46
+ # 2. View your dashboard
18
47
  apertodns --dashboard
19
48
 
20
- # List your domains
49
+ # 3. List your domains
21
50
  apertodns --domains
22
51
 
23
- # Add a new domain
24
- apertodns --add-domain myserver.apertodns.com
25
-
26
- # Test DNS resolution
27
- apertodns --test google.com
52
+ # 4. Force DNS update
53
+ apertodns --force
28
54
  ```
29
55
 
30
56
  ## Commands
31
57
 
32
58
  ### Main Commands
59
+
33
60
  | Command | Description |
34
61
  |---------|-------------|
35
62
  | `--dashboard` | Complete dashboard with all info |
@@ -37,39 +64,185 @@ apertodns --test google.com
37
64
  | `--tokens` | List all your tokens |
38
65
  | `--stats` | Statistics and metrics |
39
66
  | `--logs` | Recent activity logs |
67
+ | `--my-ip` | Show your current public IP |
40
68
 
41
69
  ### Domain Management
70
+
42
71
  | Command | Description |
43
72
  |---------|-------------|
44
- | `--add-domain <name>` | Create a new domain |
73
+ | `--add-domain <name>` | Create a new subdomain |
45
74
  | `--delete-domain` | Delete a domain (interactive) |
46
75
  | `--test <domain>` | Test DNS resolution |
47
76
 
48
77
  ### Token Management
78
+
49
79
  | Command | Description |
50
80
  |---------|-------------|
51
81
  | `--enable <id>` | Enable a token |
52
82
  | `--disable <id>` | Disable a token |
53
83
  | `--toggle <id>` | Toggle token state |
84
+ | `--verify` | Verify token validity |
85
+
86
+ ### API Keys
87
+
88
+ | Command | Description |
89
+ |---------|-------------|
90
+ | `--api-keys` | List all API keys |
91
+ | `--create-api-key <name>` | Create new API key |
92
+ | `--delete-api-key <id>` | Delete an API key |
93
+ | `--scopes` | Show available scopes |
94
+ | `--api-key <key>` | Use API key for authentication |
54
95
 
55
96
  ### Configuration
97
+
56
98
  | Command | Description |
57
99
  |---------|-------------|
58
100
  | `--setup` | Guided setup (login/register) |
59
- | `--status` | Show current status |
60
- | `--force` | Force DNS update |
101
+ | `--status` | Show current status and IP |
102
+ | `--config` | Edit configuration |
103
+ | `--logout` | Remove local configuration |
104
+ | `--force` | Force DNS update now |
105
+
106
+ ### Daemon Mode
107
+
108
+ | Command | Description |
109
+ |---------|-------------|
110
+ | `--daemon` | Start daemon mode (continuous updates) |
111
+ | `--interval <sec>` | Update interval (default: 300s) |
112
+
113
+ ### Options
114
+
115
+ | Option | Description |
116
+ |--------|-------------|
117
+ | `--cron` | Silent mode for cron jobs |
118
+ | `--quiet` | Hide banner |
119
+ | `--json` | JSON output (machine-readable) |
120
+ | `-v, --version` | Show version |
121
+ | `-h, --help` | Show help |
61
122
 
62
123
  ## Interactive Mode
63
124
 
64
- Run `apertodns` without arguments for interactive menu.
125
+ Run `apertodns` without arguments for an interactive menu with all options.
126
+
127
+ ```bash
128
+ apertodns
129
+ ```
130
+
131
+ ## Authentication Methods
132
+
133
+ You can authenticate in 3 ways:
134
+
135
+ 1. **Interactive Login** - Run `apertodns --setup` (saves JWT to ~/.config/apertodns/)
136
+ 2. **API Key** - Use `--api-key <key>` for single operations
137
+ 3. **Environment Variable** - Set `APERTODNS_API_KEY`
138
+
139
+ ## JSON Output
65
140
 
66
- ## Cron Setup
141
+ All commands support `--json` flag for machine-readable output:
67
142
 
68
143
  ```bash
69
- # Every 5 minutes
70
- */5 * * * * apertodns --cron
144
+ # Get domains as JSON
145
+ apertodns --domains --json
146
+
147
+ # Get your IP as JSON
148
+ apertodns --my-ip --json
149
+
150
+ # Combine with API key for scripting
151
+ apertodns --api-key ak_xxx... --domains --json
71
152
  ```
72
153
 
154
+ ## Daemon Mode
155
+
156
+ Run continuously to keep your DNS updated:
157
+
158
+ ```bash
159
+ # Default interval (5 minutes)
160
+ apertodns --daemon
161
+
162
+ # Custom interval (60 seconds)
163
+ apertodns --daemon --interval 60
164
+ ```
165
+
166
+ ## Automatic Updates (Cron)
167
+
168
+ Set up automatic IP updates with cron:
169
+
170
+ ```bash
171
+ # Update every 5 minutes
172
+ */5 * * * * /usr/local/bin/apertodns --cron >> /var/log/apertodns.log 2>&1
173
+
174
+ # Or every minute for faster updates
175
+ * * * * * /usr/local/bin/apertodns --cron
176
+ ```
177
+
178
+ Find your apertodns path with: `which apertodns`
179
+
180
+ ## Router Integration (DynDNS2)
181
+
182
+ ApertoDNS is compatible with routers that support DynDNS2 protocol:
183
+
184
+ ```
185
+ Server: api.apertodns.com
186
+ Protocol: DynDNS2
187
+ Path: /nic/update
188
+ Username: your-token
189
+ Password: your-token
190
+ Hostname: yourdomain.apertodns.com
191
+ ```
192
+
193
+ ### Compatible Devices
194
+
195
+ - **Routers**: ASUS, TP-Link, Netgear, Ubiquiti, pfSense, OPNsense, DD-WRT, OpenWRT
196
+ - **NAS**: Synology DSM, QNAP QTS, TrueNAS
197
+ - **Other**: Any device supporting DynDNS2/DynDNS protocol
198
+
199
+ ## Configuration Storage
200
+
201
+ Configuration is stored in platform-specific locations:
202
+
203
+ - **Linux**: `~/.config/apertodns/` or `~/.apertodns/`
204
+ - **macOS**: `~/.config/apertodns/`
205
+ - **Windows**: `%APPDATA%\apertodns\`
206
+
207
+ ## Security
208
+
209
+ - Credentials are stored locally, never transmitted except to ApertoDNS servers
210
+ - API keys support granular scopes for least-privilege access
211
+ - All API communication uses HTTPS
212
+ - No cross-account data access - strict user isolation
213
+
214
+ ## Examples
215
+
216
+ ```bash
217
+ # Quick status check
218
+ apertodns --status
219
+
220
+ # Test DNS propagation
221
+ apertodns --test myserver.apertodns.com
222
+
223
+ # Create domain and get token
224
+ apertodns --add-domain newserver.apertodns.com
225
+
226
+ # List domains as JSON
227
+ apertodns --domains --json
228
+
229
+ # Use API key for automation
230
+ APERTODNS_API_KEY=ak_xxx... apertodns --domains --json
231
+ ```
232
+
233
+ ## Links
234
+
235
+ - **Website**: [apertodns.com](https://apertodns.com)
236
+ - **Dashboard**: [apertodns.com/dashboard](https://apertodns.com/dashboard)
237
+ - **Documentation**: [apertodns.com/docs](https://apertodns.com/docs)
238
+ - **Issues**: [GitHub Issues](https://github.com/1r0n3d3v3l0per/apertodns/issues)
239
+
240
+ ## Support
241
+
242
+ Need help?
243
+ - Open an issue on [GitHub](https://github.com/1r0n3d3v3l0per/apertodns/issues)
244
+ - Email: support@apertodns.com
245
+
73
246
  ## License
74
247
 
75
- MIT - Aperto Network
248
+ MIT - [Aperto Network](https://apertodns.com)