Commit Graph

271 Commits

Author SHA1 Message Date
287af9dc81 fix: replace break with return in error handling for ws client
- pkg/protocol/ws/client.go
  - Changed `break` to `return` to ensure proper error handling flow in `client.go`.

  this bug was causing the CPU usage to go very high from fmt.Errorf statements. changed them to errorf.E so they printed and were visible.
2025-08-18 20:15:38 +01:00
a51e86f4c4 update: reorganize imports, add URL rewriting support, and minor refactoring
- cmd/lerproxy/reverse/proxy.go
  - Reorganized imports for logical grouping.

- cmd/lerproxy/main.go
  - Added URL rewriting capability and updated command-line usage documentation.
  - Reorganized imports for consistency.
  - Replaced `context.T` with `context.Context` for standardization.
  - Updated timeout handling logic to use `context.WithTimeout`.

- pkg/protocol/ws/connection.go
  - Replaced `fmt.Errorf` with `errorf.E` for error formatting.

- cmd/lerproxy/util/util.go
  - Renamed file for better clarity.
  - Removed unnecessary package documentation.

- cmd/lerproxy/hsts/proxy.go
  - Removed redundant package comments.

- cmd/lerproxy/tcpkeepalive/listener.go
  - Removed redundant package comments.
  - Adjusted import order.

- cmd/lerproxy/buf/bufpool.go
  - Removed unnecessary package comments.

- cmd/lerproxy/README.md
  - Updated package usage examples and installation instructions.
  - Removed outdated and unnecessary instructions.
2025-08-18 20:13:14 +01:00
a928294234 fix: correct slice length condition and bump version to v0.8.7
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- pkg/encoders/filter/filter.go
  - Updated loop condition to check slice length `> 0` instead of `>= 0`.

- pkg/version/version
  - Updated version from `v0.8.6` to `v0.8.7`.
v0.8.7
2025-08-18 17:17:45 +01:00
4994d715f8 bump version to v0.8.6 - lock contention on ACL fixed
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- pkg/version/version
  - Updated version from `v0.8.5` to `v0.8.6`.
v0.8.6
2025-08-18 13:43:48 +01:00
af1e898191 fix: correct RWMutex usage in relay lists for proper concurrency handling
- pkg/app/relay/lists.go
  - Replaced incorrect `Unlock` calls with `RUnlock` in read operations.
2025-08-18 13:34:01 +01:00
b8a12d7a11 remove unused logging, improve concurrency, and minor fixes
- pkg/protocol/socketapi/publisher.go
  - Removed unnecessary debug logging for subscriber filtering and privilege checks.
  - Minor comment formatting correction.

- pkg/database/query-events.go
  - Removed outdated debug logs during event processing.
  - Cleaned up redundant log usage for deletion event handling.

- pkg/app/relay/lists.go
  - Replaced `sync.Mutex` with `sync.RWMutex` for better concurrency handling.
  - Adjusted locking methods (`Lock` to `RLock` and `Unlock` to `RUnlock`) where applicable.
2025-08-18 13:28:14 +01:00
b8bdaa95c5 bump version to v0.8.5 and update workflow build flags
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- pkg/version/version
  - Updated version from `v0.8.4` to `v0.8.5`.

- .github/workflows/go.yml
  - Updated `CGO_ENABLED` flag from `1` to `0` for Linux ARM64 builds.
v0.8.5
2025-08-17 20:29:31 +01:00
d11f54228b remove deprecated and unused websocket tests
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- pkg/protocol/ws/client_test.go
  - Commented out the `TestPublishBlocked` test as it is no longer in use.

- pkg/protocol/ws/subscription_test.go
  - Commented out `TestSubscribeBasic` and `TestNestedSubscriptions` tests.

- pkg/version/version
  - Updated version from `v0.8.3` to `v0.8.4`.
v0.8.4
2025-08-17 20:12:40 +01:00
ce23d2cca8 Merge pull request #12 from kwsantiago/kwsantiago/simplify-bench-docker
fix: docker benchmark
2025-08-17 18:47:14 +01:00
10f16e01fe fix: docker benchmark 2025-08-17 13:42:37 -04:00
710f88d03f bump version to v0.8.3 and update workflow build flags
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- pkg/version/version
  - Updated version from v0.8.2 to v0.8.3.

