Struct vapcore_network_devp2p::NetworkService[][src]

pub struct NetworkService { /* fields omitted */ }

IO Service with networking Message defines a notification data type.

Implementations

impl NetworkService[src]

pub fn new(
    config: NetworkConfiguration,
    filter: Option<Arc<dyn ConnectionFilter>>
) -> Result<NetworkService, Error>
[src]

Starts IO event loop

pub fn register_protocol(
    &self,
    handler: Arc<dyn NetworkProtocolHandler + Send + Sync>,
    protocol: ProtocolId,
    versions: &[(u8, u8)]
) -> Result<(), Error>
[src]

Register a new protocol handler with the event loop.

pub fn host_info(&self) -> String[src]

Returns host identifier string as advertised to other peers

pub fn io(&self) -> &IoService<NetworkIoMessage>[src]

Returns underlying io service.

pub fn num_peers_range(&self) -> RangeInclusive<u32>[src]

Returns the number of peers allowed.

pub fn external_url(&self) -> Option<String>[src]

Returns external url if available.

pub fn local_url(&self) -> Option<String>[src]

Returns external url if available.

pub fn start(&self) -> Result<(), (Error, Option<SocketAddr>)>[src]

Start network IO.

In case of error, also returns the listening address for better error reporting.

pub fn stop(&self)[src]

Stop network IO.

pub fn connected_peers(&self) -> Vec<PeerId>[src]

Get a list of all connected peers by id.

pub fn add_reserved_peer(&self, peer: &str) -> Result<(), Error>[src]

Try to add a reserved peer.

pub fn remove_reserved_peer(&self, peer: &str) -> Result<(), Error>[src]

Try to remove a reserved peer.

pub fn set_non_reserved_mode(&self, mode: NonReservedPeerMode)[src]

Set the non-reserved peer mode.

pub fn with_context<F>(&self, protocol: ProtocolId, action: F) where
    F: FnOnce(&dyn NetworkContext), 
[src]

Executes action in the network context

pub fn with_context_eval<F, T>(
    &self,
    protocol: ProtocolId,
    action: F
) -> Option<T> where
    F: FnOnce(&dyn NetworkContext) -> T, 
[src]

Evaluates function in the network context

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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<V, T> VZip<V> for T where
    V: MultiLane<T>,