Struct vapcore_network_devp2p::NetworkService [−][src]
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]
config: NetworkConfiguration,
filter: Option<Arc<dyn ConnectionFilter>>
) -> Result<NetworkService, Error>
Starts IO event loop
pub fn register_protocol(
&self,
handler: Arc<dyn NetworkProtocolHandler + Send + Sync>,
protocol: ProtocolId,
versions: &[(u8, u8)]
) -> Result<(), Error>
[src]
&self,
handler: Arc<dyn NetworkProtocolHandler + Send + Sync>,
protocol: ProtocolId,
versions: &[(u8, u8)]
) -> Result<(), Error>
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]
F: FnOnce(&dyn NetworkContext),
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]
&self,
protocol: ProtocolId,
action: F
) -> Option<T> where
F: FnOnce(&dyn NetworkContext) -> T,
Evaluates function in the network context
Auto Trait Implementations
impl !RefUnwindSafe for NetworkService
impl Send for NetworkService
impl Sync for NetworkService
impl Unpin for NetworkService
impl !UnwindSafe for NetworkService
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,