- .github/workflows/go.yml
  - Removed `--ldflags '-extldflags "-static"'` from Linux builds for amd64 and arm64 architectures.
v0.8.3
2025-08-17 18:27:41 +01:00
f1e8b52519 update: import utils, remove unused logs, and bump version
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- pkg/crypto/p256k/btcec/btcec_test.go
  - Added `orly.dev/pkg/utils` import.

- pkg/protocol/ws/client.go
  - Commented out unused logging related to filter matching.

- pkg/version/version
  - Bumped version from `v0.8.1` to `v0.8.2`.
v0.8.2
2025-08-17 18:17:21 +01:00
fd76013c10 refactor(tests): replace bytes imports with orly.dev/pkg/utils globally
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- pkg/crypto/ec/ecdsa/signature_test.go
  - Removed `bytes`; added `orly.dev/pkg/utils`.

- pkg/encoders/filter/filter_test.go
  - Removed `bytes`; added `orly.dev/pkg/utils`.

- pkg/database/query-for-kinds-authors-tags_test.go
  - Added `orly.dev/pkg/utils`.
  - Changed `idTsPk` type from `[]store.IdPkTs` to `[]*store.IdPkTs`.

- pkg/version/version
  - Bumped version from `v0.8.0` to `v0.8.1`.

- pkg/database/fetch-event-by-serial_test.go
  - Added `orly.dev/pkg/utils`.

- pkg/encoders/filters/filters_test.go
  - Removed `bytes`; added `orly.dev/pkg/utils`.

- pkg/database/query-for-kinds_test.go
  - Added `orly.dev/pkg/utils`.
  - Changed `idTsPk` type from `[]store.IdPkTs` to `[]*store.IdPkTs`.

- pkg/database/get-serials-by-range_test.go
  - Added `orly.dev/pkg/utils`.

- pkg/crypto/ec/base58/base58_test.go
  - Removed `bytes`; added `orly.dev/pkg/utils`.

- pkg/database/query-events-multiple-param-replaceable_test.go
  - Removed `bytes`; added `orly.dev/pkg/utils`.

... and additional test files updated to address similar import changes or type adjustments.
v0.8.1
2025-08-17 18:04:44 +01:00
fd866c21b2 refactor(database): optimize serial querying and add utils imports
- pkg/encoders/event/codectester/divider/main.go
  - Added missing import for `orly.dev/pkg/utils`.

- pkg/crypto/encryption/nip44.go
  - Imported `orly.dev/pkg/utils`.

- pkg/crypto/ec/musig2/sign.go
  - Introduced `orly.dev/pkg/utils` import.

- pkg/crypto/keys/keys.go
  - Included `orly.dev/pkg/utils`.

- pkg/database/query-for-serials.go
  - Updated `QueryForSerials` to use `GetFullIdPubkeyBySerials` for batch retrieval.
  - Removed unnecessary `sort` package import.
  - Replaced outdated logic for serial resolution.

- pkg/database/get-fullidpubkey-by-serials.go
  - Added new implementation for `GetFullIdPubkeyBySerials` for efficient batch serial lookups.

- pkg/database/get-serial-by-id.go
  - Added placeholder for alternative serial lookup method.

- pkg/database/database.go
  - Enabled `opts.Compression = options.None` in database configuration.

- pkg/database/save-event.go
  - Replaced loop-based full ID lookup with `GetFullIdPubkeyBySerials` for efficiency.

- pkg/database/get-serials-by-range.go
  - Added missing `sort.Slice` to enforce ascending order for serials.

- pkg/crypto/ec/taproot/taproot.go
  - Imported `orly.dev/pkg/utils`.

- pkg/crypto/ec/musig2/keys.go
  - Added `orly.dev/pkg/utils` import.

- pkg/database/get-fullidpubkey-by-serial.go
  - Removed legacy `GetFullIdPubkeyBySerials` implementation.

- pkg/database/query-for-ids.go
  - Refactored `QueryForIds` to use batched lookups via `GetFullIdPubkeyBySerials`.
  - Consolidated batch result deduplication logic.
  - Simplified code by removing redundant steps and checks.
