2018-07-11 14:35:24 +02:00
|
|
|
// Copyright 2018 Parity Technologies (UK) Ltd.
|
2017-12-13 12:08:40 +01:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
|
2019-09-02 11:16:52 +02:00
|
|
|
//! Implementation of the [Identify] protocol.
|
2017-12-13 12:08:40 +01:00
|
|
|
//!
|
2019-09-02 11:16:52 +02:00
|
|
|
//! This implementation of the protocol periodically exchanges
|
2022-10-04 01:17:31 +01:00
|
|
|
//! [`Info`] messages between the peers on an established connection.
|
2018-03-07 10:49:11 +01:00
|
|
|
//!
|
2019-09-02 11:16:52 +02:00
|
|
|
//! At least one identification request is sent on a newly established
|
|
|
|
//! connection, beyond which the behaviour does not keep connections alive.
|
2018-03-07 10:49:11 +01:00
|
|
|
//!
|
2022-02-09 15:54:07 +01:00
|
|
|
//! # Important Discrepancies
|
|
|
|
//!
|
|
|
|
//! - **Using Identify with other protocols** Unlike some other libp2p implementations,
|
|
|
|
//! rust-libp2p does not treat Identify as a core protocol. This means that other protocols cannot
|
|
|
|
//! rely upon the existence of Identify, and need to be manually hooked up to Identify in order to
|
|
|
|
//! make use of its capabilities.
|
|
|
|
//!
|
2019-09-02 11:16:52 +02:00
|
|
|
//! # Usage
|
2018-03-07 10:49:11 +01:00
|
|
|
//!
|
2022-10-04 01:17:31 +01:00
|
|
|
//! The [`Behaviour`] struct implements a [`NetworkBehaviour`](libp2p_swarm::NetworkBehaviour)
|
|
|
|
//! that negotiates and executes the protocol on every established connection, emitting
|
|
|
|
//! [`Event`]s.
|
|
|
|
|
|
|
|
pub use self::behaviour::{Behaviour, Config, Event};
|
|
|
|
pub use self::protocol::{Info, UpgradeError, PROTOCOL_NAME, PUSH_PROTOCOL_NAME};
|
|
|
|
|
|
|
|
#[deprecated(
|
|
|
|
since = "0.40.0",
|
|
|
|
note = "Use re-exports that omit `Identify` prefix, i.e. `libp2p::identify::Config`"
|
|
|
|
)]
|
|
|
|
pub type IdentifyConfig = Config;
|
|
|
|
|
|
|
|
#[deprecated(
|
|
|
|
since = "0.40.0",
|
|
|
|
note = "Use re-exports that omit `Identify` prefix, i.e. `libp2p::identify::Event`"
|
|
|
|
)]
|
|
|
|
pub type IdentifyEvent = Event;
|
|
|
|
|
|
|
|
#[deprecated(since = "0.40.0", note = "Use libp2p::identify::Behaviour instead.")]
|
|
|
|
pub type Identify = Behaviour;
|
2017-12-13 12:08:40 +01:00
|
|
|
|
2022-10-04 01:17:31 +01:00
|
|
|
#[deprecated(
|
|
|
|
since = "0.40.0",
|
|
|
|
note = "Use re-exports that omit `Identify` prefix, i.e. `libp2p::identify::Info`"
|
|
|
|
)]
|
|
|
|
pub type IdentifyInfo = Info;
|
2018-12-05 17:04:25 +01:00
|
|
|
|
2022-10-04 01:17:31 +01:00
|
|
|
mod behaviour;
|
2019-09-02 11:16:52 +02:00
|
|
|
mod handler;
|
|
|
|
mod protocol;
|
2020-01-15 12:02:02 +01:00
|
|
|
|
2022-08-14 04:03:04 +02:00
|
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
2020-01-15 12:02:02 +01:00
|
|
|
mod structs_proto {
|
|
|
|
include!(concat!(env!("OUT_DIR"), "/structs.rs"));
|
|
|
|
}
|