Add NIP-11 relay synchronization and group management features
- Introduced a new `sync` package for managing NIP-11 relay information and relay group configurations. - Implemented a cache for NIP-11 documents, allowing retrieval of relay public keys and authoritative configurations. - Enhanced the sync manager to update peer lists based on authoritative configurations from relay group events. - Updated event handling to incorporate policy checks during event imports, ensuring compliance with relay rules. - Refactored various components to utilize the new `sha256-simd` package for improved performance. - Added comprehensive tests to validate the new synchronization and group management functionalities. - Bumped version to v0.24.1 to reflect these changes.
This commit is contained in:
@@ -287,3 +287,71 @@ This separation allows flexible output handling:
|
||||
# Events piped to another program, bloom filter saved
|
||||
./aggregator -npub npub1... 2>bloom_filter.txt | jq '.content'
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
The aggregator includes comprehensive tests to ensure reliable data collection:
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Run aggregator tests
|
||||
go test ./cmd/aggregator
|
||||
|
||||
# Run all tests including aggregator
|
||||
go test ./...
|
||||
|
||||
# Run with verbose output
|
||||
go test -v ./cmd/aggregator
|
||||
```
|
||||
|
||||
### Integration Testing
|
||||
|
||||
The aggregator is tested as part of the project's integration test suite:
|
||||
|
||||
```bash
|
||||
# Run the full test suite
|
||||
./scripts/test.sh
|
||||
|
||||
# Run benchmarks (which include aggregator performance)
|
||||
./scripts/runtests.sh
|
||||
```
|
||||
|
||||
### Example Test Usage
|
||||
|
||||
```bash
|
||||
# Test with mock data (if available)
|
||||
go test -v ./cmd/aggregator -run TestAggregator
|
||||
|
||||
# Test bloom filter functionality
|
||||
go test -v ./cmd/aggregator -run TestBloomFilter
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Building from Source
|
||||
|
||||
```bash
|
||||
# Build the aggregator binary
|
||||
go build -o aggregator ./cmd/aggregator
|
||||
|
||||
# Build with optimizations
|
||||
go build -ldflags="-s -w" -o aggregator ./cmd/aggregator
|
||||
|
||||
# Cross-compile for different platforms
|
||||
GOOS=linux GOARCH=amd64 go build -o aggregator-linux-amd64 ./cmd/aggregator
|
||||
GOOS=darwin GOARCH=arm64 go build -o aggregator-darwin-arm64 ./cmd/aggregator
|
||||
```
|
||||
|
||||
### Code Quality
|
||||
|
||||
The aggregator follows Go best practices and includes:
|
||||
|
||||
- Comprehensive error handling
|
||||
- Memory-efficient data structures
|
||||
- Concurrent processing with proper synchronization
|
||||
- Extensive logging for debugging
|
||||
|
||||
## License
|
||||
|
||||
This tool is part of the next.orly.dev project and follows the same licensing terms.
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/log"
|
||||
p256k1signer "p256k1.mleku.dev/signer"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
"github.com/minio/sha256-simd"
|
||||
"next.orly.dev/pkg/encoders/bech32encoding"
|
||||
"next.orly.dev/pkg/encoders/event"
|
||||
"next.orly.dev/pkg/encoders/filter"
|
||||
|
||||
Reference in New Issue
Block a user