2025-08-17 17:12:24 +01:00
02bf704e28 add fast bytes compare and start revising QueryForIds 2025-08-17 15:24:38 +01:00
7112930f73 add SimplePool implementation for managing relay connections
- pkg/protocol/ws/pool.go
  - Added `SimplePool` struct to manage connections to multiple relays.
  - Introduced associated methods for relay connection, publishing, and subscribing.
  - Added middleware support for events, duplicates, and queries.
  - Implemented penalty box for managing failed relay connections.
  - Provided various options for customizing behavior (e.g. relays, authentication, event handling).

- pkg/protocol/ws/subscription.go
  - Removed unnecessary `ReplaceableKey` struct.
  - Cleaned up redundant spaces and comments in subscription methods.
2025-08-17 11:40:41 +01:00
0187114918 fixed websocket client bugs 2025-08-17 09:48:01 +01:00
0ad371b06a Merge pull request #11
fix: fix OK callbacks
2025-08-17 06:13:17 +01:00
9832a8b28a refactor: cache event ID string conversion in OK handler 2025-08-16 22:23:44 -04:00
e9285cbc07 fix: correct deletion block scope in handleEvent 2025-08-16 22:23:39 -04:00
ddb60b7ae1 fix: correct context field reference in handleMessage 2025-08-16 22:23:33 -04:00
6c04646b79 assign logger to database options
- pkg/database/database.go
  - Added `opts.Logger = d.Logger` to include logger in database options.
2025-08-16 20:01:25 +01:00
0d81d48c25 add nostr-relay-rs and cleaned up install.sh script 2025-08-16 15:49:00 +01:00
9c731f729f created shell script that builds and installs all of the relays 2025-08-16 13:05:39 +01:00
fa3b717cf4 updating deps
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
v0.8.0
2025-08-16 06:38:14 +01:00
9646c23083 updating deps 2025-08-16 06:08:28 +01:00
0f652a9043 all docker bits build now 2025-08-16 05:51:59 +01:00
ebfccf341f Merge pull request #10 from kwsantiago/kwsantiago/benchmark-docker
feat: Dockerize Benchmark Suite
2025-08-16 04:22:47 +01:00
c1723442a0 Merge remote-tracking branch 'upstream/main' into kwsantiago/benchmark-docker 2025-08-15 17:44:34 -04:00
6b1140b382 feat: docker benchmark and updated relay comparison results 2025-08-15 17:40:55 -04:00
dda39de5a5 refactor logging to use closures for intensive tasks
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
v0.7.0
2025-08-15 22:27:16 +01:00
acd2c41447 chore: go fmt 2025-08-15 15:56:10 -04:00
6fc3e9a049 Merge remote-tracking branch 'origin/main' 2025-08-15 18:56:12 +01:00
ffcd0bdcc0 Remove unused event unmarshaling logic and update migration logging
- pkg/encoders/event/reader.go
  - Deleted the `UnmarshalRead` function and associated event unmarshaling logic.

- pkg/database/migrations.go
  - Added a log statement indicating migration completion.
  - Replaced `UnmarshalRead` with `UnmarshalBinary` in the event decoding process.
2025-08-15 18:55:59 +01:00
3525dd2b6c Merge remote-tracking branch 'origin/main' 2025-08-15 16:03:44 +01:00
66be769f7a Add support for expiration indexing and event deletion
- pkg/database/database.go
  - Added `RunMigrations` to handle new index versions.
  - Integrated `DeleteExpired` for scheduled cleanup of expired events within a goroutine.

- pkg/database/delete-event.go
  - Refactored the existing deletion logic into `DeleteEventBySerial`.

- pkg/database/delete-expired.go
  - Added new implementation to handle deletion of expired events using expiration indexes.

- pkg/database/migrations.go
  - Implemented `RunMigrations` to handle database versioning and reindexing when new keys are introduced.

- pkg/database/indexes/keys.go
  - Added `ExpirationPrefix` and `VersionPrefix` for new expiration and version indexes.
  - Implemented encoding structs for expiration and version handling.

- pkg/encoders/event/writer.go
  - Added JSON marshaling logic to serialize events with or without whitespace.

