GitHub - LemmyNet/activitypub-federation-rust: High-level Rust library for the Activitypub protocol

The library has a nice guideand two working examples, so I tried the local_federation example. To build the example, you need Rust compiler, cargo package manager, and git:


<span style="color:#323232;">$ git clone https://github.com/LemmyNet/activitypub-federation-rust
</span><span style="color:#323232;">$ cd activitypub-federation-rust
</span><span style="color:#323232;">$ cargo run --example local_federation axum
</span><span style="color:#323232;">[INFO  local_federation] Start with parameter `axum` or `actix-web` to select the webserver
</span><span style="color:#323232;">[INFO  local_federation::axum::http] Listening with axum on localhost:8001
</span><span style="color:#323232;">[INFO  local_federation::axum::http] Listening with axum on localhost:8002
</span><span style="color:#323232;">[INFO  local_federation] Local instances started
</span><span style="color:#323232;">[INFO  local_federation] Alpha user follows beta user via webfinger
</span><span style="color:#323232;">[INFO  activitypub_federation::fetch] Fetching remote object http://localhost:8002/.well-known/webfinger?resource=acct:beta@localhost:8002
</span><span style="color:#323232;">[INFO  activitypub_federation::fetch] Fetching remote object http://localhost:8002/beta
</span><span style="color:#323232;">[INFO  activitypub_federation::fetch] Fetching remote object http://localhost:8001/alpha
</span><span style="color:#323232;">[INFO  local_federation] Follow was successful
</span><span style="color:#323232;">[INFO  local_federation] Beta sends a post to its followers
</span><span style="color:#323232;">[INFO  local_federation] Alpha received post: Hello world!
</span><span style="color:#323232;">[INFO  local_federation] Test completed
</span>

You may want to use network analizyer (e.g, wireshark) to see how it works under the hood.


<span style="color:#323232;">GET /.well-known/webfinger?resource=acct:beta@localhost:8002 HTTP/1.1
</span><span style="color:#323232;">accept: application/jrd+json
</span><span style="color:#323232;">digest: SHA-256=[redacted]
</span><span style="color:#323232;">signature: keyId="http://localhost:8001/#main-key",algorithm="hs2019",[...]
</span><span style="color:#323232;">host: localhost:8002
</span><span style="color:#323232;">
</span><span style="color:#323232;">HTTP/1.1 200 OK
</span><span style="color:#323232;">content-type: application/json
</span><span style="color:#323232;">content-length: 269
</span><span style="color:#323232;">date: Sat, 03 Feb 2024 23:05:19 GMT
</span><span style="color:#323232;">
</span><span style="color:#323232;">{
</span><span style="color:#323232;">  "subject": "acct:beta@localhost:8002",
</span><span style="color:#323232;">  "links": [
</span><span style="color:#323232;">    {
</span><span style="color:#323232;">      "rel": "http://webfinger.net/rel/profile-page",
</span><span style="color:#323232;">      "type": "text/html",
</span><span style="color:#323232;">      "href": "http://localhost:8002/beta",
</span><span style="color:#323232;">      "template": null
</span><span style="color:#323232;">    },
</span><span style="color:#323232;">    {
</span><span style="color:#323232;">      "rel": "self",
</span><span style="color:#323232;">      "type": "application/activity+json",
</span><span style="color:#323232;">      "href": "http://localhost:8002/beta",
</span><span style="color:#323232;">      "template": null
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">  ]
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">[...]
</span>
MxRemy,

I’ve run the example local federation code, but I didn’t know to use a network analyzer. Thanks! That should help a lot.

If I happen to have some webhosting, domain name, and valid SSL cert, is there any harm in using that to learn live in-practice stuff with? Pretty sure I read somewhere about not doing that so as not to clutter up the fediverse with test posts or something.

maegul,
@maegul@lemmy.ml avatar

If I happen to have some webhosting, domain name, and valid SSL cert, is there any harm …

Been wondering the same.

The core devs run some test instances. It may be workable for any test instances we have to federate only with those (which may require the devs adding something to an allowlist or something). Anything we are running can of course federate with each other I suppose. Activity will be limited, but a little network we can poke may be all that’s necessary?

@nutomic , if you don’t mind me bothering you, would something like this be at all feasible or useful? Otherwise, any thoughts on running test instances for ourselves and the load on the network?

nutomic,
@nutomic@lemmy.ml avatar

Sure you can use the existing test instances:

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • kavyap
  • thenastyranch
  • cubers
  • ethstaker
  • InstantRegret
  • DreamBathrooms
  • ngwrru68w68
  • magazineikmin
  • everett
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • GTA5RPClips
  • JUstTest
  • khanakhh
  • normalnudes
  • osvaldo12
  • cisconetworking
  • provamag3
  • Durango
  • tacticalgear
  • modclub
  • Leos
  • megavids
  • tester
  • anitta
  • lostlight
  • All magazines