diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-25 07:19:26 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-25 07:19:26 +0000 |
| commit | 28168a7701c897a5b6af13bc472d6f5902e0a96d (patch) | |
| tree | bbb2ad5e238f118a31d4d1b974c0b391c74a12c1 /src/nostr/builder.rs | |
| parent | 05b7edb5f5797100d8e0f59905e16488680928ec (diff) | |
chore: remove arbitrary default max connections limit
When NGIT_MAX_CONNECTIONS is unset the relay imposes no connection cap,
deferring to OS fd limits and infrastructure controls. The option remains
available for operators who want an explicit ceiling.
Diffstat (limited to 'src/nostr/builder.rs')
| -rw-r--r-- | src/nostr/builder.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nostr/builder.rs b/src/nostr/builder.rs index 03132bf..02ba84b 100644 --- a/src/nostr/builder.rs +++ b/src/nostr/builder.rs | |||
| @@ -736,7 +736,7 @@ pub async fn create_relay( | |||
| 736 | let write_policy = | 736 | let write_policy = |
| 737 | Nip34WritePolicy::new(database.clone(), &git_data_path, purgatory, config.clone()); | 737 | Nip34WritePolicy::new(database.clone(), &git_data_path, purgatory, config.clone()); |
| 738 | 738 | ||
| 739 | let relay = LocalRelayBuilder::default() | 739 | let mut builder = LocalRelayBuilder::default() |
| 740 | .database(database.clone()) | 740 | .database(database.clone()) |
| 741 | .write_policy(write_policy.clone()) | 741 | .write_policy(write_policy.clone()) |
| 742 | // Explicitly set rate limits (make defaults visible in code) | 742 | // Explicitly set rate limits (make defaults visible in code) |
| @@ -744,10 +744,13 @@ pub async fn create_relay( | |||
| 744 | .rate_limit(RateLimit { | 744 | .rate_limit(RateLimit { |
| 745 | max_reqs: 500, // Max concurrent subscriptions per connection | 745 | max_reqs: 500, // Max concurrent subscriptions per connection |
| 746 | notes_per_minute: 60, // Max events per minute per connection | 746 | notes_per_minute: 60, // Max events per minute per connection |
| 747 | }) | 747 | }); |
| 748 | // Total connection limit to prevent DoS attacks | 748 | |
| 749 | .max_connections(config.max_connections) | 749 | if let Some(max) = config.max_connections { |
| 750 | .build(); | 750 | builder = builder.max_connections(max); |
| 751 | } | ||
| 752 | |||
| 753 | let relay = builder.build(); | ||
| 751 | 754 | ||
| 752 | tracing::info!( | 755 | tracing::info!( |
| 753 | "Relay configured with GRASP-01 validation for domain: {}", | 756 | "Relay configured with GRASP-01 validation for domain: {}", |