[][src]Struct libp2p_websocket::WsConfig

pub struct WsConfig<T> { /* fields omitted */ }

Represents the configuration for a websocket transport capability for libp2p. Must be put on top of another Transport.

This implementation of Transport accepts any address that ends with /ws or /wss, and will try to pass the underlying multiaddress to the underlying Transport.

Note that the underlying multiaddr is /dns4/... or /dns6/..., then this library will pass the domain name in the headers of the request. This is important is the listener is behind an HTTP proxy.

Note: /wss is only supported for dialing and not listening.

Methods

impl<T> WsConfig<T>[src]

pub fn new(inner: T) -> WsConfig<T>[src]

Creates a new configuration object for websocket.

The websockets will run on top of the Transport you pass as parameter.

Trait Implementations

impl<T: Clone> Clone for WsConfig<T>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for WsConfig<T>[src]

impl<T> Transport for WsConfig<T> where
    T: Transport + 'static,
    T::Error: Send,
    T::Dial: Send,
    T::Listener: Send,
    T::ListenerUpgrade: Send,
    T::Output: AsyncRead + AsyncWrite + Send
[src]

type Output = Box<dyn AsyncStream + Send>

The result of a connection setup process, including protocol upgrades. Read more

type Error = WsError<T::Error>

An error that occurred during connection setup.

type Listener = Box<dyn Stream<Item = ListenerEvent<Self::ListenerUpgrade>, Error = Self::Error> + Send>

A stream of Outputs for inbound connections. Read more

type ListenerUpgrade = Box<dyn Future<Item = Self::Output, Error = Self::Error> + Send>

A pending Output for an inbound connection, obtained from the Listener stream. Read more

type Dial = Box<dyn Future<Item = Self::Output, Error = Self::Error> + Send>

A pending Output for an outbound connection, obtained from dialing. Read more

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Clone + Send + Sync + 'static,
    Self::Dial: Send,
    Self::Dial: 'static,
    Self::Listener: Send,
    Self::Listener: 'static,
    Self::ListenerUpgrade: Send,
    Self::ListenerUpgrade: 'static, 
[src]

Turns this Transport into an abstract boxed transport.

fn map<F, O>(self, map: F) -> Map<Self, F> where
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

Applies a function on the connections created by the transport.

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

Applies a function on the errors generated by the futures of the transport.

fn or_transport<T>(self, other: T) -> OrTransport<Self, T>[src]

Builds a new transport that falls back to another transport when encountering errors on dialing or listening for connections. Read more

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    U: InboundUpgrade<Self::Output, Output = O, Error = E> + OutboundUpgrade<Self::Output, Output = O, Error = E>,
    Self::Output: AsyncRead,
    Self::Output: AsyncWrite
[src]

Wraps this transport inside an [Upgrade]. Read more

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

Applies a function producing an asynchronous result to every connection created by this transport. Read more

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self>[src]

Adds a timeout to the connection setup (including upgrades) for all inbound and outbound connection attempts. Read more

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>[src]

Adds a timeout to the connection setup (including upgrades) for all outbound connection attempts. Read more

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>[src]

Adds a timeout to the connection setup (including upgrades) for all inbound connection attempts. Read more

Auto Trait Implementations

impl<T> Send for WsConfig<T> where
    T: Send

impl<T> Sync for WsConfig<T> where
    T: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.