lanet 0.3.0 → 0.4.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.
data/index.html CHANGED
@@ -7,122 +7,155 @@
7
7
  <style>
8
8
  body {
9
9
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
10
- line-height: 1.6;
11
- color: #333;
12
- max-width: 960px;
13
- margin: 0 auto;
10
+ line-height: 1.7; /* Increased line height for better readability */
11
+ color: #34495e; /* Darker, more professional text color */
12
+ max-width: 980px; /* Slightly wider max width for content */
13
+ margin: 20px auto; /* Added top and bottom margin for better spacing */
14
14
  padding: 20px;
15
- background-color: #f9f9f9;
15
+ background-color: #f4f6f9; /* Lighter background color */
16
16
  }
17
17
  h1 {
18
- color: #2c3e50;
19
- border-bottom: 2px solid #3498db;
20
- padding-bottom: 10px;
18
+ color: #34495e; /* Darker heading color */
19
+ border-bottom: 3px solid #3498db; /* Thicker border */
20
+ padding-bottom: 12px; /* Increased padding */
21
+ letter-spacing: -0.5px; /* Slightly tighter letter spacing for headings */
21
22
  }
22
23
  h2 {
23
- color: #2980b9;
24
- margin-top: 30px;
24
+ color: #3498db; /* Primary blue color for subheadings */
25
+ margin-top: 35px; /* Increased top margin */
26
+ margin-bottom: 10px; /* Added bottom margin */
25
27
  }
26
28
  h3 {
27
- color: #16a085;
28
- margin-top: 25px;
29
+ color: #2ecc71; /* Vibrant green for section titles */
30
+ margin-top: 30px;
31
+ margin-bottom: 8px;
29
32
  }
30
33
  h4 {
31
- color: #27ae60;
32
- margin-top: 20px;
34
+ color: #34495e; /* Darker color for sub-subheadings */
35
+ margin-top: 25px;
36
+ margin-bottom: 5px;
37
+ }
38
+ p {
39
+ margin-bottom: 15px; /* Increased paragraph spacing */
40
+ color: #555; /* Slightly softer paragraph text color */
41
+ }
42
+ ul, ol {
43
+ margin-bottom: 15px;
44
+ color: #555;
33
45
  }
34
46
  pre {
35
- background-color: #f8f8f8;
36
- border: 1px solid #ddd;
37
- border-left: 3px solid #3498db;
38
- padding: 15px;
47
+ background-color: #f0f0f0; /* Slightly darker pre background */
48
+ border: 1px solid #ccc; /* Lighter border */
49
+ border-left: 5px solid #3498db; /* Thicker, more prominent left border */
50
+ padding: 16px; /* Increased padding */
39
51
  overflow-x: auto;
40
- border-radius: 4px;
52
+ border-radius: 6px; /* More rounded corners */
53
+ font-size: 0.95em; /* Slightly smaller font size in code blocks */
41
54
  }
42
55
  code {
43
56
  font-family: 'Courier New', Courier, monospace;
57
+ color: #2c3e50; /* Darker code text color */
44
58
  }
45
59
  .container {
46
60
  background-color: #fff;
47
- border-radius: 8px;
48
- box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
49
- padding: 30px;
61
+ border-radius: 10px; /* More rounded container corners */
62
+ box-shadow: 0 3px 20px rgba(0, 0, 0, 0.08); /* Softer, more subtle shadow */
63
+ padding: 40px; /* Increased container padding */
50
64
  }
51
65
  .feature {
52
- margin: 20px 0;
53
- padding-left: 20px;
54
- border-left: 4px solid #2ecc71;
66
+ margin: 25px 0; /* Increased feature margin */
67
+ padding-left: 25px; /* Increased padding */
68
+ border-left: 5px solid #2ecc71; /* Thicker feature border */
55
69
  }
