Skip to content

Commit 18eaf8d

Browse files
Merge pull request #10 from DIG-Network/gunjs-p2p
Added p2p for gun registry and fixed tests
2 parents f5a07f1 + e181f8f commit 18eaf8d

File tree

9 files changed

+417
-548
lines changed

9 files changed

+417
-548
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const host = new FileHost({
7777
connectionMode: ConnectionMode.AUTO, // Try HTTP first, then WebTorrent
7878
storeId: 'my-unique-host-id',
7979
gun: {
80-
peers: ['http://nostalgiagame.go.ro:30876/gun'], // Your Gun.js relay
80+
peers: ['http://nostalgiagame.go.ro:30878/gun'], // Your Gun.js relay
8181
namespace: 'my-app-namespace'
8282
}
8383
});
@@ -111,7 +111,7 @@ import { FileClient } from 'dig-nat-tools';
111111

112112
// Create a client that discovers hosts via Gun.js
113113
const client = new FileClient({
114-
peers: ['http://nostalgiagame.go.ro:30876/gun'], // Same Gun.js relay
114+
peers: ['http://nostalgiagame.go.ro:30878/gun'], // Same Gun.js relay
115115
namespace: 'my-app-namespace',
116116
timeout: 30000
117117
});
@@ -149,19 +149,19 @@ import { ConnectionMode } from 'dig-nat-tools';
149149
// AUTO: Try Direct HTTP first, then WebTorrent (recommended)
150150
const autoHost = new FileHost({
151151
connectionMode: ConnectionMode.AUTO,
152-
gun: { peers: ['http://nostalgiagame.go.ro:30876/gun'] }
152+
gun: { peers: ['http://nostalgiagame.go.ro:30878/gun'] }
153153
});
154154

155155
// HTTP_ONLY: Direct HTTP connections only
156156
const httpHost = new FileHost({
157157
connectionMode: ConnectionMode.HTTP_ONLY,
158-
gun: { peers: ['http://nostalgiagame.go.ro:30876/gun'] }
158+
gun: { peers: ['http://nostalgiagame.go.ro:30878/gun'] }
159159
});
160160

161161
// WEBTORRENT_ONLY: WebTorrent P2P only
162162
const p2pHost = new FileHost({
163163
connectionMode: ConnectionMode.WEBTORRENT_ONLY,
164-
gun: { peers: ['http://nostalgiagame.go.ro:30876/gun'] }
164+
gun: { peers: ['http://nostalgiagame.go.ro:30878/gun'] }
165165
});
166166
```
167167

@@ -297,7 +297,7 @@ npx ts-node src/relay.ts
297297

298298
Your Gun.js clients can connect to `http://localhost:8765/gun` for local development.
299299

300-
**Production Relay**: A public relay is available at `http://nostalgiagame.go.ro:30876/gun` for testing and development.
300+
**Production Relay**: A public relay is available at `http://nostalgiagame.go.ro:30878/gun` for testing and development.
301301

302302
#### Docker Deployment
303303

