[−][src]Struct libp2p_websocket::WsConfig
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(&self) -> 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]
T: Transport + 'static,
T::Error: Send,
T::Dial: Send,
T::Listener: Send,
T::ListenerUpgrade: Send,
T::Output: AsyncRead + AsyncWrite + Send,
type Output = Box<dyn AsyncStream + Send>
The raw connection to a peer.
type Error = WsError<T::Error>
Error that can happen when dialing or listening.
type Listener = Box<dyn Stream<Item = (Self::ListenerUpgrade, Multiaddr), Error = Self::Error> + Send>
The listener produces incoming connections. Read more
type ListenerUpgrade = Box<dyn Future<Item = Self::Output, Error = Self::Error> + Send>
After a connection has been received, we may need to do some asynchronous pre-processing on it (e.g. an intermediary protocol negotiation). While this pre-processing takes place, we want to be able to continue polling on the listener. Read more
type Dial = Box<dyn Future<Item = Self::Output, Error = Self::Error> + Send>
A future which indicates that we are currently dialing to a peer.
fn listen_on(
self,
original_addr: Multiaddr
) -> Result<(Self::Listener, Multiaddr), TransportError<Self::Error>>
[src]
self,
original_addr: Multiaddr
) -> Result<(Self::Listener, Multiaddr), TransportError<Self::Error>>
fn dial(
self,
original_addr: Multiaddr
) -> Result<Self::Dial, TransportError<Self::Error>>
[src]
self,
original_addr: Multiaddr
) -> Result<Self::Dial, TransportError<Self::Error>>
fn nat_traversal(
&self,
server: &Multiaddr,
observed: &Multiaddr
) -> Option<Multiaddr>
[src]
&self,
server: &Multiaddr,
observed: &Multiaddr
) -> Option<Multiaddr>
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]
Self: Clone + Send + Sync + 'static,
Self::Dial: Send,
Self::Dial: 'static,
Self::Listener: Send,
Self::Listener: 'static,
Self::ListenerUpgrade: Send,
Self::ListenerUpgrade: 'static,
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]
F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone,
Applies a function on the output of the Transport
.
fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
F: FnOnce(Self::Error) -> TNewErr + Clone,
[src]
F: FnOnce(Self::Error) -> TNewErr + Clone,
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 struct that implements Transport
that contains both self
and other
. 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]
U: InboundUpgrade<Self::Output, Output = O, Error = E> + OutboundUpgrade<Self::Output, Output = O, Error = E>,
Self::Output: AsyncRead,
Self::Output: AsyncWrite,
Wraps this transport inside an upgrade. Whenever a connection that uses this transport is established, it is wrapped inside the 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]
C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
F: IntoFuture<Item = O>,
Wraps this transport inside an upgrade. Whenever a connection that uses this transport is established, it is wrapped inside the upgrade. Read more
fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self>
[src]
Adds a timeout to the connection and upgrade steps for all the sockets created by the transport. Read more
fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>
[src]
Adds a timeout to the connection and upgrade steps for all the outgoing sockets created by the transport. Read more
fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>
[src]
Adds a timeout to the connection and upgrade steps for all the incoming sockets created by the transport. Read more
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same for T
type Output = T
Should always be Self
impl<T> Erased for T
impl<T> Typeable for T where
T: Any,
T: Any,