1 unstable release

0.1.0 Mar 11, 2023

#979 in Asynchronous

MIT license

18KB
256 lines

Gossip Relay Picker

This is the code that the gossip client uses to pick relays to connect to and assign public keys to each.

If you try to use this library and find it difficult due to async issues implementing the hooks, let me know. We can make more of the hooks async. I know how much of a PITA it can be.


lib.rs:

The main type here is RelayPicker. You will need to implement RelayPickerHooks and then create a RelayPicker::new(hooks) with those hooks.

If you instantiate RelayPicker via Default::default(), for example in a lazy_static type setup, and then make changes which cause the Hooks to return something different than they did when they were created with Default::default() (e.g. global variable changes), then you might need to run RelayPicker::init() to reinitialize it with actual data.

Dependencies

~18–32MB
~591K SLoC