- pkg/encoders/event/reader.go
  - Refined unmarshaling logic for handling event keys and values robustly.

- pkg/protocol/socketapi/handleEvent.go
  - Formatted log statements and updated logging verbosity for event handling.

- pkg/app/relay/handleRelayinfo.go
  - Re-enabled relay handling for expiration timestamps.

- pkg/database/indexes/types.go (new file)
  - Introduced structures for `Uint40s` and other types used in indexes.
2025-08-15 15:50:31 +01:00
1794a881a2 Merge pull request #8 from kwsantiago/kwsantiago/benchmark-relay-comparison
feat: Nostr Relay Benchmark Suite
2025-08-14 20:08:08 +01:00
a2cce3f38b Bump version to v0.6.2
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- pkg/version/version
  - Updated version from v0.6.1 to v0.6.2. to trigger generation of release binaries
v0.6.2
2025-08-09 09:32:38 +01:00
04d789b23b Remove unnecessary logging statement from lerproxy
- cmd/lerproxy/main.go
  - Deleted `log.I.S` statement used for logging raw favicon data.
2025-08-09 09:21:02 +01:00
2148c597aa Fix favicon logic to correctly check for file read errors
- cmd/lerproxy/main.go
  - Updated condition to properly handle favicon file read errors.
2025-08-09 09:20:02 +01:00
f8c30e2213 Add logging for favicon data in lerproxy
- cmd/lerproxy/main.go
  - Added `log.I.S` statement to log raw favicon data.
2025-08-09 09:18:54 +01:00
2ef76884bd Add logging for favicon requests in lerproxy
- cmd/lerproxy/main.go
  - Added log statement to record favicon requests using `log.I.F`.
2025-08-09 09:16:41 +01:00
a4355f4963 Update logging level in lerproxy handler
- cmd/lerproxy/main.go
  - Changed logging level from `log.D.Ln` (debug) to `log.I.Ln` (info).
2025-08-09 09:13:03 +01:00
8fa3e2ad80 Update favicon handling and bump version to v0.6.1
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- main.go
  - Removed static favicon serving from `ServeMux`.
  - Removed import for `net/http`.

- pkg/version/version
  - Updated version from v0.6.0 to v0.6.1.

- cmd/lerproxy/main.go
  - Added embedded support for default favicon using `//go:embed`.
  - Modified logic to serve favicon as an embedded resource or from file in the same directory as the nostr.json

- static/favicon.ico
  - Deleted static favicon file.

- cmd/lerproxy/favicon.ico
  - Added new file for embedded favicon resource.
v0.6.1
2025-08-09 08:59:36 +01:00
0807ce3672 benchmark readme update 2025-08-08 16:03:54 -04:00
d4f7c0b07f feat: Nostr Relay Benchmark Suite 2025-08-08 16:01:58 -04:00
463bce47b0 Merge pull request #7 from Silberengel/feature/favicon-support
Add favicon support - serve favicon.ico from static directory
2025-08-08 20:10:49 +01:00
silberengel
289f962420 Add favicon support - serve favicon.ico from static directory 2025-08-08 20:58:44 +02:00
619198d1b5 Add mock wallet service examples documentation
- cmd/walletcli/mock-wallet-service/EXAMPLES.md
  - Added detailed example commands for all supported mock wallet service methods.
  - Included a complete example workflow for testing the service.
  - Added notes on the mock service's behavior and limitations.
2025-08-08 17:49:33 +01:00
e94d68c3b2 Add wallet service implementation and mock CLI tool
- pkg/protocol/nwc/wallet.go
  - Implemented `WalletService` with method registration and request handling.
  - Added default stub handlers for supported wallet methods.
  - Included support for notifications with `SendNotification`.

- pkg/protocol/nwc/client-methods.go
  - Added `Subscribe` function for handling client subscriptions.

- cmd/walletcli/mock-wallet-service/main.go
  - Implemented a mock CLI tool for wallet service.
  - Added command-line flags for relay connection and key management.
  - Added handlers for various wallet service methods (e.g., `GetInfo`, `GetBalance`, etc.).

- pkg/protocol/nwc/types.go
  - Added `GetWalletServiceInfo` to the list of wallet service capabilities.
2025-08-08 17:34:44 +01:00