[−][src]Struct sv::peer::Peer
Node on the network to send and receive messages
It will setup a connection, respond to pings, and store basic properties about the connection, but any real logic to process messages will be handled outside. Network messages received will be published to an observable on the peer's receiver thread. Messages may be sent via send() from any thread. Once shutdown, the Peer may no longer be used.
Fields
id: ProcessUniqueId
Unique id for this connection
ip: IpAddr
IP address
port: u16
Port
network: Network
Network
Implementations
impl Peer
[src]
pub fn connect(
ip: IpAddr,
port: u16,
network: Network,
version: Version,
filter: Arc<dyn PeerFilter>
) -> Arc<Peer>
[src]
ip: IpAddr,
port: u16,
network: Network,
version: Version,
filter: Arc<dyn PeerFilter>
) -> Arc<Peer>
Creates a new peer and begins connecting
pub fn send(&self, message: &Message) -> Result<()>
[src]
Sends a message to the peer
pub fn disconnect(&self)
[src]
Disconects and disables the peer
pub fn connected_event(&self) -> &impl Observable<PeerConnected>
[src]
Returns a Single that emits a message when connected
pub fn disconnected_event(&self) -> &impl Observable<PeerDisconnected>
[src]
Returns a Single that emits a message when connected
pub fn messages(&self) -> &impl Observable<PeerMessage>
[src]
Returns an Observable that emits network messages
pub fn connected(&self) -> bool
[src]
Returns whether the peer is connected
pub fn time_delta(&self) -> i64
[src]
Returns the time difference in seconds between our time and theirs, which is valid after connecting
pub fn minfee(&self) -> u64
[src]
Returns the minimum fee this peer accepts in sats/1000bytes
pub fn sendheaders(&self) -> bool
[src]
Returns whether this peer may announce new blocks with headers instead of inv
pub fn sendcmpct(&self) -> bool
[src]
Returns whether compact blocks are supported
pub fn version(&self) -> Result<Version>
[src]
Gets the version message received during the handshake
Trait Implementations
impl Debug for Peer
[src]
impl Drop for Peer
[src]
impl Eq for Peer
[src]
impl Hash for Peer
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Peer> for Peer
[src]
Auto Trait Implementations
impl RefUnwindSafe for Peer
impl Send for Peer
impl Sync for Peer
impl Unpin for Peer
impl UnwindSafe for Peer
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,
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.
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>,