56
70
  .security-feature {
57
71
  background-color: #e8f4fc;
58
- padding: 15px;
59
- margin: 10px 0;
60
- border-radius: 6px;
72
+ padding: 20px; /* Increased padding */
73
+ margin: 15px 0; /* Increased margin */
74
+ border-radius: 8px; /* More rounded corners */
75
+ }
76
+ .security-feature ul li {
77
+ margin-bottom: 8px; /* Spacing in security feature lists */
61
78
  }
62
79
  .cli-example {
63
80
  background-color: #2c3e50;
64
81
  color: #ecf0f1;
65
- padding: 12px 18px;
66
- margin: 10px 0;
67
- border-radius: 6px;
82
+ padding: 15px 20px; /* Increased padding */
83
+ margin: 15px 0; /* Increased margin */
84
+ border-radius: 8px; /* More rounded corners */
68
85
  font-family: 'Courier New', Courier, monospace;
69
86
  position: relative;
87
+ font-size: 0.95em; /* Slightly smaller font size in CLI examples */
70
88
  }
71
89
  .cli-example::before {
72
90
  content: "$";
73
91
  color: #3498db;
74
- margin-right: 10px;
92
+ margin-right: 12px; /* Increased margin */
75
93
  font-weight: bold;
94
+ display: inline-block; /* Ensure proper spacing */
95
+ width: 15px; /* Fixed width for the dollar sign to align commands */
96
+ text-align: right; /* Align dollar sign to the right */
76
97
  }
77
98
  .cli-section {
78
- margin-bottom: 30px;
99
+ margin-bottom: 40px; /* Increased bottom margin */
79
100
  background-color: #f8f9fa;
80
- padding: 20px;
81
- border-radius: 6px;
101
+ padding: 25px; /* Increased padding */
102
+ border-radius: 8px; /* More rounded corners */
82
103
  }
83
104
  .output-example {
84
105
  background-color: #f0f0f0;
85
- padding: 12px;
86
- margin: 10px 0;
87
- border-radius: 6px;
106
+ padding: 15px; /* Increased padding */
107
+ margin: 15px 0; /* Increased margin */
108
+ border-radius: 8px; /* More rounded corners */
88
109
  font-family: 'Courier New', Courier, monospace;
89
110
  font-size: 0.9em;
90
- border-left: 3px solid #9b59b6;
111
+ border-left: 5px solid #9b59b6; /* Thicker border */
91
112
  }
92
113
  .tab-container {
93
114
  border: 1px solid #ddd;
94
- border-radius: 6px;
115
+ border-radius: 8px; /* More rounded corners */
95
116
  overflow: hidden;
96
- margin: 20px 0;
117
+ margin: 25px 0; /* Increased margin */
97
118
  }
98
119
  .tab-buttons {
99
120
  display: flex;
100
121
  background-color: #f5f5f5;
122
+ border-bottom: 1px solid #ddd; /* Added bottom border to tab buttons container */
101
123
  }
102
124
  .tab-button {
103
- padding: 10px 20px;
125
+ padding: 12px 25px; /* Increased padding */
104
126
  background-color: transparent;
105
127
  border: none;
106
128
  cursor: pointer;
107
- border-right: 1px solid #ddd;
129
+ border-right: none; /* Removed right border */
108
130
  transition: background-color 0.3s;
131
+ font-weight: 500; /* Slightly bolder tab button text */
132
+ color: #777; /* Slightly muted tab button text color */
109
133
  }