@@ -363,7 +363,7 @@ new FileHost(options?: {
363363
connectionMode?: ConnectionMode; // Connection mode (default: ConnectionMode.AUTO)
364364
storeId?: string; // Unique identifier for Gun.js registry
365365
gun?: {
366-
peers: string[]; // Gun.js peer URLs (e.g., ['http://nostalgiagame.go.ro:30876/gun'])
366+
peers: string[]; // Gun.js peer URLs (e.g., ['http://nostalgiagame.go.ro:30878/gun'])
367367
namespace?: string; // Registry namespace (default: 'dig-nat-tools')
368368
};
369369
})
@@ -393,7 +393,7 @@ enum ConnectionMode {
393393
import { FileClient } from 'dig-nat-tools';
394394

395395
new FileClient(options?: {
396-
peers?: string[]; // Gun.js peer URLs (default: ['http://nostalgiagame.go.ro:30876/gun'])
396+
peers?: string[]; // Gun.js peer URLs (default: ['http://nostalgiagame.go.ro:30878/gun'])
397397
namespace?: string; // Gun.js namespace (default: 'dig-nat-tools')
398398
timeout?: number; // Download timeout (default: 30000)
399399
})
@@ -470,7 +470,7 @@ import { FileHost, ConnectionMode } from 'dig-nat-tools';
470470
// AUTO: Try HTTP first, then WebTorrent (recommended)
471471
const host = new FileHost({
472472
connectionMode: ConnectionMode.AUTO,
473-
gun: { peers: ['http://nostalgiagame.go.ro:30876/gun'] }
473+
gun: { peers: ['http://nostalgiagame.go.ro:30878/gun'] }
474474
});
475475

476476
// HTTP only: Direct connections
@@ -532,7 +532,7 @@ node .\examples\test-client.js
532532
**Example Output:**
533533
```
534534
🔍 Starting test client...
535-
🔗 Connecting to Gun.js relay at http://nostalgiagame.go.ro:30876/gun...
535+
🔗 Connecting to Gun.js relay at http://nostalgiagame.go.ro:30878/gun...
536536
📡 Using namespace: dig-nat-tools-test
537537
🔄 Searching for available peers...
538538
📊 Search completed. Found 2 peer(s)
@@ -554,7 +554,7 @@ You can modify the test client configuration:
554554
```javascript
555555
// In examples/test-client.js
556556
const client = new FileClient({
557-
peers: ['http://nostalgiagame.go.ro:30876/gun'], // Gun.js relay URL
557+
peers: ['http://nostalgiagame.go.ro:30878/gun'], // Gun.js relay URL
558558
namespace: 'dig-nat-tools-test', // Registry namespace
559559
timeout: 30000 // 30 second timeout
560560
});
@@ -573,7 +573,7 @@ const { FileClient } = require('dig-nat-tools');
573573

574574
async function discoverPeers() {
575575
const client = new FileClient({
576-
peers: ['http://nostalgiagame.go.ro:30876/gun'],
576+
peers: ['http://nostalgiagame.go.ro:30878/gun'],
577577
namespace: 'my-app',
578578
timeout: 30000
579579
});
@@ -610,7 +610,7 @@ const fs = require('fs');
610610
611611
async function downloadFromPeer() {
612612
const client = new FileClient({
613-
peers: ['http://nostalgiagame.go.ro:30876/gun'],
613+
peers: ['http://nostalgiagame.go.ro:30878/gun'],
614614
namespace: 'my-app'
615615
});
616616
@@ -657,7 +657,7 @@ const { FileClient } = require('dig-nat-tools');
657657
658658
async function monitorPeers() {
659659
const client = new FileClient({
660-
peers: ['http://nostalgiagame.go.ro:30876/gun'],
660+
peers: ['http://nostalgiagame.go.ro:30878/gun'],
661661
namespace: 'my-app'
662662
});
663663
@@ -778,7 +778,7 @@ class P2PFileManager {
778778
// Usage example
779779
async function main() {
780780
const manager = new P2PFileManager(
781-
'http://nostalgiagame.go.ro:30876/gun',
781+
'http://nostalgiagame.go.ro:30878/gun',
782782
'my-application'
783783
);
784784

examples/host-with-public-access.js

Lines changed: 0 additions & 88 deletions
This file was deleted.

examples/test-client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ async function startClient() {
77

88
// Initialize FileClient with Gun.js configuration
99
const client = new FileClient({
10-
peers: ['http://nostalgiagame.go.ro:30876/gun'], // Connect to deployed relay
10+
peers: ['http://nostalgiagame.go.ro:30878/gun'], // Connect to deployed relay
1111
namespace: 'dig-nat-tools-test', // Use same namespace as host
1212
timeout: 30000 // 30 second timeout
1313
});
1414

1515
try {
16-
console.log('🔗 Connecting to Gun.js relay at http://nostalgiagame.go.ro:30876/gun...');
16+
console.log('🔗 Connecting to Gun.js relay at http://nostalgiagame.go.ro:30878/gun...');
1717
console.log('📡 Using namespace: dig-nat-tools-test');
1818
console.log('🔄 Searching for available peers...');
1919

0 commit comments

Comments
 (0)