- 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.
- 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.
- pkg/protocol/ws/client.go
- Added logging for received subscription events.
- Optimized subscription ID assignment.
- pkg/protocol/nwc/client.go
- Implemented `Subscribe` function to handle event subscriptions.
- cmd/walletcli/main.go
- Added support for `subscribe` command to handle notifications.
- Replaced `ctx` with `c` for context usage across all commands.
- pkg/crypto/p256k/helpers.go
- Removed unnecessary logging from `HexToBin` function.
- .github/workflows/go.yml
- Added a new `release` job with steps to set up Go, install `libsecp256k1`, and build release binaries.
- pkg/version/version
- Updated version from v0.5.6 to v0.5.7.
- pkg/protocol/ws/pool_test.go
- Commented out the `TestPoolContextCancellation` test function.
- pkg/protocol/nwc/methods.go
- Refactored `GetWalletServiceInfo` to improve context and error handling.
- Simplified tag extraction and processing for encryption and notification types.
- Optimized handling of WalletServiceInfo capabilities.
- pkg/protocol/nwc/types.go
- Added `HoldInvoiceAccepted` notification type.
- Introduced `NotificationTag` constant.
- pkg/encoders/kind/kind.go
- Renamed `NWCWalletInfo` to `NWCWalletServiceInfo`.
- Updated references and mappings to reflect the rename.
* Renamed `NWCClient` to `nwc.NewNWCClient(opts)` in `cmd/nwcclient/main.go`
* Added `RPCRaw` wrappers for NWC client methods in `pkg/protocol/nwc/methods.go`
**Updated walletcli main function**
* Updated the main function in `cmd/walletcli/main.go` to use new NWC client and RPCRaw wrappers
**Added new methods for walletcli**
* Added new methods for handling NWC client RPC calls, such as:
* `handleGetWalletServiceInfo`
* `handleMakeHoldInvoice`
* `handleSettleHoldInvoice`
* `handleCancelHoldInvoice`
**Code formatting and style changes**
* Formatted code according to Go standard
* Used consistent naming conventions and coding styles
**Other updates**
* Updated dependencies and imported packages accordingly
- cmd/lerproxy/app/bufpool.go
- Removed bufferPool-related code and `Pool` struct
- cmd/nwcclient/main.go
- Renamed `Method` to `Capability` for clarity in method handling
- pkg/utils/values/values.go
- Added utility functions to return pointers for various types
- pkg/utils/pointers/pointers.go
- Revised documentation to reference `utils/values` package for pointer utilities
- pkg/protocol/nwc/types.go
- Replaced redundant types and structures with simplified versions
- Introduced dedicated structs for `MakeInvoice`, `PayInvoice`, and related results
- Refactored `Transaction` and its fields for consistent type usage
- pkg/protocol/nwc/uri.go
- Added `ParseConnectionURI` function for URI parsing and validation
- pkg/protocol/nwc/client.go
- Refactored `Client` struct to improve key management and relay handling
- Introduced `Request` struct for generic method invocation payloads
- pkg/protocol/socketapi/handleAuth.go
- Added import for "orly.dev/pkg/utils/iptracker"
- Added logic to call iptracker.Global.Authenticate() on successful authentication
- pkg/protocol/openapi/event.go
- Added logic to call iptracker.Global.Authenticate() on successful authentication
- pkg/utils/iptracker/iptracker.go
- Introduced offense tracking and block duration calculation based on offense count
- Added Authenticate method to remove blocks upon successful authentication
- Modified isBlockedNoLock to always return true when an IP is blocked
- Added HasBlockDurationPassed, GetBlockDuration, and Reset methods
- pkg/version/version
- Bumped version number from v0.4.4 to v0.4.5
- pkg/protocol/socketapi/socketapi.go
- Added import for "orly.dev/pkg/utils/iptracker"
- Added logic to check if an IP is blocked and reject the connection if it is
- pkg/protocol/socketapi/handleEvent.go
- Added imports for "orly.dev/pkg/utils/iptracker" and "time"
- Added logic to check if an IP is blocked, send a notice to the client, and close the connection if it is
- Added logic to record failed authentication attempts and block IPs that exceed the threshold
- pkg/protocol/openapi/event.go
- Added imports for "orly.dev/pkg/utils/iptracker" and "time"
- Added logic to check if an IP is blocked and return a forbidden error if it is
- Added logic to record failed authentication attempts and return appropriate errors based on whether the IP is blocked or not
- pkg/utils/iptracker/iptracker.go
- Created new package with functionality to track and block IPs based on failed authentication attempts
- pkg/version/version
- Bumped version number from v0.4.3 to v0.4.4
- pkg/protocol/socketapi/handleEvent.go
- Added variable to track if the delete event's author is an owner
- Modified checks to allow owners to delete events from other owners
- Updated error messages for clarity and consistency
- bumped to version v0.4.2
- pkg/app/relay/server-publish.go
- Added log statement for saved events
- pkg/app/relay/addEvent.go
- Added support for multiple pubkeys
- Modified logic to skip sending events back to replicas that already received them
- Added header with pubkeys to prevent unnecessary resending
- pkg/protocol/openapi/event.go
- Added parsing of X-Pubkeys header to avoid resending events
- Updated AddEvent call to use pubkeys parameter
- pkg/protocol/httpauth/nip98auth.go
- Removed log statement for nip-98 http auth event
- pkg/interfaces/server/server.go
- Updated AddEvent method signature to accept pubkeys instead of pubkey
- pkg/protocol/httpauth/validate.go
- Removed log statement for tolerance value
- cmd/lerproxy/README.md
- Fixed grammar and punctuation in note about certificate selection
- Improved clarity in instructions for appending intermediate certificates
- Corrected wording in explanation of CLI tool issues with certificates
- cmd/lerproxy/app/reverse.go
- Split long line for X-Forwarded-Host header comment to improve readability
- pkg/app/relay/server-publish.go
- Reformatted comment block for function description to fit within line length limits
- Added comments explaining why certain events aren't deleted from the database
- don't delete any kind of directory events
- pkg/protocol/socketapi/handleReq.go
- Split long lines for better readability in error message and log statements
- Improved formatting of the notice envelope message
- pkg/app/config/config.go
- Added new configuration fields for relay cluster replication authentication
- pkg/app/relay/publish/publisher.go
- Removed redundant package imports and logging statements
- pkg/protocol/openapi/events.go
- Updated the description of the Events HTTP API method to clarify that it uses a standard NIP-01 filter and returns events as a JSON array of event objects.
- pkg/protocol/ws/listener.go
- Removed `isAuthed` field from Listener struct
- Modified `IsAuthed()` method to check if `authedPubkey` is non-empty
- Removed `SetAuthed()` method
- pkg/encoders/event/readwriter.go
- Created new file with implementation of `MarshalWrite` and `UnmarshalRead` methods for event encoding/decoding
- pkg/protocol/openapi/events.go
- Created new file with implementation of the Events HTTP API method
- pkg/protocol/socketapi/handleReq.go
- Modified logging to display authed pubkey
- Updated comment regarding authentication status
- pkg/encoders/bytesbuf/pool.go
- Created new package for concurrent-safe buffer pool
- pkg/protocol/openapi/event.go
- Removed import of `lol` package
- Removed tracing logic around `RegisterEvent` function
- pkg/encoders/bytesbuf/pool_test.go
- Created new test file for buffer pool implementation
- pkg/protocol/socketapi/handleReq.go
- Added import of "orly.dev/pkg/encoders/bech32encoding" and "orly.dev/pkg/encoders/envelopes/noticeenvelope"
- Added logic to send a notice envelope when public read access is not allowed, listing owners' npub keys
- pkg/protocol/socketapi/handleEvent.go
- Added import of "orly.dev/pkg/encoders/bech32encoding" and "orly.dev/pkg/encoders/envelopes/noticeenvelope"
- Added logic to send a notice envelope when write access is not allowed, listing owners' npub keys
- pkg/version/version
- Bumped version from v0.2.18 to v0.2.19
- pkg/interfaces/server/server.go
- Added `OwnersPubkeys` method to return owners' public keys
- pkg/app/relay/owners-pubkeys.go
- Created new file with implementation of `OwnersPubkeys` method for relay server
- pkg/protocol/socketapi/handleAuth.go
- Added comment block for handling pending events (currently commented out)
- pkg/protocol/ws/listener.go
- Added import of "orly.dev/pkg/encoders/event"
- Added `pendingEvent` field to Listener struct
- Added `SetPendingEvent` and `GetPendingEvent` methods
- pkg/protocol/socketapi/socketapi.go
- Added import of "orly.dev/pkg/encoders/envelopes/authenvelope"
- Added authentication challenge logic including logging, RequestAuth call, and envelope writing
- pkg/protocol/socketapi/handleReq.go
- Removed import of "orly.dev/pkg/encoders/envelopes/okenvelope"
- Modified auth handling logic to send closed envelope with reason if auth is required and client is not authenticated
- pkg/protocol/socketapi/handleEvent.go
- Removed import of "orly.dev/pkg/encoders/reason"
- Added authentication challenge logic including logging, RequestAuth call, Ok.AuthRequired method, and envelope writing
- pkg/version/version
- Bumped version from v0.2.17 to v0.2.18
- pkg/app/relay/handleRelayinfo.go
- Removed logging of info variable
- pkg/protocol/socketapi/socketapi.go
- Removed import of "orly.dev/pkg/encoders/envelopes/authenvelope"
- Removed authentication logic including challenge sending and logging
- pkg/app/relay/auth.go
- Removed import of "orly.dev/pkg/utils/lol"
- Removed tracing logic around ServiceURL function
- pkg/protocol/socketapi/handleReq.go
- Added logging for auth status
- Added logic to send authentication challenge if required and client is not authenticated
- pkg/protocol/socketapi/handleEvent.go
- Added import of "orly.dev/pkg/encoders/envelopes/authenvelope" and "orly.dev/pkg/encoders/reason"
- Added logging for auth status
- Added logic to send authentication challenge if required and client is not authenticated
- pkg/version/version
- Bumped version from v0.2.16 to v0.2.17
- pkg/protocol/socketapi/socketapi.go
- Added `message` parameter to log statement for unexpected close error
- Updated format string to include message in log output
- pkg/protocol/socketapi/handleReq.go
- Modified log message for not privileged event
- Changed format string to be more descriptive and include client and event pubkeys
- pkg/database/save-event.go
- Added `noVerify` parameter to `SaveEvent` function
- Added check for existing event using `GetSerialById` when `noVerify` is false
- Modified logic to handle event verification based on `noVerify` flag
- pkg/app/relay/server-publish.go
- Added `false` as third argument to `SaveEvent` calls
- pkg/database/export_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-tags_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-kinds-authors_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-kinds-tags_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-serials_test.go
- Added `false` as third argument to `SaveEvent` call
- main.go
- Modified pprof handling to support different profiling types (cpu, memory, allocation)
- Changed `Pprof` configuration from boolean to string with enum values
- pkg/app/config/config.go
- Changed `Pprof` field type from `bool` to `string` with enum values
- pkg/database/query-for-kinds-authors-tags_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/version/version
- Bumped version from v0.2.12 to v0.2.13
- pkg/database/fetch-event-by-serial_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-kinds_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/get-serials-by-range_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-events-multiple-param-replaceable_test.go
- Added `false` as third argument to `SaveEvent` calls
- pkg/database/query-events_test.go
- Added `false` as third argument to `SaveEvent` calls
- pkg/interfaces/store/store_interface.go
- Updated `Saver` interface to include `noVerify` parameter in `SaveEvent` method
- Added `SerialByIder` interface with `GetSerialById` method
- pkg/database/save-event_test.go
- Added `false` as third argument to `SaveEvent` calls
- Added new test case for saving existing event
- pkg/database/query-for-ids_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/protocol/ws/client.go
- Changed comment about context cancellation from "context is canceled" to "context is cancelled"
- pkg/app/relay/spider-fetch.go
- Added signature checker for WebSocket connections
- Modified logic to check for existing events before saving
- Added logging and memory optimization improvements
- Updated privilege check log messages in `publisher.go` and `handleReq.go` for better clarity and consistency
- Improved event serialization by replacing `WriteTo` with `Serialize` in `export.go`
- Added unit tests for `Export` functionality in `export_test.go`
- Introduced tests for JSON tag handling in `json_tags_test.go`
- Simplified condition in `spider-fetch.go` by removing redundant checks
- Added `Export` method in `database/database.go` to export events to an io.Writer
- Implemented detailed logic for exporting all or specific pubkeys' events
- Removed placeholder `Export` function with TODO comment from `database/database.go`
- Updated error handling in `handleReq.go` and `publisher.go` by using `err != nil` instead of `chk.E(err)`
- Added more detailed logging in privilege check conditions in both `publisher.go` and `handleReq.go`
- Introduced new imports such as `"fmt"` in `connection.go` for improved error message formatting
- Created a new file `export.go` under the `database` package with complete implementation of export functionality
- Inverted conditional in `publisher.go` to correctly skip unprivileged events
- Inverted conditional in `handleReq.go` to filter out unprivileged events properly
- Added fallback logic in `check-privilege.go` to mark as privileged if no conditions match
- Changed `auth.CheckPrivilege` condition from allowing to denying access if not privileged in `publisher.go`
- Updated `handleReq.go` to deny access if `auth.CheckPrivilege` returns false, improving consistency and security checks
- Updated `handleMessage.go` to include the real remote address in the log message when a message is received
- Removed `regexp` import and `NIP20prefixmatcher` variable from `publisher.go`
- Modified `server.go` to remove an unused parameter from the `AddEvent` method
- Added `NIP20prefixmatcher` variable and used it for checking error messages in `addEvent.go`
- Removed unused `authedIsAuthor` variable and simplified privilege check logic in `check-privilege.go`
- Replaced conditional return based on `authedIsAuthor` with direct use of `privileged` flag
- Simplified the logic for checking if authed pubkey is mentioned in event tags