110
- .tab-button:hover, .tab-button.active {
111
- background-color: #e0e0e0;
134
+ .tab-button:hover {
135
+ background-color: #f0f0f0; /* Lighter hover background */
136
+ color: #555; /* Darker hover text color */
137
+ }
138
+ .tab-button.active {
139
+ background-color: #fff; /* White background for active tab */
140
+ border-bottom: 3px solid #3498db; /* Underline for active tab */
141
+ color: #34495e; /* Darker text for active tab */
142
+ font-weight: bold; /* Bold text for active tab */
112
143
  }
113
144
  .tab-content {
114
145
  display: none;
115
- padding: 15px;
146
+ padding: 20px; /* Increased padding */
147
+ background-color: #fff; /* White background for tab content */
116
148
  }
117
149
  .tab-content.active {
118
150
  display: block;
119
151
  }
120
152
  .badge {
121
153
  display: inline-block;
122
- padding: 3px 8px;
123
- border-radius: 4px;
124
- font-size: 12px;
125
- font-weight: bold;
154
+ padding: 4px 10px; /* Increased badge padding */
155
+ border-radius: 6px; /* More rounded corners */
156
+ font-size: 13px; /* Slightly larger font size */
157
+ font-weight: 600; /* Bolder badge text */
158
+ letter-spacing: 0.5px; /* Added letter spacing */
126
159
  }
127
160
  .badge-new {
128
161
  background-color: #2ecc71;
@@ -130,10 +163,25 @@
130
163
  }
131
164
  .note {
132
165
  background-color: #fff8e1;
133
- padding: 12px;
134
- border-left: 4px solid #ffc107;
135
- margin: 10px 0;
136
- border-radius: 4px;
166
+ padding: 15px; /* Increased padding */
167
+ border-left: 5px solid #ffc107; /* Thicker border */
168
+ margin: 15px 0; /* Increased margin */
169
+ border-radius: 6px; /* More rounded corners */
170
+ }
171
+ .note strong {
172
+ font-weight: bold;
173
+ color: #333; /* Make "Note:" bold and slightly darker */
174
+ }
175
+ footer {
176
+ margin-top: 50px; /* Increased footer margin */
177
+ text-align: center;
178
+ color: #7f8c8d;
179
+ padding-top: 20px;
180
+ border-top: 1px solid #ddd; /* Added top border to footer */
181
+ }
182
+ footer p {
183
+ color: #95a5a6; /* Softer footer text color */
184
+ font-size: 0.9em; /* Smaller footer font size */
137
185
  }
138
186
  </style>
139
187
  </head>
@@ -141,18 +189,18 @@
141
189
  <div class="container">
142
190
  <h1>Lanet</h1>
143
191
  <p>A secure network communication library that enables reliable and protected message exchange between devices on the same network.</p>
144
-
192
+
145
193
  <h2>Key Features</h2>
146
-
194
+
147
195
  <div class="feature">
148
196
  <h3>Encrypted Communication</h3>
149
197
  <p>Protect your messages with AES-256-CBC encryption to ensure confidentiality during transmission.</p>
150
198
  </div>
151
-
199
+
152
200
  <div class="feature">
153
201
  <h3>Digital Signatures <span class="badge badge-new">New in v0.2.1</span></h3>
154
202
  <p>Verify message authenticity and integrity with RSA-based digital signatures.</p>
155
-
203
+
156
204
  <div class="security-feature">
157
205
  <h4>Benefits of Digital Signatures:</h4>
158
206
  <ul>
@@ -163,12 +211,12 @@
163
211
  </ul>
164
212
  </div>
165
213
  </div>
166
-
214
+
167
215
  <div class="feature">
168
216
  <h3>Network Discovery</h3>
169
217
  <p>Automatically find active devices on your local network with advanced scanning capabilities.</p>
170
218
  </div>
171
-
219
+
172
220
  <div class="feature">
173
221
  <h3>Broadcasting</h3>
174
222
  <p>Send messages to all devices on your network simultaneously.</p>
@@ -179,26 +227,42 @@
179
227
  <p>Securely transfer files between devices with encryption, digital signatures, and integrity verification.</p>
180
228
  </div>
181
229
 
230
+ <div class="feature">
231
+ <h3>Mesh Networking <span class="badge badge-new">New in v0.4.0</span></h3>
232
+ <p>Create resilient, decentralized mesh networks that enable communication between devices even without direct connectivity.</p>
233
+
234
+ <div class="security-feature">
235
+ <h4>Benefits of Mesh Networking:</h4>
236
+ <ul>
237
+ <li><strong>Decentralization</strong>: No central server or infrastructure needed</li>
238
+ <li><strong>Resilience</strong>: Messages can route around failed nodes or connections</li>
239
+ <li><strong>Extended Range</strong>: Devices can communicate beyond direct connection range</li>
240
+ <li><strong>Scalability</strong>: Network grows stronger with more participating nodes</li>
241
+ <li><strong>Self-healing</strong>: Network automatically adapts to changing conditions</li>
242
+ </ul>
243
+ </div>
244
+ </div>
245
+
182
246
  <h2>Command Line Interface</h2>
183
247
 
184
248
  <div class="note">
185
249
  <strong>Note:</strong> All Lanet commands have detailed help available. Try <code>lanet [command] --help</code> for more options.
186
250
  </div>
187
-
251
+
188
252
  <div class="cli-section">
189
253
  <h3>Digital Signature Commands <span class="badge badge-new">New in v0.2.1</span></h3>
190
-
254
+
191
255
  <h4>Generate a Key Pair</h4>
192
256
  <p>Create RSA keys for signing and verifying messages:</p>
193
257
  <div class="cli-example">
194
258
  lanet keygen
195
259
  </div>
196
-
260
+
197
261
  <p>Generate keys with custom options:</p>
198
262
  <div class="cli-example">
199
263
  lanet keygen --bits 4096 --output ~/.lanet_keys
200
264
  </div>
201
-
265
+
202
266
  <div class="output-example">
203
267
  Key pair generated!
204
268
  Private key saved to: /home/user/.lanet_keys/lanet_private.key
@@ -207,32 +271,32 @@ Public key saved to: /home/user/.lanet_keys/lanet_public.key
207
271
  IMPORTANT: Keep your private key secure and never share it.
208
272
  Share your public key with others who need to verify your messages.
209
273
  </div>
210
-
274
+
211
275
  <h4>Send a Signed Message</h4>
212
276
  <div class="cli-example">
213
277
  lanet send --target 192.168.1.5 --message "Signed message" --private-key-file lanet_private.key
214
278
  </div>
215
-
279
+
216
280
  <h4>Send a Signed & Encrypted Message</h4>
217
281
  <div class="cli-example">
218
282
  lanet send --target 192.168.1.5 --message "Secure signed message" --key "my_secret_key" --private-key-file lanet_private.key
219
283
  </div>
220
-
284
+
221
285
  <h4>Broadcast a Signed Message</h4>
222
286
  <div class="cli-example">
223
287
  lanet broadcast --message "Important announcement" --private-key-file lanet_private.key
224
288
  </div>
225
-
289
+
226
290
  <h4>Listen for and Verify Signed Messages</h4>
227
291
  <div class="cli-example">
228
292
  lanet listen --public-key-file lanet_public.key
229
293
  </div>
230
-
294
+
231
295
  <h4>Listen for Encrypted & Signed Messages</h4>
232
296
  <div class="cli-example">
233
297
  lanet listen --encryption-key "my_secret_key" --public-key-file lanet_public.key
234
298
  </div>
235
-
299
+
236
300
  <p>Example output when receiving a signed message:</p>
237
301
  <div class="output-example">
238
302
  Message from 192.168.1.5:
@@ -244,27 +308,27 @@ Signature: ✓ VERIFIED
244
308
 
245
309
  <div class="cli-section">
246
310
  <h3>Basic Message Commands</h3>
247
-
311
+
248
312
  <h4>Send a Message</h4>
249
313
  <div class="cli-example">
250
314
  lanet send --target 192.168.1.5 --message "Hello there!"
251
315
  </div>
252
-
316
+
253
317
  <h4>Send an Encrypted Message</h4>
254
318
  <div class="cli-example">
255
319
  lanet send --target 192.168.1.5 --message "Secret message" --key "my_secret_key"
256
320
  </div>
257
-
321
+
258
322
  <h4>Broadcast a Message</h4>
259
323
  <div class="cli-example">
260
324
  lanet broadcast --message "Announcement for everyone!"
261
325
  </div>
262
-
326
+
263
327
  <h4>Listen for Messages</h4>
264
328
  <div class="cli-example">
265
329
  lanet listen
266
330
  </div>
267
-
331
+
268
332
  <h4>Listen for Encrypted Messages</h4>
269
333
  <div class="cli-example">
270
334
  lanet listen --encryption-key "my_secret_key"
@@ -273,27 +337,27 @@ Signature: ✓ VERIFIED
273
337
 
274
338
  <div class="cli-section">
275
339
  <h3>Network Discovery Commands</h3>
276
-
340
+
277
341
  <h4>Scan Network</h4>
278
342
  <div class="cli-example">
279
343
  lanet scan --range 192.168.1.0/24
280
344
  </div>
281
-
345
+
282
346
  <h4>Detailed Network Scan</h4>
283
347
  <div class="cli-example">
284
348
  lanet scan --range 192.168.1.0/24 --verbose --threads 16 --timeout 2
285
349
  </div>
286
-
350
+
287
351
  <h4>Ping a Host</h4>
288
352
  <div class="cli-example">
289
353
  lanet ping 192.168.1.5
290
354
  </div>
291
-
355
+
292
356
  <h4>Continuous Ping</h4>
293
357
  <div class="cli-example">
294
358
  lanet ping 192.168.1.5 --continuous
295
359
  </div>
296
-
360
+
297
361
  <h4>Ping Multiple Hosts</h4>
298
362
  <div class="cli-example">
299
363
  lanet ping --hosts 192.168.1.5,192.168.1.6,192.168.1.7 --count 5
@@ -302,28 +366,28 @@ Signature: ✓ VERIFIED
302
366
 
303
367
  <div class="cli-section">
304
368
  <h3>File Transfer Commands <span class="badge badge-new">New in v0.3.0</span></h3>
305
-
369
+
306
370
  <h4>Send a File</h4>
307
371
  <p>Send a file with encryption:</p>
308
372
  <div class="cli-example">
309
373
  lanet send-file --target 192.168.1.5 --file document.pdf --key "my_secret_key"
310
374
  </div>
311
-
375
+
312
376
  <p>Send a file with encryption and digital signature:</p>
313
377
  <div class="cli-example">
314
378
  lanet send-file --target 192.168.1.5 --file document.pdf --key "my_secret_key" --private-key-file lanet_private.key
315
379
  </div>
316
-
380
+
317
381
  <h4>Receive Files</h4>
318
382
  <div class="cli-example">
319
383
  lanet receive-file --output ./downloads --encryption-key "my_secret_key"
320
384
  </div>
321
-
385
+
322
386
  <p>With signature verification:</p>
323
387
  <div class="cli-example">
324
388
  lanet receive-file --output ./downloads --encryption-key "my_secret_key" --public-key-file lanet_public.key
325
389
  </div>
326
-
390
+
327
391
  <p>Example output during file transfer:</p>
328
392
  <div class="output-example">
329
393
  Receiving file: document.pdf from 192.168.1.5
@@ -332,7 +396,47 @@ Transfer ID: 8a7b6c5d-4e3f-2g1h-0i9j-8k7l6m5n4o3p
332
396
  Progress: 75% (786432/1048576 bytes)
333
397
  </div>
334
398
  </div>
335
-
399
+
400
+ <div class="cli-section">
401
+ <h3>Mesh Network Commands <span class="badge badge-new">New in v0.4.0</span></h3>
402
+
403
+ <h4>Start a Mesh Network Node</h4>
404
+ <div class="cli-example">
405
+ lanet mesh start
406
+ </div>
407
+
408
+ <h4>Start with Custom Settings</h4>
409
+ <div class="cli-example">
410
+ lanet mesh start --port 5050 --max-hops 15
411
+ </div>
412
+
413
+ <h4>Send a Message Through the Mesh</h4>
414
+ <div class="cli-example">
415
+ lanet mesh send --target a1b2c3d4-5678-90ef-ghij --message "Hello Mesh"
416
+ </div>
417
+
418
+ <h4>Send an Encrypted Mesh Message</h4>
419
+ <div class="cli-example">
420
+ lanet mesh send --target a1b2c3d4-5678-90ef-ghij --message "Secret mesh message" --key "secret-key"
421
+ </div>
422
+
423
+ <h4>View Mesh Network Information</h4>
424
+ <div class="cli-example">
425
+ lanet mesh info
426
+ </div>
427
+
428
+ <p>Example output when viewing mesh info:</p>
429
+ <div class="output-example">
430
+ Mesh Node ID: 4f9a8b7c-6d5e-4f3e-2d1c-0b9a8b7c6d5e
431
+
432
+ Connected nodes:
433
+ b1c2d3e4-f5g6-7h8i-9j0k-l1m2n3o4p5q6 (192.168.1.5, last seen 12s ago)
434
+ c5d4e3f2-g1h0-i9j8-k7l6-m5n4o3p2q1r0 (192.168.1.10, last seen 5s ago)
435
+
436
+ Message cache: 24 messages
437
+ </div>
438
+ </div>
439
+
336
440
  <h2>Ruby Code Examples</h2>
337
441
 
338
442
  <div class="tab-container">
@@ -341,8 +445,9 @@ Progress: 75% (786432/1048576 bytes)
341
445
  <button class="tab-button" onclick="openTab(event, 'tab-signatures')">Digital Signatures</button>
342
446
  <button class="tab-button" onclick="openTab(event, 'tab-advanced')">Advanced Usage</button>
343
447
  <button class="tab-button" onclick="openTab(event, 'tab-filetransfer')">File Transfer</button>
448
+ <button class="tab-button" onclick="openTab(event, 'tab-mesh')">Mesh Network</button>
344
449
  </div>
345
-
450
+
346
451
  <div id="tab-basic" class="tab-content active">
347
452
  <pre><code>require 'lanet'
348
453
 
@@ -361,7 +466,7 @@ encrypted = Lanet::Encryptor.prepare_message('Secret message', 'my_encryption_ke
361
466
  # Send the encrypted message
362
467
  sender.send_to('192.168.1.5', encrypted)</code></pre>
363
468
  </div>
364
-
469
+
365
470
  <div id="tab-signatures" class="tab-content">
366
471
  <pre><code>require 'lanet'
367
472
 
@@ -377,8 +482,8 @@ encryption_key = "secret-key-123"
377
482
  # Send a signed and encrypted message
378
483
  message = "Hello, secure world!"
379
484
  prepared_message = Lanet::Encryptor.prepare_message(
380
- message,
381
- encryption_key,
485
+ message,
486
+ encryption_key,
382
487
  private_key
383
488
  )
384
489
  sender.send_to("192.168.1.5", prepared_message)
@@ -387,17 +492,17 @@ sender.send_to("192.168.1.5", prepared_message)
387
492
  receiver = Lanet::Receiver.new(9000)
388
493
  receiver.listen do |data, sender_ip|
389
494
  result = Lanet::Encryptor.process_message(
390
- data,
391
- encryption_key,
495
+ data,
496
+ encryption_key,
392
497
  public_key
393
498
  )
394
-
499
+
395
500
  puts "Message: #{result[:content]}"
396
501
  puts "Verified: #{result[:verified]}"
397
502
  puts "Verification status: #{result[:verification_status]}"
398
503
  end</code></pre>
399
504
  </div>
400
-
505
+
401
506
  <div id="tab-advanced" class="tab-content">
402
507
  <pre><code>require 'lanet'
403
508
 
@@ -408,7 +513,7 @@ active_hosts = scanner.scan('192.168.1.0/24', 1, 32, true)
408
513
  active_hosts.each do |host|
409
514
  puts "Host: #{host[:ip]}, Hostname: #{host[:hostname]}"
410
515
  puts "Response time: #{host[:response_time]}ms"
411
-
516
+
412
517
  if host[:ports]
413
518
  puts "Open ports:"
414
519
  host[:ports].each do |port, service|
@@ -427,8 +532,8 @@ puts "Response time: #{result[:response_time]}ms"
427
532
  encryption_key = "network-shared-key"
428
533
  message = "Important system notification"
429
534
  signed_message = Lanet::Encryptor.prepare_message(
430
- message,
431
- encryption_key,
535
+ message,
536
+ encryption_key,
432
537
  private_key
433
538
  )
434
539
  sender.broadcast(signed_message)</code></pre>
@@ -474,41 +579,88 @@ file_transfer.receive_file('./downloads', 'encryption_key') do |event, data|
474
579
  end
475
580
  end</code></pre>
476
581
  </div>
582
+
583
+ <div id="tab-mesh" class="tab-content">
584
+ <pre><code>require 'lanet'
585
+
586
+ # Create and start a mesh network node
587
+ mesh = Lanet.mesh_network
588
+ mesh.start
589
+
590
+ puts "Mesh node started with ID: #{mesh.node_id}"
591
+
592
+ # Send a plain message through the mesh
593
+ begin
594
+ message_id = mesh.send_message(
595
+ "target-node-id-here",
596
+ "Hello through the mesh network!"
597
+ )
598
+ puts "Message sent with ID: #{message_id}"
599
+ rescue Lanet::Mesh::Error => e
600
+ puts "Message sending failed: #{e.message}"
601
+ end
602
+
603
+ # Send an encrypted and signed message
604
+ encryption_key = "mesh-encryption-key"
605
+ key_pair = Lanet::Signer.generate_key_pair
606
+ private_key = key_pair[:private_key]
607
+
608
+ begin
609
+ message_id = mesh.send_message(
610
+ "target-node-id-here",
611
+ "Secure mesh message",
612
+ encryption_key,
613
+ private_key
614
+ )
615
+ puts "Secure message sent with ID: #{message_id}"
616
+ rescue Lanet::Mesh::Error => e
617
+ puts "Secure message sending failed: #{e.message}"
618
+ end
619
+
620
+ # Examine mesh connections
621
+ puts "Connected to #{mesh.connections.size} nodes:"
622
+ mesh.connections.each do |node_id, info|
623
+ puts " • #{node_id} (#{info[:ip]}, last seen #{Time.now.to_i - info[:last_seen]}s ago)"
624
+ end
625
+
626
+ # Always stop the mesh node when done
627
+ mesh.stop</code></pre>
628
+ </div>
477
629
  </div>
478
-
630
+
479
631
  <h2>Installation</h2>
480
-
632
+
481
633
  <p>Add this to your Gemfile:</p>
482
634
  <pre><code>gem 'lanet'</code></pre>
483
-
635
+
484
636
  <p>Or install directly:</p>
485
637
  <pre><code>gem install lanet</code></pre>
486
-
638
+
487
639
  <h2>Documentation</h2>
488
640
  <p>For complete documentation, please visit the <a href="https://github.com/davidesantangelo/lanet">GitHub repository</a>.</p>
489
-
641
+
490
642
  <footer style="margin-top: 40px; text-align: center; color: #7f8c8d;">
491
- <p>Lanet v0.2.1 - Secure Network Communications Library</p>
643
+ <p>Lanet v0.4.0 - Secure Network Communications Library</p>
492
644
  </footer>
493
645
  </div>
494
646
 
495
647
  <script>
496
648
  function openTab(evt, tabName) {
497
649
  var i, tabContent, tabButtons;
498
-
650
+
499
651
  tabContent = document.getElementsByClassName("tab-content");
500
652
  for (i = 0; i < tabContent.length; i++) {
501
653
  tabContent[i].className = tabContent[i].className.replace(" active", "");
502
654
  }
503
-
655
+
504
656
  tabButtons = document.getElementsByClassName("tab-button");
505
657
  for (i = 0; i < tabButtons.length; i++) {
506
658
  tabButtons[i].className = tabButtons[i].className.replace(" active", "");
507
659
  }
508
-
660
+
509
661
  document.getElementById(tabName).className += " active";
510
662
  evt.currentTarget.className += " active";
511
663
  }
512
664
  </script>
513
665
  </body>
514
- </html>
666
+ </html>