Skip to content

Conversation

@str4d
Copy link
Contributor

@str4d str4d commented Sep 14, 2025

Summary

This implements the com.atproto.sync.listHosts endpoint.

Related Issues

https://bsky.app/profile/rude1.blacksky.team/post/3loazssauks23

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

hostname,
seq,
// TODO: Track status of hosts.
status: HostStatus::Active,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

indigo does things like mark a host as offline if it fails repeated connection attempts, or mark hosts that are actually relays as banned. I couldn't find any logic in rsky-relay that did this, so for now this reports the same default value as indigo. This does mean rsky-relay is over-reporting which hosts it is actively connected to, but that can be fixed by someone more familiar with the stack.

.into_iter()
.map(|(_, hostname, seq)| Host {
// TODO: Track host account counts.
account_count: 0,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

indigo updates its counter for a PDS host whenever an account is first observed on a PDS or is observed to move between PDSs. AFAICT rsky-relay doesn't have any tracking of which host a repo is on, so I haven't hooked this up to anything and it instead reports the same default value as indigo.

@afbase
Copy link
Contributor

afbase commented Sep 16, 2025

❯ curl "http://localhost:9000/xrpc/com.atproto.sync.listHosts?limit=10" | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1034  100  1034    0     0    98k      0 --:--:-- --:--:-- --:--:--  100k
{
  "cursor": "10",
  "hosts": [
    {
      "accountCount": 0,
      "hostname": "reishi.us-east.host.bsky.network",
      "seq": 229148683,
      "status": "active"
    },
    {
      "accountCount": 0,
      "hostname": "scarletina.us-east.host.bsky.network",
      "seq": 225800171,
      "status": "active"
    },
    {
      "accountCount": 0,
      "hostname": "woodear.us-west.host.bsky.network",
      "seq": 170959567,
      "status": "active"
    },
    {
      "accountCount": 0,
      "hostname": "verpa.us-west.host.bsky.network",
      "seq": 232327256,
      "status": "active"
    },
    {
      "accountCount": 0,
      "hostname": "panthercap.us-east.host.bsky.network",
      "seq": 222885971,
      "status": "active"
    },
    {
      "accountCount": 0,
      "hostname": "milkcap.us-west.host.bsky.network",
      "seq": 236909613,
      "status": "active"
    },
    {
      "accountCount": 0,
      "hostname": "puffball.us-east.host.bsky.network",
      "seq": 636838749,
      "status": "active"
    },
    {
      "accountCount": 0,
      "hostname": "cortinarius.us-west.host.bsky.network",
      "seq": 57424274,
      "status": "active"
    },
    {
      "accountCount": 0,
      "hostname": "earthstar.us-east.host.bsky.network",
      "seq": 222018566,
      "status": "active"
    },
    {
      "accountCount": 0,
      "hostname": "truffle.us-east.host.bsky.network",
      "seq": 226445298,
      "status": "active"
    }
  ]
}

I was able to test successfully!

@afbase afbase self-requested a review September 17, 2025 00:54
Copy link
Contributor

@afbase afbase left a comment

Choose a reason for hiding this comment

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

+1 - will wait to hear from one other dev before merge

@rudyfraser rudyfraser merged commit 91ead33 into blacksky-algorithms:main Sep 17, 2025
7 checks passed
@str4d str4d deleted the relay-listhosts branch September 17, 2025 15:21
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.

4 participants