Struct Relay

Source
pub struct Relay { /* private fields */ }
Expand description

A running instance of a Pkarr relay server.

This struct represents a running relay server and provides methods to interact with it, such as retrieving the server’s address or shutting it down.

Implementations§

Source§

impl Relay

Source

pub fn builder() -> RelayBuilder

Create a builder for running a Relay

Source

pub async unsafe fn run_with_config_file( config_path: impl AsRef<Path>, ) -> Result<Self>

Run a Relay with a configuration file path.

§Safety

Homeserver uses LMDB, opening which is marked unsafe, because the possible Undefined Behavior (UB) if the lock file is broken.

Source

pub async fn run_test(testnet: &Testnet) -> Result<Self>

Run an ephemeral Pkarr relay on a random port number for testing purposes.

§Arguments
  • testnet - A reference to a mainline::Testnet for bootstrapping the DHT.
§Safety

Homeserver uses LMDB, opening which is marked unsafe, because the possible Undefined Behavior (UB) if the lock file is broken.

Source

pub async unsafe fn run_testnet() -> Result<Self>

Run a Pkarr relay in a Testnet mode (on port 15411).

§Safety

Homeserver uses LMDB, opening which is marked unsafe, because the possible Undefined Behavior (UB) if the lock file is broken.

Source

pub fn relay_address(&self) -> SocketAddr

Returns the HTTP socket address of the relay.

Source

pub fn local_url(&self) -> Url

Returns the localhost URL of the HTTP server.

Source

pub fn shutdown(&self)

Shutdown the relay server.

Auto Trait Implementations§

§

impl Freeze for Relay

§

impl RefUnwindSafe for Relay

§

impl Send for Relay

§

impl Sync for Relay

§

impl Unpin for Relay

§

impl UnwindSafe for Relay

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CompatExt for T

Source§

fn compat(self) -> Compat<T>

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,