Skip to content

Add rsky-relay #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

utkarshgupta137
Copy link
Contributor

@utkarshgupta137 utkarshgupta137 commented Apr 7, 2025

Summary

Add a ATproto-compliant relay written in Rust.

Usage:

  • ./rsky-relay/crawler.py (can stop after a few requests & run relay with --no-plc-export)
  • ./rsky-relay/ssl.sh <local ip> (use ip a to find local ip of an interface)
  • RUST_LOG='rsky_relay=debug' cargo run -rp rsky-relay -- -c <local ip>.crt -p <local ip>.key
  • ./rsky-relay/bootstrap.sh
  • websocat -k wss://localhost:9000/xrpc/com.atproto.sync.subscribeRepos?cursor=0

Status: I'm able to listen to all bluesky PDSs + fediverse bridge PDS using 1 core & 2GB RAM.

Features:

  • Basic Crawler
  • Basic Publisher
  • HTTP server for requestCrawl & subscribeRepos
  • HTTPS server
  • did:plc: resolver, persistence, queuing, parallel query)
  • did:web: resolver
  • plc.directory crawler
  • PDS discovery
  • Commit/Sync signature verification
  • Commit message verification (rev/prev/pds etc.)
  • Commit validation (inductive firehose/sync 1.1)
  • PDS & cursor persistence (crawler state)
  • Commit data persistence, expiry, subscribe cursor support (publisher state)
  • Rate limiting & attack checks
  • Feature parity with indigo relay/Other stuff I'm forgetting

TODO:

  • Finalize db choice. While sleddb is very nice performance-wise, it doesn't have inbuilt support for expiry & it works more like BTreeMap rather than a IndexMap.
  • More error handling & Documentation
  • Re-using type defs from the rsky workspace
  • Unit tests in a few places

Related Issues

Changes

  • Feature implementation
  • Bug fix
  • Documentation update
  • Other (please specify):

Checklist

  • I have tested the changes (including writing unit tests).
  • I confirm that my implementation aligns with the canonical Typescript implementation and/or atproto spec
  • I have updated relevant documentation.
  • I have formatted my code correctly
  • I have provided examples for how this code works or will be used

@utkarshgupta137 utkarshgupta137 force-pushed the rsky-relay branch 2 times, most recently from 9396fee to 4857c89 Compare April 14, 2025 17:03

// false: not polled
// true: polled
pub fn poll(&mut self) -> Result<bool, ConnectionError> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea to emulate the future trait?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess kinda, but futures really have a setup -> work -> finish cycle, while this function will be called endlessly & never really produces a result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants