Skip to content

Commit ef427fd

Browse files
committed
updated default relay and added a port for webtorrent host
Signed-off-by: Robert Gogete <[email protected]>
1 parent d8d3e7a commit ef427fd

File tree

7 files changed

+26
-23
lines changed

7 files changed

+26
-23
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:30878/gun'], // Your Gun.js relay
80+
peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/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:30878/gun'], // Same Gun.js relay
114+
peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'], // Same Gun.js relay
115115
namespace: 'my-app-namespace',
116116
timeout: 30000
117117
});
@@ -154,19 +154,19 @@ import { ConnectionMode } from 'dig-nat-tools';
154154
// AUTO: Try Direct HTTP first, then WebTorrent (recommended)
155155
const autoHost = new FileHost({
156156
connectionMode: ConnectionMode.AUTO,
157-
gun: { peers: ['http://nostalgiagame.go.ro:30878/gun'] }
157+
gun: { peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'] }
158158
});
159159

160160
// HTTP_ONLY: Direct HTTP connections only
161161
const httpHost = new FileHost({
162162
connectionMode: ConnectionMode.HTTP_ONLY,
163-
gun: { peers: ['http://nostalgiagame.go.ro:30878/gun'] }
163+
gun: { peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'] }
164164
});
165165

166166
// WEBTORRENT_ONLY: WebTorrent P2P only
167167
const p2pHost = new FileHost({
168168
connectionMode: ConnectionMode.WEBTORRENT_ONLY,
169-
gun: { peers: ['http://nostalgiagame.go.ro:30878/gun'] }
169+
gun: { peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'] }
170170
});
171171
```
172172

@@ -302,7 +302,7 @@ npx ts-node src/relay.ts
302302

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

305-
**Production Relay**: A public relay is available at `http://nostalgiagame.go.ro:30878/gun` for testing and development.
305+
**Production Relay**: A public relay is available at `http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun` for testing and development.
306306

307307
#### Docker Deployment
308308

@@ -368,7 +368,7 @@ new FileHost(options?: {
368368
connectionMode?: ConnectionMode; // Connection mode (default: ConnectionMode.AUTO)
369369
storeId?: string; // Unique identifier for Gun.js registry
370370
gun?: {
371-
peers: string[]; // Gun.js peer URLs (e.g., ['http://nostalgiagame.go.ro:30878/gun'])
371+
peers: string[]; // Gun.js peer URLs (e.g., ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'])
372372
namespace?: string; // Registry namespace (default: 'dig-nat-tools')
373373
};
374374
})
@@ -398,7 +398,7 @@ enum ConnectionMode {
398398
import { FileClient } from 'dig-nat-tools';
399399

400400
new FileClient(options?: {
401-
peers?: string[]; // Gun.js peer URLs (default: ['http://nostalgiagame.go.ro:30878/gun'])
401+
peers?: string[]; // Gun.js peer URLs (default: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'])
402402
namespace?: string; // Gun.js namespace (default: 'dig-nat-tools')
403403
timeout?: number; // Download timeout (default: 30000)
404404
})
@@ -476,7 +476,7 @@ import { FileHost, ConnectionMode } from 'dig-nat-tools';
476476
// AUTO: Try HTTP first, then WebTorrent (recommended)
477477
const host = new FileHost({
478478
connectionMode: ConnectionMode.AUTO,
479-
gun: { peers: ['http://nostalgiagame.go.ro:30878/gun'] }
479+
gun: { peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'] }
480480
});
481481

482482
// HTTP only: Direct connections
@@ -538,7 +538,7 @@ node .\examples\test-client.js
538538
**Example Output:**
539539
```
540540
🔍 Starting test client...
541-
🔗 Connecting to Gun.js relay at http://nostalgiagame.go.ro:30878/gun...
541+
🔗 Connecting to Gun.js relay at http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun...
542542
📡 Using namespace: dig-nat-tools-test
543543
🔄 Searching for available peers...
544544
📊 Search completed. Found 2 peer(s)
@@ -560,7 +560,7 @@ You can modify the test client configuration:
560560
```javascript
561561
// In examples/test-client.js
562562
const client = new FileClient({
563-
peers: ['http://nostalgiagame.go.ro:30878/gun'], // Gun.js relay URL
563+
peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'], // Gun.js relay URL
564564
namespace: 'dig-nat-tools-test', // Registry namespace
565565
timeout: 30000 // 30 second timeout
566566
});
@@ -579,7 +579,7 @@ const { FileClient } = require('dig-nat-tools');
579579

580580
async function discoverPeers() {
581581
const client = new FileClient({
582-
peers: ['http://nostalgiagame.go.ro:30878/gun'],
582+
peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'],
583583
namespace: 'my-app',
584584
timeout: 30000
585585
});
@@ -616,7 +616,7 @@ const fs = require('fs');
616616
617617
async function downloadFromPeer() {
618618
const client = new FileClient({
619-
peers: ['http://nostalgiagame.go.ro:30878/gun'],
619+
peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'],
620620
namespace: 'my-app'
621621
});
622622
@@ -663,7 +663,7 @@ const { FileClient } = require('dig-nat-tools');
663663
664664
async function monitorPeers() {
665665
const client = new FileClient({
666-
peers: ['http://nostalgiagame.go.ro:30878/gun'],
666+
peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'],
667667
namespace: 'my-app'
668668
});
669669
@@ -784,7 +784,7 @@ class P2PFileManager {
784784
// Usage example
785785
async function main() {
786786
const manager = new P2PFileManager(
787-
'http://nostalgiagame.go.ro:30878/gun',
787+
'http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun',
788788
'my-application'
789789
);
790790

examples/test-client.js

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

1212
// Initialize FileClient with Gun.js configuration
1313
const client = new FileClient({
14-
peers: ['http://nostalgiagame.go.ro:30878/gun'], // Connect to deployed relay
14+
peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'], // Connect to deployed relay
1515
namespace: 'dig-nat-tools-test', // Use same namespace as host
1616
timeout: 600000 // 10 minute timeout (600 seconds) - increased from 5 minutes
1717
});
1818

1919
try {
20-
console.log('🔗 Connecting to Gun.js relay at http://nostalgiagame.go.ro:30878/gun...');
20+
console.log('🔗 Connecting to Gun.js relay at http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun...');
2121
console.log('📡 Using namespace: dig-nat-tools-test');
2222
console.log('🔄 Searching for available peers...');
2323

examples/test-host.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async function runExample() {
2222
ttl: 3600, // UPnP mapping TTL: 1 hour
2323
storeId: 'test-host-2',
2424
gun: {
25-
peers: ['http://nostalgiagame.go.ro:30878/gun'],
25+
peers: ['http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun'],
2626
namespace: 'dig-nat-tools-test'
2727
}
2828
});

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class FileClient implements IFileClient {
3535

3636
constructor(options: FileClientOptions = {}) {
3737
this.options = {
38-
peers: options.peers || ["http://nostalgiagame.go.ro:30878/gun"],
38+
peers: options.peers || ["http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun"],
3939
namespace: options.namespace || "dig-nat-tools",
4040
timeout: options.timeout || 30000,
4141
};

src/host.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,11 @@ export class FileHost implements IFileHost {
334334
this.connectionMode === ConnectionMode.WEBTORRENT_ONLY
335335
) {
336336
try {
337-
this.logger.debug(`🔄 Initializing WebTorrent client...`);
338-
this.webTorrentClient = new WebTorrent();
337+
this.logger.debug(`🔄 Initializing WebTorrent client on port 30987...`);
338+
this.webTorrentClient = new WebTorrent({
339+
dht: { port: 30987 },
340+
tracker: { port: 30987 }
341+
});
339342

340343
// Fix EventEmitter warning when seeding multiple torrents
341344
// WebTorrent reuses a single DHT instance, causing listener count to exceed default limit

src/registry/gun-registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class GunRegistry {
4242

4343
constructor(options: GunRegistryOptions = {}) {
4444
this.options = {
45-
peers: options.peers || ["http://nostalgiagame.go.ro:30878/gun"],
45+
peers: options.peers || ["http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun"],
4646
namespace: options.namespace || "dig-nat-tools",
4747
webrtc: options.webrtc || {
4848
iceServers: [

tests/gun-registry.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('GunRegistry', () => {
6464
it('should initialize with default options', () => {
6565
registry = new GunRegistry();
6666
expect(mockGun).toHaveBeenCalledWith({
67-
peers: ["http://nostalgiagame.go.ro:30878/gun"],
67+
peers: ["http://dig-relay-prod.eba-2cmanxbe.us-east-1.elasticbeanstalk.com/gun"],
6868
rtc: {
6969
iceServers: [
7070
{ urls: 'stun:stun.l.google.com:19302' },

0 commit comments

Comments
 (0)